0
votes

I'm using Azure Cognitive Search Service for my application. First, we have to create a data source, indexer and index in order to create a search service.

Assume that we have the following simple JSON that is indexed in azure search.

{ 
  "hotelId: 1, 
  "rooms": { 
             "roomId": 1, 
             "type": "deluxe" 
           } 
}

I'm trying to use the OData $filter function to filter my results

$filter=Rooms/any(room: room/Type eq 'deluxe')

But azure search throws an error "Invalid expression: Any/All may only be used following a collection.\r\nParameter name: $filter"

1

1 Answers

0
votes

From MSDN https://docs.microsoft.com/en-us/azure/search/search-query-odata-filter

enter image description here

The error says that we can use Rooms/any only if the object is an Array. When you are trying to use a $filter function on a field that is not a type of collection we get that error.