1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
GET /some-index/_search { "size": 0, "aggs": { "my_buckets": { "composite": { "sources": [ { "date": { "date_histogram": { "field": "timestamp", "calendar_interval": "1d", "order": "desc" } } }, { "product": { "terms": { "field": "product" } } } ] }, "aggregations": { "the_avg": { "avg": { "field": "price" } } } } } }