# Getting time range from Kibana into painless scripted field

**URL:** <https://discuss.elastic.co/t/getting-time-range-from-kibana-into-painless-scripted-field/232954>\
**Category:** Kibana\
**Created:** [May 16, 2020, 9:39pm UTC](https://discuss.elastic.co/t/getting-time-range-from-kibana-into-painless-scripted-field/232954 "2020-05-16T21:39:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![angryninja](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@angryninja](https://discuss.elastic.co/u/angryninja)\
**Post date:** [May 16, 2020, 9:39pm UTC](https://discuss.elastic.co/t/getting-time-range-from-kibana-into-painless-scripted-field/232954/1 "2020-05-16T21:39:30Z")

</div>

Hi,

I'm trying to visualize application uptime data which is **not regular** but is only pushed to elasticsearch when an incident occurs. For the visualization I need the total number of days/hours user selected on the Kibana so that I can calculate and visualize total downtime in percentage for the selected duration.

Is there any way to get hold of the time range / date range selected by user from Kibana's 'Time Filter' component in a scripted field on Kibana ?

---

<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:** [June 13, 2020, 9:45pm UTC](https://discuss.elastic.co/t/getting-time-range-from-kibana-into-painless-scripted-field/232954/2 "2020-06-13T21:45:45Z")

</div>

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