How to use Derivative Aggs result to calculate percentage change?

Hi All,

I have the below query. How can I use the result/value of derivative aggs to calculate percentage change in each time interval? Basically I would love to divide the value of derivative aggs in each interval with the value in old interval? Any suggestions ?

GET indexname/_search
    {
      "query": {
        "range": {
          "timestamp": {
            "gte": "now-1h/h"
          }
        }
      },
      "size": 0,
      "aggs": {
        "get_cmtsId": {
          "terms": {
            "field": "cmtsId",
            "size": 5
          },
        "aggs": {
          "every30min": {
            "date_histogram": {
              "field": "timestamp",
              "fixed_interval": "30m"
              },
              "aggs": {
              "count_deriv": {
                "derivative": {
                  "buckets_path": "_count"
                }
                }
              } 
            }
          }
        }
      }
    }

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