# Scripted Field params.\_interval

**URL:** https://discuss.elastic.co/t/scripted-field-params-interval/268113
**Category:** Kibana
**Created:** [March 23, 2021, 3:34pm UTC](https://discuss.elastic.co/t/scripted-field-params-interval/268113 "2021-03-23T15:34:51Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![lamp123432](https://avatars.discourse-cdn.com/v4/letter/l/7993a0/32.png) [@lamp123432](https://discuss.elastic.co/u/lamp123432)
#### Post date: [March 23, 2021, 3:34pm UTC](https://discuss.elastic.co/t/scripted-field-params-interval/268113/1 "2021-03-23T15:34:51Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Vadims\_Daleckis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vadims_daleckis/32/57613_2.png) [@Vadims\_Daleckis](https://discuss.elastic.co/u/Vadims_Daleckis)
#### Post date: [March 23, 2021, 3:56pm UTC](https://discuss.elastic.co/t/scripted-field-params-interval/268113/2 "2021-03-23T15:56:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Vadims\_Daleckis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vadims_daleckis/32/57613_2.png) [@Vadims\_Daleckis](https://discuss.elastic.co/u/Vadims_Daleckis)
#### Post date: [March 23, 2021, 4:10pm UTC](https://discuss.elastic.co/t/scripted-field-params-interval/268113/3 "2021-03-23T16:10:07Z")

</div>

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

---

<div class="post-metadata">

### Author: ![lamp123432](https://avatars.discourse-cdn.com/v4/letter/l/7993a0/32.png) [@lamp123432](https://discuss.elastic.co/u/lamp123432)
#### Post date: [March 23, 2021, 6:35pm UTC](https://discuss.elastic.co/t/scripted-field-params-interval/268113/4 "2021-03-23T18:35:30Z")

</div>

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?

---

<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: [April 20, 2021, 6:35pm UTC](https://discuss.elastic.co/t/scripted-field-params-interval/268113/5 "2021-04-20T18:35:37Z")

</div>

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