Elastic search counterintuitive behaviour

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' -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'

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

curl -XGET 'http://myelasticseach:1234/anindex/_search?q=qux'

  1. Update document

curl -XPUT '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'

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

curl -XGET '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.
To view this discussion on the web visit 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.

Hey Daniel,

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

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

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 28 novembre 2013 at 13:29:37, Daniel Fisher (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' -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'

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

curl -XGET 'http://myelasticseach:1234/anindex/_search?q=qux'

  1. Update document

curl -XPUT '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'

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

curl -XGET '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.
To view this discussion on the web visit 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.

--
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.
To view this discussion on the web visit 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.

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"

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"

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

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

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr

Le 28 novembre 2013 at 13:29:37, Daniel Fisher (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' -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'

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

curl -XGET 'http://myelasticseach:1234/anindex/_search?q=qux'

  1. Update document

curl -XPUT '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'

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

curl -XGET '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 <javascript:>.
To view this discussion on the web visit
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.

--
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.
To view this discussion on the web visit 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.

You're right. My gist was incorrect.

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

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 29 novembre 2013 at 00:37:58, Daniel Fisher (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"

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"

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

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

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 28 novembre 2013 at 13:29:37, Daniel Fisher (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' -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'

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

curl -XGET 'http://myelasticseach:1234/anindex/_search?q=qux'

  1. Update document

curl -XPUT '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'

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

curl -XGET '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.
To view this discussion on the web visit 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.

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.
To view this discussion on the web visit 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.

--
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.
To view this discussion on the web visit 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.

@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/xGjYd4tfEzAJhttps://groups.google.com/forum/#!searchin/elasticsearch/Ümit/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

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr

Le 29 novembre 2013 at 00:37:58, Daniel Fisher (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/
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"

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

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

  -- 

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr

Le 28 novembre 2013 at 13:29:37, Daniel Fisher (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' -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'

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

curl -XGET 'http://myelasticseach:1234/anindex/_search?q=qux'

  1. Update document

curl -XPUT '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'

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

curl -XGET '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.
To view this discussion on the web visit
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.

--
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 <javascript:>.
To view this discussion on the web visit
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.

--
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.
To view this discussion on the web visit 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.

I think so.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 29 novembre 2013 at 11:16:37, Ümit Seren (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 ?

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

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 29 novembre 2013 at 00:37:58, Daniel Fisher (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"

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"

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

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

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 28 novembre 2013 at 13:29:37, Daniel Fisher (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' -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'

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

curl -XGET 'http://myelasticseach:1234/anindex/_search?q=qux'

  1. Update document

curl -XPUT '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'

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

curl -XGET '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.
To view this discussion on the web visit 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.

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.
To view this discussion on the web visit 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.

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.
To view this discussion on the web visit 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.

--
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.
To view this discussion on the web visit 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.