TSVB Table - Using Timepicker Duration as Interval

I have some TSVB data tables (Kibana 7.4.2) I'm trying to modify to use a dynamically selected interval (timepicker range) for, and I can't find how to properly call this interval in Painless.

I currently have network data in a data table:

I am calculating the averages using a static (or otherwise nondescript) interval: params._interval.


The issue with this is that it does not dynamically scale with the timepicker:

My code to calculate the averages uses a painless script which references that params._interval:

(params.bytes * 8) / (params._interval / 1000)

What can I do to make these calculations use the timepicker range, rather than the interval? I desire to change the 'Data timerange mode' to 'Entire time range', however that leaves me with no results, presumably due to the 'entire time range' not being a valid params._interval:

The derivative aggregation has a unit parameter which should make this exact calculation taking the current interval into account on Elasticsearch side.

You can use this by putting a cumulative sum in front of it (to get rid of the derivative calculation, leaving just the unit conversion part):

1 Like

Thanks @flash1293. That solved it. I still had to start with a bucket script to convert:
bits = bytes * 8
However the rest of it works as expected. Thanks again!

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