0

Imagine I have a Collection of ids like:

[1,11,21]
[1,5,6]
[11,35,56]

I need to filter the Collection in order only to get the field which contains both 1 and 11. By doing a search.in I get 1 OR 11.

What would be the correct way of performing a filter to get fields with 1 AND 11?

Carlos Alves Jorge
  • 1,919
  • 1
  • 13
  • 29

1 Answers1

2

You can formulate a filter expression like -

$filter=fieldname/any(t: t eq '1') and fieldname/any(t: t eq '11')

where fieldname would be the field of Collection type. This would filter the fields that have both 1 and 11 in the collection. You can refer to the docs for other supported OData expressions in Azure Search.

Note that Azure Search Index currently supports Collection(Edm.String). If you want a collection of other primitive types for the ids, there is a feature which is in private preview at the moment. Shoot me an email if you want to try it out.