Skip to content

Date histogram extended bounds date format and key_as_string field format. #9725

@michaelbudnik

Description

@michaelbudnik

Hello,

My question is why format provided to date histogram is trying to parse min and max extended bounds with the same format? I would like to format the output of the bucket (key_as_string) to show me name of the month ("MMM" format) but I want to provide min and max extended bounds as a simple datetime with format (""yyyy-MM-dd").

Taking the example below:

{
"aggs": {
    "dateHistogram": {
        "date_histogram": {
            "field": "transactions.registryApplication.applicationDate", 
            "interval": "month", 
            "format": "MMM", 
            "min_doc_count": 0, 
            "extended_bounds": {
                "min": "2011-01-01", 
                "max": "2011-12-31"
            }
        }, 
        "aggs": {
            "averagePrice": {
                "avg": {
                    "field": "transactions.sellingPrice"
                }
            }
        }
    }
}
}

I'm getting this error:

[failed to parse date field [2011-01-01], tried both date format [MMM], and timestamp number]

I mean that the format for input (bounds) and output (key_as_string field in response) should be separate, or expect the input date format to be of specific format.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions