Search code examples
azureazure-cognitive-searchazure-search-.net-sdk

Azure Search - Is the count approximate or real?


I am with an Azure Search with around 615k docs. I am getting different counts when using $count when comparing with the previous search based on sql server. O the official doc I could not find any information about it, but here on StackOverflow I’ve found the following:

https://stackoverflow.com/a/47089349

So is the $count approximate or real? Is there any information in the official doc about it that I’ve missed?


Solution

  • The count is approximate. From the REST API documentation page:

    $count=true | false

    Optional, defaults to false. When calling via POST, this parameter is named count instead of $count. Specifies whether to fetch the total count of results. This is the count of all documents that match the search and $filter parameters, ignoring $top and $skip. Setting this value to true may have a performance impact. Note that the count returned is an approximation. If you’d like to get only the count without any documents, you can use $top=0