I'm wondering if there is a way of getting some information about the
children (a list of ids would be ok) matching the has_child query along
with the parent object.
As a result I get parent documents that contains children which name starts
with 'AS'. So is there a way of getting the information about which
children matched the filter?
At the moment something like this is only possible by doing subsequent
request(s).
For each parent documents that you want to know the top matching child docs
for you can execute the following request:
curl -X POST 'localhost:9200/products/Child/_search?pretty=true' -d '
{
"query" : {
"match_all" : {}
},
"filter" : {
"bool" : {
"must" : [
{
"term" : {"_parent" : "THE_PARENT_ID"}
},
{
"prefix" : { "name" : "AS" }
}
]
}
}
}
'
In order to optimise the above approach you can combine the search requests
into one request use the multi search api:
I'm wondering if there is a way of getting some information about the
children (a list of ids would be ok) matching the has_child query along
with the parent object.
As a result I get parent documents that contains children which name
starts with 'AS'. So is there a way of getting the information about which
children matched the filter?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.