Answered by:
Azure Search empty Collection filter

Question
-
I have a simple question:
How do I filter empty Collection(Edm.String) fields? I want to select only those documents that have a field of type Collection - empty. Is that possible?
Tuesday, May 29, 2018 1:10 PM
Answers
-
Just put ‘not’ in front of it: not tags/any()
- Marked as answer by Nikola Biondic Friday, June 1, 2018 1:13 PM
Friday, June 1, 2018 12:22 PM -
Hi Nikola, You can use ‘any’ for this purpose. See the example here: https://stackoverflow.com/questions/50046757/how-to-filter-an-empty-array-in-azure-search
- Proposed as answer by Bruce Johnston - MSFT Tuesday, May 29, 2018 2:05 PM
- Marked as answer by Bruce Johnston - MSFT Thursday, May 31, 2018 6:42 PM
- Edited by Bruce Johnston - MSFT Thursday, May 31, 2018 6:42 PM Link-ify the link
Tuesday, May 29, 2018 2:05 PM
All replies
-
Hi Nikola, You can use ‘any’ for this purpose. See the example here: https://stackoverflow.com/questions/50046757/how-to-filter-an-empty-array-in-azure-search
- Proposed as answer by Bruce Johnston - MSFT Tuesday, May 29, 2018 2:05 PM
- Marked as answer by Bruce Johnston - MSFT Thursday, May 31, 2018 6:42 PM
- Edited by Bruce Johnston - MSFT Thursday, May 31, 2018 6:42 PM Link-ify the link
Tuesday, May 29, 2018 2:05 PM -
Hi Bruce,
thanks for the answer. Using /any() returns all the documents that do have something in that field. What I need is the opposite, to retrieve only those that have the field empty. Is there a negation of this query?
Friday, June 1, 2018 8:17 AM -
Just put ‘not’ in front of it: not tags/any()
- Marked as answer by Nikola Biondic Friday, June 1, 2018 1:13 PM
Friday, June 1, 2018 12:22 PM