Hey Chris! Thanks for your reply.
I feel like one of us us backwards. The 1.7 docs say:
The nested filter also supports a join option which controls whether to perform the block join or not. By default, it’s enabled. But when it’s disabled, it emits the hidden nested documents as hits instead of the joined root document.
Which is the opposite of your example.
My understanding is that in 1.7, setting "join":true
returns the top-level parent doc, whereas "join":false
returns the inner/nested document.
Are you saying that "nested"
queries, in 2.3, now always return the top-level parent doc?
If yes, and the answer is really to just not use "nested"
(and use include_in_parent
instead), then the semantics of searching nested objects, especially with complex bool queries, must be broken in 2.3?
For example, these are two very different queries:
{
"nested" : {
"query" : {
"bool" : {
"must" : [ {
"term" : {
"review_data.review_data_id" : 67115
}
}, {
"terms" : {
"review_data.responsiveness" : [ "responsive", "potentially responsive", "not responsive", "unreviewable" ]
}
} ]
}
},
"path" : "review_data"
}
}
and
{
"bool" : {
"must" : [ {
"term" : {
"review_data.review_data_id" : 67115
}
}, {
"terms" : {
"review_data.responsiveness" : [ "responsive", "potentially responsive", "not responsive", "unreviewable" ]
}
} ]
}
}
Assume that review_data
is an array of objects...
The former finds all docs where at least a single review_data
element has a data_id:67115
and that same element also has one of those responsiveness values.
The latter, you'd think does the same thing, but it doesn't take into consideration that review_data is an array of elements. So it could match a doc where review_data[0].data_id:67115
but review_data[7].responsiveness="responsive"
.
These are very different things.
As such, without the ability to set "join":false
, the aggregate would be collecting the wrong set of values.
Am I being dense?
Thanks for your time!
eric