How to retrieve the interval value in an Aggregation script

Hi,

I am trying to convert a sum of bytes value per bucket obtained from time series data into a bytes per second value for display in Kibana. A date histogram is being used to perform the aggregation.

This can be calculated for a fixed bucket interval of 60 seconds by a script like so:

{script: _value * 8 /60}

But Kibana adapts the bucket size (or interval) depending on the time range of the chart. So it would be nice if the Groovy script had access to some kind of context value it could navigate the context, find the interval value set by Kibana for the aggregation and then use this value in the calculation.

Is this possible?

Regards

Hi,

I'm also interested by a solution.

Regards,
Aurélien