in ES-5.0.0-alpha3, top-level inner hits have been removed
Suppose I have an index with a parent type and a child type and i'd wish to search parents, returning parent documents along with their children.
I wonder what is now the best way to fetch the children of the top hits when the query has no has_child, e.g. a match-all query?
- wrap the top-level query inside a boolean query as a filter|must clause
and add a should-clause containing a dummy has_child query to fetch the inner hits
2) execute the query normally, without any innerhits, then grab the id's of the top hits and execute a
subsequent query to fetch the children
i am worried that 1) will not perform optimally due to the dummy boolean should-clause that may retrieve all children, not just the children of the top parent hits?
approach 2) on the other hand needs an extra round-trip but should otherwise be cheap.