Cognitive Search: Odata Filter or Search across multiple Edm.String fields in Collection(Edm.ComplexType)

Nwankwoh, Dozie 1 Reputation point
2021-12-09T07:09:10.497+00:00

I have the following Index:

{
"value": [
{
"acs_index_id": "0",
"name": "Name1",
"application": [
{
"L1": "House",
"L2": "Hospital",
"L3": "House",
"L4": "Church"
},
{
"L1": "Dog",
"L2": "Cat",
"L3": "Mouse",
"L4": null
}
]
}
]
}
I am able to filter across all the application/L1 using:
$filter=application/any(a: a/L1 eq 'House')

In order to search across all "L's" (L1,L2,L3,L4), I am using:

$filter=application/any(a: a/L1 eq 'House') or
application/any(a: a/L2 eq 'House') or
application/any(a: a/L3 eq 'House') or
application/any(a: a/L4 eq 'House')

Questions:

Is there a more elegant way to filter across all the "L" fields? Maybe in one line?
Am I able to search across the fields or am I limited to using filter?

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
865 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 24,971 Reputation points Microsoft Employee
    2021-12-10T05:34:02.327+00:00

    @Nwankwoh, Dozie Thanks for posting this question here. I'd answered your question on your GitHub thread. Your feedback is much appreciated.
    Kindly be assured that I have also relayed your feedback internally to our product engineering team.

    Because the granularity of your index is at the parent level rather than the child level, currently it is not possible pull only the child item from the list.
    Alternatively, you could change the granularity of your index. Another option could be to keep your existing schema and then do a second layer of filtering of the */child at the application layer, to have only required criteria to list in your application.

    Quoting the response from Derek Legenzoff (our Azure Search PG).

    We don't have any immediate plans to change the way this works that I'm aware of but we're always looking to improve the product based on feedback from customers like yourself so we appreciate you sharing the feedback with us.

    -Kindly check this thread for similar feedback request, response from our PG and workaround that you could leverage:

    FEATURE REQ - Azure Search Working with Complex Collections

    -Also checkout this doc - Model complex data types in Azure Cognitive Search] for more info.

    0 comments No comments