# Timepicker parameters as input to painless scripts

**URL:** <https://discuss.elastic.co/t/timepicker-parameters-as-input-to-painless-scripts/314900>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [September 21, 2022, 8:46pm UTC](https://discuss.elastic.co/t/timepicker-parameters-as-input-to-painless-scripts/314900 "2022-09-21T20:46:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![antoniolopescorreia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/antoniolopescorreia/32/111099_2.png) [@antoniolopescorreia](https://discuss.elastic.co/u/antoniolopescorreia)\
**Post date:** [September 21, 2022, 8:46pm UTC](https://discuss.elastic.co/t/timepicker-parameters-as-input-to-painless-scripts/314900/1 "2022-09-21T20:46:33Z")

</div>

Is it currently possible to pass the timepicker values as input parameters to runtime painless scripts? The question occurs because I would like to dynamically calculate some time interval value sums, which are calculated differently in some months of the year, and lower / upper bound them according with the timepicker values.

---

<div class="post-metadata">

**Author:** ![stu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stu/32/75063_2.png) [@stu](https://discuss.elastic.co/u/stu)\
**Post date:** [September 22, 2022, 3:15pm UTC](https://discuss.elastic.co/t/timepicker-parameters-as-input-to-painless-scripts/314900/2 "2022-09-22T15:15:32Z")

</div>

You can pass params to runtime fields.

params are passed as json so any param would have to be one of the json types (string, map, boolean, etc).

What do you mean by timepicker values? Can you sketch what you're trying to do?

---

<div class="post-metadata">

**Author:** ![antoniolopescorreia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/antoniolopescorreia/32/111099_2.png) [@antoniolopescorreia](https://discuss.elastic.co/u/antoniolopescorreia)\
**Post date:** [September 23, 2022, 9:30am UTC](https://discuss.elastic.co/t/timepicker-parameters-as-input-to-painless-scripts/314900/3 "2022-09-23T09:30:14Z")

</div>

Hi. Thx for the response in such a short notice.  
I mean the time filters, use the start /end values of a selected time range as input params to a scripted field.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/3/53c3bc68289caa3a7f4a9d9b080f8ea3a372ba59.png)

---

<div class="post-metadata">

**Author:** ![stu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stu/32/75063_2.png) [@stu](https://discuss.elastic.co/u/stu)\
**Post date:** [September 23, 2022, 6:01pm UTC](https://discuss.elastic.co/t/timepicker-parameters-as-input-to-painless-scripts/314900/4 "2022-09-23T18:01:21Z")

</div>

Ahh interesting case. Unfortunately, that's not available.

Runtime fields do not have access to the surrounding query and so those values are not available to the field.

They would have to be manually passed in via params, which is not available in kibana discover.

---

<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:** [October 21, 2022, 6:01pm UTC](https://discuss.elastic.co/t/timepicker-parameters-as-input-to-painless-scripts/314900/5 "2022-10-21T18:01:26Z")

</div>

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