Mr. code
Mr. code

Reputation: 157

Azure search fetch multiple records

I want to fetch multiple records from Azure index using one of the fields, but I am unsure that how many number of filters can I use in a single query. Suppose if I want to fetch 1000 records, can I add 1000 filters to the search query?

for example : I have a field called field_document_id and I want to fetch multiple documents given that I have the ids of the document. For this I am querying like : *&$filter=field_document_id eq '1', this will fetch me the document with field_document_id value 1, suppose I want to fetch multiple documents in a single request like this, I there any other way ? If I use multiple filters is there any limit to it?

Upvotes: 1

Views: 465

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136196

I believe there are limits in the number of filter clauses you can define however I am not able to find the exact number. This is what is mentioned here:

There are limits to the size and complexity of filter expressions that you can send to Azure Cognitive Search. The limits are based roughly on the number of clauses in your filter expression. A good guideline is that if you have hundreds of clauses, you are at risk of exceeding the limit. We recommend designing your application in such a way that it doesn't generate filters of unbounded size.

Microsoft recommends that you use search.in function when you have a large number of filter clauses on a single field. According to the documentation, it not only overcomes the filter size limitation but is also better in terms of performance.

Upvotes: 1

Related Questions