Search code examples
restazure-cognitive-search

Filtering / limiting Azure Search rest API to field with a specific value


I have an azure search index which contains multiple types of entities.

If I do a search like &search=term it might return entities of multiple types, all containing the search value. How can I require a specific field to have a specific value? I tried with &search=term&filter=my_field eq my_value but that didn't work.

Alternatively I have to client-side filter the value array and filter out the specific entity-types I don't want, but I can't imagine this functionality doesn't exist in the query syntax.


Solution

  • If you’re sending queries to the Azure Search REST API using GET, you need to spell the parameter “$filter”, not “filter” (note the dollar sign). Otherwise the parameter will be ignored.