@@ -13,6 +13,10 @@ namespace Tests.Aggregations.Bucket.DateHistogram
1313 * From a functionality perspective, this histogram supports the same features as the normal histogram.
1414 * The main difference is that the interval can be specified by date/time expressions.
1515 *
16+ * When specifying a format and extended_bounds, in order for Elasticsearch to be able to parse
17+ * the serialized DateTimes extended_bounds correctly, the date_optional_time format should
18+ * also be specified as an additional format.
19+ *
1620 * Be sure to read the elasticsearch documentation {ref}/search-aggregations-bucket-datehistogram-aggregation.html[on this subject here]
1721 */
1822 public class DateHistogramAggregationUsageTests : AggregationUsageTestBase
@@ -31,6 +35,7 @@ public DateHistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage
3135 field = "startedOn" ,
3236 interval = "month" ,
3337 min_doc_count = 2 ,
38+ format = "yyyy-MM-dd'T'HH:mm:ss||date_optional_time" ,
3439 order = new { _count = "asc" } ,
3540 extended_bounds = new
3641 {
@@ -67,6 +72,7 @@ public DateHistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage
6772 . Field ( p => p . StartedOn )
6873 . Interval ( DateInterval . Month )
6974 . MinimumDocumentCount ( 2 )
75+ . Format ( "yyyy-MM-dd'T'HH:mm:ss||date_optional_time" )
7076 . ExtendedBounds ( FixedDate . AddYears ( - 1 ) , FixedDate . AddYears ( 1 ) )
7177 . Order ( HistogramOrder . CountAscending )
7278 . Missing ( FixedDate )
@@ -90,6 +96,7 @@ public DateHistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage
9096 Field = Field < Project > ( p => p . StartedOn ) ,
9197 Interval = DateInterval . Month ,
9298 MinimumDocumentCount = 2 ,
99+ Format = "yyyy-MM-dd'T'HH:mm:ss||date_optional_time" ,
93100 ExtendedBounds = new ExtendedBounds < DateTime >
94101 {
95102 Minimum = FixedDate . AddYears ( - 1 ) ,
0 commit comments