Hi,
I've an offer data model containing a productId, a price and a rating.
I want to:
- Only retain the cheapest offer for each
productId - Compute the average rating for remaining offers
Here is what I've done below.
"aggs": {
"reference_ids": {
"terms": {
"field": "catalogProductId",
"size": 1000
},
"aggs": {
"min_price": {
"top_hits": {
"sort": [
{
"price": {
"order": "asc"
}
}
],
"size": 1
}
}
}
}
}
Is it possible to make another aggregation (avg on rating) after the top_hits one?
Thanks,
Fidel