How to get grand parent details also in the response when querying for grandchild documents

I have a mapping structure of

parent -> child -> grandchild.
Company -> brand -> product
search filters applied at company and brand level. Sorting applied at product level. How to get company details also as inner hits.

Sample:

POST my_index/search
{
"query": {
"bool":{
"must:[
{
"has_parent": "brand",
"query":{
"has_parent":"company",
"query":{
"match_all":{}
}, "inner_hits":{}

     }

   }

]
}
}
"sort": "product.id"
}
How to get those details at company level as well by getting product level as a base ?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.