I want to perform derivative aggregation on following query
{
"size": 0,
"aggs": {
"sales_per_month": {
"date_histogram": {
"field": "device_time",
"format": "dd-MM-yyyy",
"interval": "day"
},
"aggs": {
"a1": {
"terms": {
"field": "device_time",
"size": 500,
"order": {
"the_sum": "asc"
}
},
"aggs": {
"the_sum": {
"sum": {
"field": "device_time"
}
}
}
}
}
}
}
}
but when I am trying to perform its giving error as a derivative aggregation [derivative] must have a histogram or date_histogram as parent??
How can i perform derivative aggregation on this query( on the_sum bucket)