# Using "not filter" and "match\_all" filter on nested objects

**URL:** https://discuss.elastic.co/t/using-not-filter-and-match-all-filter-on-nested-objects/22536
**Category:** Elasticsearch
**Created:** [March 5, 2015, 7:58pm UTC](https://discuss.elastic.co/t/using-not-filter-and-match-all-filter-on-nested-objects/22536 "2015-03-05T19:58:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Bert\_Vanpeteghem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bert_vanpeteghem/32/96191_2.png) [@Bert\_Vanpeteghem](https://discuss.elastic.co/u/Bert_Vanpeteghem)
#### Post date: [March 5, 2015, 7:58pm UTC](https://discuss.elastic.co/t/using-not-filter-and-match-all-filter-on-nested-objects/22536/1 "2015-03-05T19:58:09Z")

</div>

Hi,

I found that when looking for empty arrays of nested objects, I need to put  
the not filter around the nested filter.  
This is ok, but in our situation, it would be nice if we could have it the  
other way around, so that we can have the nested filter as the outer level.  
It works for term queries that way, but not for match\_all queries.

Note: the match\_all for finding non-empty values is a technique borrowed  
from: [https://github.com/elasticsearch/elasticsearch/issues/3495](https://github.com/elasticsearch/elasticsearch/issues/3495)

Is there a way to have the nested filter as the outer one, and somehow  
achieve the same results?

The following gist has curl with mappings & queries:

> <https://gist.github.com/bertvan/a0b88edb3c03a9e6cf83>

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/10d0dacb-3884-4d9c-82bc-76248033e87d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/10d0dacb-3884-4d9c-82bc-76248033e87d%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 12:28am UTC](https://discuss.elastic.co/t/using-not-filter-and-match-all-filter-on-nested-objects/22536/2 "2017-07-06T00:28:18Z")

</div>


