Question About Inner_Hits with Multiple Nested Objects

I have the query below which test fields defined in two separate nested paths and the query works as expected. However, I would like to return only the inner_hits that meet both criteria. Is that doable in ES? If so, how would I go about adding it? I tried tacking it onto the outer query but that does not work. Any help would be appreciated. Thanks.

Kevin

{
"size": 10,
"query" : {
"bool" : {
"must": [
{"nested": {"path": "segments",
"query": {
"bool": {
"must": [
{"exists": {"field": "segments.entities.disambiguationResults"}},
{"regexp": {"segments.entities.type": "PERSON"}}
]
}}}
}
],
"must_not": [
{"nested": {"path": "segments.entities.attributes",
"query": {
"bool": {
"must": [
{"exists": {"field": "segments.entities.attributes.firstName"}}
]
}
}
}
}
]
}
}
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.