Count Documents (Azure Search Service REST API)
The Count Documents operation retrieves a count of the number of documents in a search index. The
$count syntax is part of the OData protocol.
GET https://[service name].search.windows.net/indexes/[index name]/docs/$count?api-version=[api-version] Accept: text/plain api-key: [admin key]
HTTPS is required for service requests. The Count Documents request can be constructed using the GET method.
[index name] in the request URI tells the service to return a count of all items in the docs collection of the specified index.
api-version parameter is required. See API versions in Azure Search for a list of available versions.
The following table describes the required and optional request headers.
|Accept:||This value must be set to text/plain.|
You will also need the service name to construct the request URL. You can get the service name and
api-key from your service dashboard in the Azure classic portal. See Create an Azure Search service in the portal for page navigation help.
Status Code: 200 OK is returned for a successful response.
The response body contains the count value as an integer formatted in plain text.