# Elastic search counterintuitive behaviour

**URL:** <https://discuss.elastic.co/t/elastic-search-counterintuitive-behaviour/14627>\
**Category:** Elasticsearch\
**Created:** [November 28, 2013, 12:29pm UTC](https://discuss.elastic.co/t/elastic-search-counterintuitive-behaviour/14627 "2013-11-28T12:29:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Fisher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daniel_fisher/32/1949_2.png) [@Daniel\_Fisher](https://discuss.elastic.co/u/Daniel_Fisher)\
**Post date:** [November 28, 2013, 12:29pm UTC](https://discuss.elastic.co/t/elastic-search-counterintuitive-behaviour/14627/1 "2013-11-28T12:29:34Z")

</div>

I have Elasticsearch demonstrating counterintuitive behaviour. This is  
reproducible with the following steps

1. Add a document

curl -XPUT '[http://myelasticseach:1234/anindex/atype/1](http://myelasticseach:1234/anindex/atype/1)' -d '  
{  
obj1:  
{  
foo : "bar"  
},  
obj2 :  
{  
baz : "qux"  
}  
}'

1. Search for 'bar'. I expect and get 1 result

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=bar](http://myelasticseach:1234/anindex/_search?q=bar)'

1. Search for 'qux'. I expect and get 1 result

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=qux](http://myelasticseach:1234/anindex/_search?q=qux)'

1. Update document

curl -XPUT '[http://myelasticseach:1234/anindex/atype/1](http://myelasticseach:1234/anindex/atype/1)' -d '  
{  
atype:  
{  
foo : "bar"  
},  
obj2 :  
{  
baz : "qux"  
}  
}'

1. Search for 'bar'. I expect and get 1 result

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=bar](http://myelasticseach:1234/anindex/_search?q=bar)'

1. Sarch for 'qux'. I expect 1 result, but get 0???

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=qux](http://myelasticseach:1234/anindex/_search?q=qux)'

Why when the nested object in the document has a key matching the type of  
the document can I no longer get results from the rest of the objects, with  
keys that do not match the type?

--  
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/e122daa5-66dd-4875-b33d-8e6029668424%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e122daa5-66dd-4875-b33d-8e6029668424%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:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 28, 2013, 9:24pm UTC](https://discuss.elastic.co/t/elastic-search-counterintuitive-behaviour/14627/2 "2013-11-28T21:24:25Z")

</div>

Hey Daniel,

I tried to reproduce your case but everything is working fine for me: [https://gist.github.com/dadoonet/7698308](https://gist.github.com/dadoonet/7698308)

May be you have something else (specific mapping or settings ???)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 28 novembre 2013 at 13:29:37, Daniel Fisher ([danielfishr@gmail.com](mailto:danielfishr@gmail.com)) a écrit:

I have Elasticsearch demonstrating counterintuitive behaviour. This is reproducible with the following steps

1. Add a document

curl -XPUT '[http://myelasticseach:1234/anindex/atype/1](http://myelasticseach:1234/anindex/atype/1)' -d '  
{  
obj1:  
{  
foo : "bar"  
},  
obj2 :  
{  
baz : "qux"  
}  
}'

1. Search for 'bar'. I expect and get 1 result

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=bar](http://myelasticseach:1234/anindex/_search?q=bar)'

1. Search for 'qux'. I expect and get 1 result

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=qux](http://myelasticseach:1234/anindex/_search?q=qux)'

1. Update document

curl -XPUT '[http://myelasticseach:1234/anindex/atype/1](http://myelasticseach:1234/anindex/atype/1)' -d '  
{  
atype:  
{  
foo : "bar"  
},  
obj2 :  
{  
baz : "qux"  
}  
}'

1. Search for 'bar'. I expect and get 1 result

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=bar](http://myelasticseach:1234/anindex/_search?q=bar)'

1. Sarch for 'qux'. I expect 1 result, but get 0???

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=qux](http://myelasticseach:1234/anindex/_search?q=qux)'

Why when the nested object in the document has a key matching the type of the document can I no longer get results from the rest of the objects, with keys that do not match the type?

--  
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/e122daa5-66dd-4875-b33d-8e6029668424%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e122daa5-66dd-4875-b33d-8e6029668424%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/etPan.5297b489.74de0ee3.3e14%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.5297b489.74de0ee3.3e14%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Daniel\_Fisher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daniel_fisher/32/1949_2.png) [@Daniel\_Fisher](https://discuss.elastic.co/u/Daniel_Fisher)\
**Post date:** [November 28, 2013, 11:37pm UTC](https://discuss.elastic.co/t/elastic-search-counterintuitive-behaviour/14627/3 "2013-11-28T23:37:55Z")

</div>

Hi David

Using your Gist I get the expected behaviour however you didn't copy my  
example correctly.

You specified the index as "type" in the URL i.e.

curl -XPUT  
"[https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/](https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/)  
_type_/1?refresh"

If you specify the index as "atype" you will see the behaviour I'm  
describing

i.e. curl -XPUT  
"[https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/](https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/)  
_atype_/1?refresh"

Thanks,  
Dan

On Thursday, November 28, 2013 9:24:25 PM UTC, David Pilato wrote:

> Hey Daniel,
> 
> I tried to reproduce your case but everything is working fine for me:  
> [Test for case in ML: https://groups.google.com/d/msgid/elasticsearch/e122daa5-66dd-4875-b33d-8e6029668424%40googlegroups.com · GitHub](https://gist.github.com/dadoonet/7698308)
> 
> May be you have something else (specific mapping or settings ???)
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> 
> Le 28 novembre 2013 at 13:29:37, Daniel Fisher ([danie...@gmail.com](mailto:danie...@gmail.com)\<javascript:\>)  
> a écrit:
> 
> I have Elasticsearch demonstrating counterintuitive behaviour. This is  
> reproducible with the following steps
> 
> 1. Add a document
> 
> curl -XPUT '[http://myelasticseach:1234/anindex/atype/1](http://myelasticseach:1234/anindex/atype/1)' -d '  
> {  
> obj1:  
> {  
> foo : "bar"  
> },  
> obj2 :  
> {  
> baz : "qux"  
> }  
> }'
> 
> 1. Search for 'bar'. I expect and get 1 result
> 
> curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=bar](http://myelasticseach:1234/anindex/_search?q=bar)'
> 
> 1. Search for 'qux'. I expect and get 1 result
> 
> curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=qux](http://myelasticseach:1234/anindex/_search?q=qux)'
> 
> 1. Update document
> 
> curl -XPUT '[http://myelasticseach:1234/anindex/atype/1](http://myelasticseach:1234/anindex/atype/1)' -d '  
> {  
> atype:  
> {  
> foo : "bar"  
> },  
> obj2 :  
> {  
> baz : "qux"  
> }  
> }'
> 
> 1. Search for 'bar'. I expect and get 1 result
> 
> curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=bar](http://myelasticseach:1234/anindex/_search?q=bar)'
> 
> 1. Sarch for 'qux'. I expect 1 result, but get 0???
> 
> curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=qux](http://myelasticseach:1234/anindex/_search?q=qux)'
> 
> ## Why when the nested object in the document has a key matching the type of the document can I no longer get results from the rest of the objects, with keys that do not match the type?
> 
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/e122daa5-66dd-4875-b33d-8e6029668424%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e122daa5-66dd-4875-b33d-8e6029668424%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6e7b31fa-78d8-45f2-9bb6-01b5d1cff426%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6e7b31fa-78d8-45f2-9bb6-01b5d1cff426%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:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 29, 2013, 8:14am UTC](https://discuss.elastic.co/t/elastic-search-counterintuitive-behaviour/14627/4 "2013-11-29T08:14:21Z")

</div>

You're right. My gist was incorrect.

Actually, you are hitting this issue: [https://github.com/elasticsearch/elasticsearch/issues/3005](https://github.com/elasticsearch/elasticsearch/issues/3005)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 29 novembre 2013 at 00:37:58, Daniel Fisher ([danielfishr@gmail.com](mailto:danielfishr@gmail.com)) a écrit:

Hi David

Using your Gist I get the expected behaviour however you didn't copy my example correctly.

You specified the index as "type" in the URL i.e.

curl -XPUT "[https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/type/1?refresh](https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/type/1?refresh)"

If you specify the index as "atype" you will see the behaviour I'm describing

i.e. curl -XPUT "[https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/atype/1?refresh](https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/atype/1?refresh)"

Thanks,  
Dan

On Thursday, November 28, 2013 9:24:25 PM UTC, David Pilato wrote:  
Hey Daniel,

I tried to reproduce your case but everything is working fine for me: [https://gist.github.com/dadoonet/7698308](https://gist.github.com/dadoonet/7698308)

May be you have something else (specific mapping or settings ???)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 28 novembre 2013 at 13:29:37, Daniel Fisher ([danie...@gmail.com](mailto:danie...@gmail.com)) a écrit:

I have Elasticsearch demonstrating counterintuitive behaviour. This is reproducible with the following steps

1. Add a document

curl -XPUT '[http://myelasticseach:1234/anindex/atype/1](http://myelasticseach:1234/anindex/atype/1)' -d '  
{  
obj1:  
{  
foo : "bar"  
},  
obj2 :  
{  
baz : "qux"  
}  
}'

1. Search for 'bar'. I expect and get 1 result

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=bar](http://myelasticseach:1234/anindex/_search?q=bar)'

1. Search for 'qux'. I expect and get 1 result

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=qux](http://myelasticseach:1234/anindex/_search?q=qux)'

1. Update document

curl -XPUT '[http://myelasticseach:1234/anindex/atype/1](http://myelasticseach:1234/anindex/atype/1)' -d '  
{  
atype:  
{  
foo : "bar"  
},  
obj2 :  
{  
baz : "qux"  
}  
}'

1. Search for 'bar'. I expect and get 1 result

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=bar](http://myelasticseach:1234/anindex/_search?q=bar)'

1. Sarch for 'qux'. I expect 1 result, but get 0???

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=qux](http://myelasticseach:1234/anindex/_search?q=qux)'

Why when the nested object in the document has a key matching the type of the document can I no longer get results from the rest of the objects, with keys that do not match the type?

## -- 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com). To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/e122daa5-66dd-4875-b33d-8e6029668424%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e122daa5-66dd-4875-b33d-8e6029668424%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6e7b31fa-78d8-45f2-9bb6-01b5d1cff426%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6e7b31fa-78d8-45f2-9bb6-01b5d1cff426%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/etPan.52984cdd.59adea3d.3e14%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.52984cdd.59adea3d.3e14%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Umit\_Seren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/umit_seren/32/44933_2.png) [@Umit\_Seren](https://discuss.elastic.co/u/Umit_Seren)\
**Post date:** [November 29, 2013, 10:16am UTC](https://discuss.elastic.co/t/elastic-search-counterintuitive-behaviour/14627/5 "2013-11-29T10:16:33Z")

</div>

@David:

Is the issue you linked the same reason why my has\_parent filter doesn't  
work?  
[https://groups.google.com/d/msg/elasticsearch/8yTX17uoFiU/xGjYd4tfEzAJ](https://groups.google.com/d/msg/elasticsearch/8yTX17uoFiU/xGjYd4tfEzAJ)[https://groups.google.com/forum/#!searchin/elasticsearch/Ümit/elasticsearch/8yTX17uoFiU/xGjYd4tfEzAJ](https://groups.google.com/forum/#!searchin/elasticsearch/%C3%9Cmit/elasticsearch/8yTX17uoFiU/xGjYd4tfEzAJ)  
?

On Friday, November 29, 2013 9:14:21 AM UTC+1, David Pilato wrote:

> You're right. My gist was incorrect.
> 
> Actually, you are hitting this issue:  
> [Wrong mapping using a nested object with same name as its type · Issue #3005 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/3005)
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> 
> Le 29 novembre 2013 at 00:37:58, Daniel Fisher ([danie...@gmail.com](mailto:danie...@gmail.com)\<javascript:\>)  
> a écrit:
> 
> Hi David
> 
> Using your Gist I get the expected behaviour however you didn't copy my  
> example correctly.
> 
> You specified the index as "type" in the URL i.e.
> 
> curl -XPUT "  
> [https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/](https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/)  
> _type_/1?refresh"
> 
> If you specify the index as "atype" you will see the behaviour I'm  
> describing
> 
> i.e. curl -XPUT "  
> [https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/](https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/)  
> _atype_/1?refresh"
> 
> Thanks,  
> Dan
> 
> On Thursday, November 28, 2013 9:24:25 PM UTC, David Pilato wrote:
> 
> > Hey Daniel,
> > 
> > I tried to reproduce your case but everything is working fine for me:  
> > [Test for case in ML: https://groups.google.com/d/msgid/elasticsearch/e122daa5-66dd-4875-b33d-8e6029668424%40googlegroups.com · GitHub](https://gist.github.com/dadoonet/7698308)
> > 
> > May be you have something else (specific mapping or settings ???)
> > 
> > ```
> > -- 
> > 
> > ```
> > 
> > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > 
> > Le 28 novembre 2013 at 13:29:37, Daniel Fisher ([danie...@gmail.com](mailto:danie...@gmail.com)) a  
> > écrit:
> > 
> > I have Elasticsearch demonstrating counterintuitive behaviour. This is  
> > reproducible with the following steps
> > 
> > 1. Add a document
> > 
> > curl -XPUT '[http://myelasticseach:1234/anindex/atype/1](http://myelasticseach:1234/anindex/atype/1)' -d '  
> > {  
> > obj1:  
> > {  
> > foo : "bar"  
> > },  
> > obj2 :  
> > {  
> > baz : "qux"  
> > }  
> > }'
> > 
> > 1. Search for 'bar'. I expect and get 1 result
> > 
> > curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=bar](http://myelasticseach:1234/anindex/_search?q=bar)'
> > 
> > 1. Search for 'qux'. I expect and get 1 result
> > 
> > curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=qux](http://myelasticseach:1234/anindex/_search?q=qux)'
> > 
> > 1. Update document
> > 
> > curl -XPUT '[http://myelasticseach:1234/anindex/atype/1](http://myelasticseach:1234/anindex/atype/1)' -d '  
> > {  
> > atype:  
> > {  
> > foo : "bar"  
> > },  
> > obj2 :  
> > {  
> > baz : "qux"  
> > }  
> > }'
> > 
> > 1. Search for 'bar'. I expect and get 1 result
> > 
> > curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=bar](http://myelasticseach:1234/anindex/_search?q=bar)'
> > 
> > 1. Sarch for 'qux'. I expect 1 result, but get 0???
> > 
> > curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=qux](http://myelasticseach:1234/anindex/_search?q=qux)'
> > 
> > ## Why when the nested object in the document has a key matching the type of the document can I no longer get results from the rest of the objects, with keys that do not match the type?
> > 
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/e122daa5-66dd-4875-b33d-8e6029668424%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e122daa5-66dd-4875-b33d-8e6029668424%40googlegroups.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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/6e7b31fa-78d8-45f2-9bb6-01b5d1cff426%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6e7b31fa-78d8-45f2-9bb6-01b5d1cff426%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/aba091ab-363c-43b9-bd40-7bed17108926%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/aba091ab-363c-43b9-bd40-7bed17108926%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:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 29, 2013, 10:18am UTC](https://discuss.elastic.co/t/elastic-search-counterintuitive-behaviour/14627/6 "2013-11-29T10:18:06Z")

</div>

I think so.

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 29 novembre 2013 at 11:16:37, Ümit Seren ([uemit.seren@gmail.com](mailto:uemit.seren@gmail.com)) a écrit:

@David:

Is the issue you linked the same reason why my has\_parent filter doesn't work?  
[https://groups.google.com/d/msg/elasticsearch/8yTX17uoFiU/xGjYd4tfEzAJ](https://groups.google.com/d/msg/elasticsearch/8yTX17uoFiU/xGjYd4tfEzAJ) ?

On Friday, November 29, 2013 9:14:21 AM UTC+1, David Pilato wrote:  
You're right. My gist was incorrect.

Actually, you are hitting this issue: [https://github.com/elasticsearch/elasticsearch/issues/3005](https://github.com/elasticsearch/elasticsearch/issues/3005)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 29 novembre 2013 at 00:37:58, Daniel Fisher ([danie...@gmail.com](mailto:danie...@gmail.com)) a écrit:

Hi David

Using your Gist I get the expected behaviour however you didn't copy my example correctly.

You specified the index as "type" in the URL i.e.

curl -XPUT "[https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/type/1?refresh](https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/type/1?refresh)"

If you specify the index as "atype" you will see the behaviour I'm describing

i.e. curl -XPUT "[https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/atype/1?refresh](https://d757c70453ac1ef3dd5c48b1317e17a4-eu-west-1.foundcluster.com:9243/anindex/atype/1?refresh)"

Thanks,  
Dan

On Thursday, November 28, 2013 9:24:25 PM UTC, David Pilato wrote:  
Hey Daniel,

I tried to reproduce your case but everything is working fine for me: [https://gist.github.com/dadoonet/7698308](https://gist.github.com/dadoonet/7698308)

May be you have something else (specific mapping or settings ???)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 28 novembre 2013 at 13:29:37, Daniel Fisher ([danie...@gmail.com](mailto:danie...@gmail.com)) a écrit:

I have Elasticsearch demonstrating counterintuitive behaviour. This is reproducible with the following steps

1. Add a document

curl -XPUT '[http://myelasticseach:1234/anindex/atype/1](http://myelasticseach:1234/anindex/atype/1)' -d '  
{  
obj1:  
{  
foo : "bar"  
},  
obj2 :  
{  
baz : "qux"  
}  
}'

1. Search for 'bar'. I expect and get 1 result

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=bar](http://myelasticseach:1234/anindex/_search?q=bar)'

1. Search for 'qux'. I expect and get 1 result

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=qux](http://myelasticseach:1234/anindex/_search?q=qux)'

1. Update document

curl -XPUT '[http://myelasticseach:1234/anindex/atype/1](http://myelasticseach:1234/anindex/atype/1)' -d '  
{  
atype:  
{  
foo : "bar"  
},  
obj2 :  
{  
baz : "qux"  
}  
}'

1. Search for 'bar'. I expect and get 1 result

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=bar](http://myelasticseach:1234/anindex/_search?q=bar)'

1. Sarch for 'qux'. I expect 1 result, but get 0???

curl -XGET '[http://myelasticseach:1234/anindex/\_search?q=qux](http://myelasticseach:1234/anindex/_search?q=qux)'

Why when the nested object in the document has a key matching the type of the document can I no longer get results from the rest of the objects, with keys that do not match the type?

## -- 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com). To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/e122daa5-66dd-4875-b33d-8e6029668424%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e122daa5-66dd-4875-b33d-8e6029668424%40googlegroups.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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com). To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6e7b31fa-78d8-45f2-9bb6-01b5d1cff426%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6e7b31fa-78d8-45f2-9bb6-01b5d1cff426%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/aba091ab-363c-43b9-bd40-7bed17108926%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/aba091ab-363c-43b9-bd40-7bed17108926%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/etPan.529869de.3d1b58ba.a94c%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.529869de.3d1b58ba.a94c%40MacBook-Air-de-David.local).  
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:04am UTC](https://discuss.elastic.co/t/elastic-search-counterintuitive-behaviour/14627/7 "2017-07-06T02:04:12Z")

</div>


