ElasticSearch: How can I get all child objects of different types using parent/child inner hits -


i have problem "inner hits" feature. can 1 type of child objects, because i have specify type of child objects query.

for example, can parent objects , "childa" objects using following code

{   "query": {     "has_child": {       "type": "childa",       "query": {         "match_all": {}       },       "inner_hits": {}     }   } } 

is possible childa , childb objects simultaneously?

you can combine multiple has_child queries inner_hits using bool query. example, if wanted find parents had either "childa" or "childb" , return children have (whether childa or childb or both), this:

"query": {   "bool": {     "should": [       {         "has_child": {           "type": "childa",           "query": {             "match_all": {}           },           "inner_hits": {}         }       },       {         "has_child": {           "type": "childb",           "query": {             "match_all": {}           },           "inner_hits": {}         }       }     ]   } } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -