Skip to content

date_histogram aggregation fails for date_nanos and noon utc timezone #39107

@flash1293

Description

@flash1293

When trying to apply a date_histogram aggregation with a timezone which isn't utc (tested with Europe/Berlin) on a date_nanos field, elasticsearch responds with a unsupported_operation_exception.

Tested version: 7.0 snapshot

Steps to reproduce:

  1. Create an index like described in the docs: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/date_nanos.html
  2. Execute the following query:
GET my_index/_search
{
  "version": true,
  "size": 500,
  "sort": [{ "date": { "order": "desc", "unmapped_type": "boolean" } }],
  "_source": { "excludes": [] },
  "aggs": {
    "2": {
      "date_histogram": {
        "field": "date",
        "interval": "30s",
        "time_zone": "Europe/Berlin",
        "min_doc_count": 1
      }
    }
  },
  "docvalue_fields": [{ "field": "date", "format": "date_time" }],
  "query": {
    "bool": {
      "must": [
        {
          "range": {
            "date": { "gte": 1050572204889, "lte": 1550573104889, "format": "epoch_millis" }
          }
        }
      ]
    }
  },
  "timeout": "30000ms"
}

expected response: status code 200 and hits in the payload
actual response:

{
  "error": {
    "root_cause": [
      {
        "type": "unsupported_operation_exception",
        "reason": null
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "my_index",
        "node": "mTfaCthlT8uvuCLbfUtPCQ",
        "reason": {
          "type": "unsupported_operation_exception",
          "reason": null
        }
      }
    ],
    "caused_by": {
      "type": "unsupported_operation_exception",
      "reason": null,
      "caused_by": {
        "type": "unsupported_operation_exception",
        "reason": null
      }
    }
  },
  "status": 500
}

The same query with "time_zone": "UTC", works correctly.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions