Scripted Field params._interval

Here's my current code for a scripted field:

if (doc['ifHCInOctets'].size() != 0) { doc['ifHCInOctets'].value * 8 / 60 }

This part of my code: 8 / 60 } needs to be 8 / $interval } just like in TSVB with params._interval

Is this possible to access the current interval dynamically in Scripted Fields?

Hi @lamp123432 ,

Scripted fields execute on Elasticsearch nodes, I believe the scripts are sent as-is to Elasticsearch nodes without a way to modify them on the fly, but I will try to confirm this for you.

I've just checked with the engineer who works on Kibana scripted fields. The scripts are sent as-is, nothing is interpolated into them.

Is the params._interval exclusive to TSVB then? I was hoping for Painless Scripting to be able to get the value of it from anywhere - even in Scripted Fields. Is there no API I can fetch this value from Painless Script?

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