Hi,
I've got a parent child model (see Reindexing Elasticsearch index with parent and child relationship) and I want to run a query that returns a list of all (or filtered) documents. In that list I want to have inner_hits when the document has children but it should also include documents that do not have children!
I currently have:
{
"query": {
"bool": {
"must":[ {
"match_all": {}
},{
"has_child": {
"type": "child_message",
"query": {
"match_all": {}
},
"inner_hits": {}
}
}]
}
}
}
But this only returns documents that do have children, not documents that don't have children. What do I need to do to get all document that match the original search whether they have children or not but if they have children they should be included in inner_hits