Is it possible to return both parent data and child with an Elasticsearch query?
Example :
PUT my_index/posts/_search { { "query": { "has_child": {"type": "comments"}}}}
It will return only posts data. How can I get the comments data too?
Is it possible to return both parent data and child with an Elasticsearch query?
Example :
PUT my_index/posts/_search { { "query": { "has_child": {"type": "comments"}}}}
It will return only posts data. How can I get the comments data too?
You can use inner hits for this:
{
"query" : {
"has_child" : {
"type" "comments",
"inner_hits" : {}
}
}
This will include per post hit the top 3 matching comment hits.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
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.