Skip to content

Elasticsearch 6.1.1 - Not possible to specify 'format' in Date Histogram aggregation when used in Composite Aggregation #27923

@byronvoorbach

Description

@byronvoorbach

Hi all!

On Elasticsearch 6.1.1 I'm getting a:

{
  "error": {
    "root_cause": [
      {
        "type": "parsing_exception",
        "reason": "[composite] failed to parse field [sources]",
        "line": 26,
        "col": 17
      }
    ],
    "type": "parsing_exception",
    "reason": "[composite] failed to parse field [sources]",
    "line": 26,
    "col": 17,
    "caused_by": {
      "type": "illegal_argument_exception",
      "reason": "[date_histogram] unknown field [format], parser not found"
    }
  },
  "status": 400
}

When trying to choose a format for my date_histogram aggregation, which is placed in a composite aggregation:

GET tickers/_search
{
  "size": 0,
  "aggs": {
    "compos": {
      "composite": {
        "size": 50,
        "sources": [
          {
            "currencyPair": {
              "terms": {
                "field": "currencyPair.raw"
              }
            }
          },
          {
            "exchanges": {
              "terms": {
                "field": "exchange.raw"
              }
            }
          },
          {
            "time" : {
              "date_histogram" : {
                "field": "date",
                "format" : "yyyy-MM-dd--HH:mm:ss.SSSZ",
                "interval": "5m"
              }
            }
          }
        ]
      }
    }
  }
}

Is this a possible bug? Or is it not possible to have a 'key_as_string' when using composite?
Here is the complete code to reproduce:

https://gist.github.com/byronvoorbach/434f84a8cf89f6aab9cb2d9e291a9047

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions