Get Service Statistics (Preview REST API)

Applies to: 2023-07-01-Preview, 2021-04-30-Preview

Important

2023-07-01-Preview adds vectorIndexSize scoped to a search service.

2021-04-30-Preview adds aliasesCount.

The Service Statistics operation returns the number and type of objects in your service, the maximum allowed for each object type given the service tier, actual and maximum storage, and other limits that vary by tier. This request pulls information from the service so that you don't have to look up or calculate service limits.

Statistics on document count and storage size are collected every few minutes, not in real time. Therefore, the statistics returned by this API may not reflect changes caused by recent indexing operations.

GET https://[service name].search.windows.net/servicestats?api-version=[api-version]
   Content-Type: application/json  
   api-key: [admin key]  

URI Parameters

Parameter Description
service name Required. Set this value to the unique, user-defined name of your search service. The request URI specifies the name of the index for which statistics should be returned.
api-version Required. The current preview version is 2023-07-01-Preview. See API versions for more versions.

Request Headers

The following table describes the required and optional request headers.

Fields Description
Content-Type Required. Set this value to application/json
api-key Optional if you're using Azure roles and a bearer token is provided on the request, otherwise a key is required. An api-key is a unique, system-generated string that authenticates the request to your search service. Get requests against the search service must include an api-key header set to your admin key (as opposed to a query key). See Connect to Azure AI Search using key authentication for details.

Request Body

None.

Response

Status Code: "200 OK" is returned for a successful response. The response body is in the following format:

{
    "counters": {
        "documentCount": {
            "usage": number,
            "quota": number | null (if the service has unlimited document counts, the quota will be null)
        },
        "indexesCount": {
            "usage": number,
            "quota": number
        },
        "indexersCount": {
            "usage": number,
            "quota": number
        },
        "dataSourcesCount": {
            "usage": number,
            "quota": number
        },
        "storageSize": {
            "usage": number (bytes),
            "quota": number (bytes) 
        },
        "synonymMaps": {
            "usage": number,
            "quota": number
        },
        "aliasesCount": {
            "usage": number,
            "quota": number
        },
        "vectorIndexSize": {
            "usage": number (bytes),
            "quota": number (bytes)
        }
    },
    "limits": {
        "maxFieldsPerIndex": number,
        "maxIndexerRunTime": string,
        "maxFileExtractionSize": number,
        "maxFileContentCharactersToExtract": number,
        "maxFieldNestingDepthPerIndex": number,
        "maxComplexCollectionFieldsPerIndex": number,
        "maxComplexObjectsInCollectionsPerDocument": number
    }
}
Statistic Type Description
documentCount Count An aggregation of all documents from all indexes. Early versions of Azure AI Search enforced document count limits, but that limit no longer exists. The quota is always null indicating that the service can have unlimited document counts.
indexesCount Count The number of indexes on the search service. Maximum indexes vary by tier, as reported by the quota.
indexersCount Count The number of indexers on the search service. Maximum indexers vary by tier, as reported by the quota.
dataSourcesCount Count The number of data sources on the search service. Maximum data sources vary by tier, as reported by the quota. Maximum data sources are the same number as maximum indexers.
aliasesCount Count The number of index aliases on the search service. Maximum varies by tier, as reported by the quota.
synonymMaps Count The number of synonym maps on the search service. Maximum varies by tier, as reported by the quota.
storageSize Bytes Usage is the amount storage used by all objects on the service. Quota is the maximum storage available based on the size and number of partitions configured for your service. Quota increases and decreases in response to the number of partitions provisioned in the search service. Partition size varies by tier.
vectorIndexSize Bytes A vector index is an internal structure, one vector index per vector field as defined in a search index. Total usage is reported across the service so that you can monitor vector space consumption relative to the vector index limit of your search service. Quota varies by age of the search service, number of partitions, and size of partitions as determined by tier.

For more information about all limits, see Service limits .

Examples

This API is data plane. To get more information about a service, such as it's tier or location, see the Management REST API.

{
    "@odata.context": "https://my-search-service.search.windows.net/$metadata#Microsoft.Azure.Search.V2019_05_06.ServiceStatistics",
    "counters": {
        "documentCount": {
            "usage": 5072,
            "quota": null
        },
        "indexesCount": {
            "usage": 10,
            "quota": 15
        },
        "indexersCount": {
            "usage": 8,
            "quota": 15
        },
        "dataSourcesCount": {
            "usage": 9,
            "quota": 15
        },
        "storageSize": {
            "usage": 22265221,
            "quota": 2147483648
        },
        "synonymMaps": {
            "usage": 0,
            "quota": 3
        },
        "aliasesCount": {
            "usage": 7,
            "quota": 30
        },
        "vectorIndexSize": {
            "usage": 1342476,
            "quota": 1073741824
    },
    "limits": {
        "maxFieldsPerIndex": 1000,
        "maxIndexerRunTime": "P1D",
        "maxFileExtractionSize": 16777216,
        "maxFileContentCharactersToExtract": 65536,
        "maxFieldNestingDepthPerIndex": 10,
        "maxComplexCollectionFieldsPerIndex": 40,
        "maxComplexObjectsInCollectionsPerDocument": 3000
    }
}

See also