Setting timezone on date_histogram slow down the query

Hi there,

It seems that setting the timezone option to a date_histogram has a negative effect on the query performance. Suppose the following query:

{
  "size": 0,
  "aggs": {
    "2": {
      "date_histogram": {
        "field": "@timestamp",
        "calendar_interval": "1d",
        "time_zone": "Europe/Brussels"
      }
    }
  },
  "query": {
    "bool": {
      "must": [
        {
          "range": {
            "@timestamp": {
              "format": "strict_date_optional_time",
              "gte": "2019-05-01T00:00:00.000Z",
              "lte": "2019-05-10T00:00:00.000Z"
            }
          }
        }
      ]
    }
  }
}

This query is executed on an alias targeting 10 indexes, each with 3 shards and 1 replica - all hosted on 3 different nodes and containing a total of 480M documents.

With timezone set, execution time is 16821ms. Without timezone, the execution time goes down to 6920ms.

Is this expected?
Is there something I can do to optimize the setup and lower the execution time when timezone is set?

PS: this query is similar to what the Kibana Discover panel does when building the histogram...

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