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 -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -