Reputation: 3253
Im using Azure Search
I have the data structure below
[
{
"id": "7c064374-73ea-4d0c-c363-2801887b07cf",
"companies": [
{
"companyId": "6f8d235e-69b7-42f9-9917-79411754fef0",
"companyName": "Company"
}
]
}
]
If I want to find all the entries where a guid exists in accounts the filter is
$filter=companies/any(c: c/companyId eq 'value to find')
What is the syntax for getting only entries where value to find is NOT in the companies list?
$filter=companies/any(c: c/companyId ne 'value to find')
Will not work because it will return any entries in the index that contain a company id that is not the id which is enough to to bring a entry back if an entry has 2 companies, one that matches the criteria and one that doesnt
Paul
Upvotes: 2
Views: 485
Reputation: 13833
https://learn.microsoft.com/en-us/azure/search/search-query-odata-collection-operators
$filter=companies/all(c: c/companyId ne 'value to find')
Upvotes: 1