I'd like to search all parent documents that have child documents in
index, but also would like to retrieve aggregated data about child
documents for found parents.
For example: every child document has price defined as a field and I'd
like to query parent documents that have any children and in search
results I'd like to receive also minimum price value for every parent
(aggregated from this parent's children).
- statistical facet with child scope, but it returns global minimum
price (not in context of parent)
- terms facet with script that was concatenating parent id with price
and from results of this facet I was able to aggregate minimum prices
for each parent
- histogram script facet but keys can only be numbers (not parent ids)
and count can only be total/mean of values and not minimum
What is the best way to achieve desired functionality?