Last active
April 28, 2017 04:40
-
-
Save abulhol/0869e5c418b77f97e752 to your computer and use it in GitHub Desktop.
ES query with top level inner hits that works
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"query" : { | |
"bool" : { | |
"must" : [{ | |
"nested" : { | |
"path" : "a.b.c.d.first", | |
"query" : { | |
"nested" : { | |
"path" : "a.b.c.d.first.e.f.second", | |
"query" : { | |
"bool" : { | |
"filter" : [{ | |
"term" : { | |
"a.b.c.d.first.e.f.second.message" : "Nobody expects the Spanish inquisition!" | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
} | |
} | |
] | |
} | |
}, | |
"inner_hits" : { | |
"kids0" : { | |
"path" : { | |
"a.b.c.d.first" : { | |
"query" : { | |
"nested" : { | |
"path" : "a.b.c.d.first.e.f.second" : | |
"query" : { | |
"bool" : { | |
"filter" : [{ | |
"prefix" : { | |
"a.b.c.d.first.e.f.second.message" : "Nobody expects the Spanish inquisition!" | |
} | |
} | |
] | |
} | |
} | |
} | |
}, | |
"size" : 1, | |
"_source" : false, | |
"inner_hits" : { | |
"kids0" : { | |
"path" : { | |
"a.b.c.d.first.e.f.second" : { | |
"size" : 1, | |
"_source" : [ | |
"message", | |
"bla", | |
"blub" | |
], | |
"query" : { | |
"bool" : { | |
"filter" : [{ | |
"term" : { | |
"a.b.c.d.first.e.f.second.message" : "Nobody expects the Spanish inquisition!" | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment