# After provide time format I get; (elastic: Error 400 (Bad Request): all shards failed \[type=search\_phase\_execution\_exception\] ) error

**URL:** <https://discuss.elastic.co/t/after-provide-time-format-i-get-elastic-error-400-bad-request-all-shards-failed-type-search-phase-execution-exception-error/314243>\
**Category:** Elasticsearch\
**Created:** [September 13, 2022, 5:42am UTC](https://discuss.elastic.co/t/after-provide-time-format-i-get-elastic-error-400-bad-request-all-shards-failed-type-search-phase-execution-exception-error/314243 "2022-09-13T05:42:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![golofetuk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/golofetuk/32/114272_2.png) [@golofetuk](https://discuss.elastic.co/u/golofetuk)\
**Post date:** [September 13, 2022, 5:42am UTC](https://discuss.elastic.co/t/after-provide-time-format-i-get-elastic-error-400-bad-request-all-shards-failed-type-search-phase-execution-exception-error/314243/1 "2022-09-13T05:42:04Z")

</div>

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;`

```go
        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.

---

<div class="post-metadata">

**Author:** ![golofetuk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/golofetuk/32/114272_2.png) [@golofetuk](https://discuss.elastic.co/u/golofetuk)\
**Post date:** [September 13, 2022, 7:18am UTC](https://discuss.elastic.co/t/after-provide-time-format-i-get-elastic-error-400-bad-request-all-shards-failed-type-search-phase-execution-exception-error/314243/2 "2022-09-13T07:18:44Z")

</div>

dateTime.Format and time.Parse should be the same format.

```auto
        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-02T15:04:15"), "now/d").
		OrderByCountDesc()

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 11, 2022, 7:19am UTC](https://discuss.elastic.co/t/after-provide-time-format-i-get-elastic-error-400-bad-request-all-shards-failed-type-search-phase-execution-exception-error/314243/3 "2022-10-11T07:19:37Z")

</div>

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