How to Access Kibana time range (timepicker) in a painless script

When making a search for documents that have a time stamp the user can specify a time range over which the search will be done. It looks like this in the search request:

        {
          "range": {
            "date": {
              "format": "strict_date_optional_time",
              "gte": "2023-02-01T05:00:00.000Z",
              "lte": "2023-03-02T15:11:30.784Z"
            }
          }
        }

I have a painless script in this search that does some computations on a time field. To do some further analysis I need to know the time range of the search.

How could I get these same range values so I could use them in my painless script?

I am stuck with version 7.1.1.

I have just found out this is called 'timepicker' and this issue was brought up some years ago

and at the time it was not possible. An enhancement request was made. Did it happen and if so where are the docs?

Migrated to 7.10.2 and I still find no means of accessing the timepicker values.

Hi @gyannea. It looks like an enhancement request was made a while back, but it was closed due to inactivity. I suggest adding a comment detailing your needs and re-opening the issue.

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