Get Index Statistics (Preview REST API)

Applies to: 2023-07-01-Preview

Important

2023-07-01-Preview adds vectorIndexSize scoped to an index.

The Get Index Statistics operation returns the document count for the current index, plus the amount of total storage used by the index all-up, and the amount storage consumed by just its vector data. A search service has an overall limit on the amount of vector storage as reported by Get Service Statistics. The "vectorIndexSize" metric tells you how much vector storage is used for vector fields in the current search index.

Note

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/indexes/[index name]/stats?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.
index name Required. The request URI specifies the name of the index for which statistics should be returned.
api-version Required. The current stable version is api-version=2020-06-30. 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 for an object definition must include an api-key field 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:

{  
  "documentCount": number,  
  "storageSize": number (size of the index in bytes), 
  "vectorIndexSize": number (size of the index in bytes) 
}

If there are no vector fields in the index, "vectorIndexSize" is zero.

See also