Help with Nested query

Hey folks,

I am playing with Elasticsearch nested query and see some issue, can
someone please help me explain it.

ES version: 0.20.5 (same behavior in 0.19.5 as well)

The steps to reproduce are here

The question in short is, let say I am indexing a nested field as in

"nested_field" : [ { "name" : "blue", "count" : 4 }, { "name" : "green",
"count" : 6 } ]

when I _search using nested query as

curl -XGET http://localhost:9200/newindex/foo/_search?pretty=true -d

'{ "query" : {"nested" : { "path" : "nested_field", "query": {
"query_string": { "query": "name:blue AND count:4" }}}}}'

I am expecting to get back only matching child part for the nested field as
in { "name" : "blue", "count" : 4 }

But I get back both as in

"nested_field" : [ { "name" : "blue", "count" : 4 }, { "name" : "green",
"count" : 6 } ] (The part with "name": "green" should not show up in my
mind)

Best
Bhupesh

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Buphesh

I am expecting to get back only matching child part for the nested
field as in { "name" : "blue", "count" : 4 }

But I get back both as in

"nested_field" : [ { "name" : "blue", "count" : 4 }, { "name" :
"green", "count" : 6 } ] (The part with "name": "green" should not
show up in my mind)

When you run a query, you get back the documents that match, ie the
whole document, not just the parts of it that match.

Currently there is no way to return just the parts, although there is an
issue open to request support for it

clint

--
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.
For more options, visit https://groups.google.com/groups/opt_out.