# Missing filter with nested objects

**URL:** <https://discuss.elastic.co/t/missing-filter-with-nested-objects/14428>\
**Category:** Elasticsearch\
**Created:** [November 15, 2013, 1:18pm UTC](https://discuss.elastic.co/t/missing-filter-with-nested-objects/14428 "2013-11-15T13:18:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ernesto\_Reig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ernesto_reig/32/951_2.png) [@Ernesto\_Reig](https://discuss.elastic.co/u/Ernesto_Reig)\
**Post date:** [November 15, 2013, 1:18pm UTC](https://discuss.elastic.co/t/missing-filter-with-nested-objects/14428/1 "2013-11-15T13:18:10Z")

</div>

Hello,  
I know that this has been discussed in other threads but I would like to  
know if I am missing something or it is just that missing filter does not  
work properly with nested objects.  
I have left the examples I have been running:

> <https://gist.github.com/Erni/7484095>
>
> There are more than three files. show original

  
You can have a look and tell me if I am doing something wrong or it works  
just like that. As a workaround I would add a field to indicate whether the  
nested object attribute ("priosenio" in this case) is empty or not.

Thank you very much,

Ernesto

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Boaz\_Leskes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/boaz_leskes/32/723_2.png) [@Boaz\_Leskes](https://discuss.elastic.co/u/Boaz_Leskes)\
**Post date:** [November 15, 2013, 8:54pm UTC](https://discuss.elastic.co/t/missing-filter-with-nested-objects/14428/2 "2013-11-15T20:54:29Z")

</div>

Hi Ernesto,

What you need is:

curl -XPOST "[http://ocvli-apw602:9200/test2/IR/\_search](http://ocvli-apw602:9200/test2/IR/_search)" -d'  
{  
"filter": {  
"not": {  
"nested": {  
"path": "priosenio",  
"filter": {  
"match\_all": {}  
}  
}  
}  
}  
}'

I do feel that your gut feeling is correct in expecting the missing filter  
to just work. Please feel free to open an issue on github explaining it.

Cheers,  
Boaz

On Friday, November 15, 2013 2:18:10 PM UTC+1, Ernesto Reig wrote:

> Hello,  
> I know that this has been discussed in other threads but I would like to  
> know if I am missing something or it is just that missing filter does not  
> work properly with nested objects.  
> I have left the examples I have been running:  
> [Elasticsearch missing filter with nested objects · GitHub](https://gist.github.com/Erni/7484095)  
> You can have a look and tell me if I am doing something wrong or it works  
> just like that. As a workaround I would add a field to indicate whether the  
> nested object attribute ("priosenio" in this case) is empty or not.
> 
> Thank you very much,
> 
> Ernesto

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ernesto\_Reig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ernesto_reig/32/951_2.png) [@Ernesto\_Reig](https://discuss.elastic.co/u/Ernesto_Reig)\
**Post date:** [November 16, 2013, 9:52am UTC](https://discuss.elastic.co/t/missing-filter-with-nested-objects/14428/3 "2013-11-16T09:52:17Z")

</div>

Hi Boaz,  
I don´t quite understand exactly how that query works, but I ´ll look into  
it.  
In any case, what my "gut feeling" is saying is "use the missing filter to  
find the docs with empty or no priosenio attribute, as it does with normal  
objects".

Thank you very much for your response, it´s been very helpful 🙂

Ernesto

On 15 November 2013 21:54, Boaz Leskes [b.leskes@gmail.com](mailto:b.leskes@gmail.com) wrote:

> Hi Ernesto,
> 
> What you need is:
> 
> curl -XPOST "[http://ocvli-apw602:9200/test2/IR/\_search](http://ocvli-apw602:9200/test2/IR/_search)" -d'  
> {  
> "filter": {  
> "not": {  
> "nested": {  
> "path": "priosenio",  
> "filter": {  
> "match\_all": {}  
> }  
> }  
> }  
> }  
> }'
> 
> I do feel that your gut feeling is correct in expecting the missing filter  
> to just work. Please feel free to open an issue on github explaining it.
> 
> Cheers,  
> Boaz
> 
> On Friday, November 15, 2013 2:18:10 PM UTC+1, Ernesto Reig wrote:
> 
> > Hello,  
> > I know that this has been discussed in other threads but I would like to  
> > know if I am missing something or it is just that missing filter does not  
> > work properly with nested objects.  
> > I have left the examples I have been running: [https://gist.github](https://gist.github).  
> > com/Erni/7484095  
> > You can have a look and tell me if I am doing something wrong or it works  
> > just like that. As a workaround I would add a field to indicate whether the  
> > nested object attribute ("priosenio" in this case) is empty or not.
> > 
> > Thank you very much,
> > 
> > Ernesto
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/Lgn7ve6RbV8/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Lgn7ve6RbV8/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:06am UTC](https://discuss.elastic.co/t/missing-filter-with-nested-objects/14428/4 "2017-07-06T02:06:39Z")

</div>


