# Filter on object non existing subfield

**URL:** <https://discuss.elastic.co/t/filter-on-object-non-existing-subfield/15480>\
**Category:** Elasticsearch\
**Created:** [January 29, 2014, 4:32pm UTC](https://discuss.elastic.co/t/filter-on-object-non-existing-subfield/15480 "2014-01-29T16:32:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aldm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aldm/32/45644_2.png) [@aldm](https://discuss.elastic.co/u/aldm)\
**Post date:** [January 29, 2014, 4:32pm UTC](https://discuss.elastic.co/t/filter-on-object-non-existing-subfield/15480/1 "2014-01-29T16:32:19Z")

</div>

Hi,

we're using elasticsearch 0.90.7 version.

What is behaviour of this version regarding of filter on non existing  
object field? It seems it is working fine with dynamic mappings.  
For example, field 'person':

person : { first\_name: "john", age: 25}

Using prefix filter on person.last\_name - field that does not exist for  
person works fine:

{"filter" : {"prefix" : {"person.last\_name" : "doe" } } }

I know there were some exceptions like 'field not exists' in earlier  
versions when running this filter.

Is this fixed on newer ES versions?  
Is it safe to filter by object subfield that does not exists (it will be  
ignored) ?

Thanks in advance

--  
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/9217354a-c4a4-419e-ab7f-3e93d0c24c62%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9217354a-c4a4-419e-ab7f-3e93d0c24c62%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)\
**Post date:** [January 29, 2014, 6:41pm UTC](https://discuss.elastic.co/t/filter-on-object-non-existing-subfield/15480/2 "2014-01-29T18:41:18Z")

</div>

You should be fine. I tested on 0.90.7 as well as on 1.0 RC1. When the  
field does not exist, the prefix filter will not match the document, and  
the query succeeds with no errors.

--  
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/76b5b5c5-0139-4a45-8cdd-48a806fe4fa5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/76b5b5c5-0139-4a45-8cdd-48a806fe4fa5%40googlegroups.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, 1:54am UTC](https://discuss.elastic.co/t/filter-on-object-non-existing-subfield/15480/3 "2017-07-06T01:54:07Z")

</div>


