KIBANA DSL Date filtering using timepicker picked date range


(rohit) #1

Is it possible to use Kibana selected date range in dsl query,
eg: If you look at following query I need the "kibana selected lower timestamp"
field to take kibana timepicker selected time range.

{
  "query": {
    "bool": {
      "must": [
        {
          "range": {
            "endTime": {
              "gte": "<kibana selected lower timestamp>"
            }
          }
        },
        {
          "range": {
            "endTime": {
              "lte": "<kibana selected upper timestamp>"
            }
          }
        },
        {
          "range": {
            "startTime": {
              "lte": "<kibana selected upper timestamp>"
            }
          }
        }
      ]
    }
  }
}

(Shaunak Kashyap) #2

Where are you trying to run this query from?

I ask because Kibana will automatically insert the timepicker ranges into each search query it makes to Elasticsearch to retrieve data from the selected index pattern for visualizing it. Specifically, Kibana will add the following must clause to each search query:

{
  "range": {
    "@timestamp": {
      "gte": <kibana selected lower timestamp>,
      "lte": <kibana selected upper timestamp>,
      "format": "epoch_millis"
    }
  }
}

(rohit) #3

I am using regular kibana search bar to search with elastic search queries. please check my query it shows why I need this timestamp separately.


(system) #4