Search code examples
lucene.netazure-cognitive-search

Azure Search to return ONLY record count


I have the situation in Azure Search where I need to return ONLY count of matched search results- and not the actual results (will be done separately based on user request). This to reduce payload and hence improve performance.

When I use these parameters to the searchindex $count=true&search=ruby, I get @odata.count": 373 but also get the 373 records

I am able to reduce the records returned by introducing $skip but this is inefficient

Is there a way to only get result count and not the actual records


Solution

  • You can use the query parameter $top=0. The docs are here.