# Can I perform derivative aggregation without date\_histogram?

**URL:** <https://discuss.elastic.co/t/can-i-perform-derivative-aggregation-without-date-histogram/127480>\
**Category:** Elasticsearch\
**Created:** [April 10, 2018, 12:28pm UTC](https://discuss.elastic.co/t/can-i-perform-derivative-aggregation-without-date-histogram/127480 "2018-04-10T12:28:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinayakfutak](https://avatars.discourse-cdn.com/v4/letter/v/bb73d2/32.png) [@vinayakfutak](https://discuss.elastic.co/u/vinayakfutak)\
**Post date:** [April 10, 2018, 12:28pm UTC](https://discuss.elastic.co/t/can-i-perform-derivative-aggregation-without-date-histogram/127480/1 "2018-04-10T12:28:09Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 8, 2018, 12:28pm UTC](https://discuss.elastic.co/t/can-i-perform-derivative-aggregation-without-date-histogram/127480/2 "2018-05-08T12:28:10Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
