olivere / elastic

Deprecated: Use the official Elasticsearch client for Go at https://github.com/elastic/go-elasticsearch
https://olivere.github.io/elastic/
MIT License
7.39k stars 1.15k forks source link

After provide time format I get; (elastic: Error 400 (Bad Request): all shards failed [type=search_phase_execution_exception] ) error #1646

Closed orhan-cmd closed 2 years ago

orhan-cmd commented 2 years ago

Please use the following questions as a guideline to help me answer your issue/question without further inquiry. Thank you.

Which version of Elastic are you using?

[ v] elastic.v7 (for Elasticsearch 7.x)

Please describe the expected behavior

After running following code I get elastic error that : Error 400 (Bad Request): all shards failed [type=search_phase_execution_exception] error;

        dateTime, _ := time.Parse(time.RFC3339, "1553472000")
        f := "yyyy-MM-dd'T'HH:mm:ss"
    concurrentAgg := elastic.NewDateHistogramAggregation().
        Field("date").
        Format(f).
        MinDocCount(0).
        TimeZone("UTC").
        ExtendedBounds(dateTime.Format("2006-01-02 15:04:15"), "now/d").
        OrderByCountDesc()

When I set f as "yyyy-MM-dd HH:mm:ss" everything works as expected.

Please describe the actual behavior

result with no error.