I have an index of products, with price on every date of year as a nested doc.
{ name: "nexus7",
prices: [
{date: "2014-09-01", price: 100},
{date: "2014-09-02", price: 200},
...
]}
I want to get the lowest price of each product. I tried nested aggregation
{
"aggs": {
"prices": {
"aggs": {
"min_price": {
"min": {
"field": "prices.price"
}
}
},
"nested": {
"path": "prices"
}
}
}
}
}
But this return the minimum price among all products, which is not exactly what I need.
Is this possible to do?