@@ -13,6 +13,10 @@ namespace Tests.Aggregations.Bucket.DateHistogram
13
13
* From a functionality perspective, this histogram supports the same features as the normal histogram.
14
14
* The main difference is that the interval can be specified by date/time expressions.
15
15
*
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
+ *
16
20
* Be sure to read the elasticsearch documentation {ref}/search-aggregations-bucket-datehistogram-aggregation.html[on this subject here]
17
21
*/
18
22
public class DateHistogramAggregationUsageTests : AggregationUsageTestBase
@@ -31,6 +35,7 @@ public DateHistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage
31
35
field = "startedOn" ,
32
36
interval = "month" ,
33
37
min_doc_count = 2 ,
38
+ format = "yyyy-MM-dd'T'HH:mm:ss||date_optional_time" ,
34
39
order = new { _count = "asc" } ,
35
40
extended_bounds = new
36
41
{
@@ -67,6 +72,7 @@ public DateHistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage
67
72
. Field ( p => p . StartedOn )
68
73
. Interval ( DateInterval . Month )
69
74
. MinimumDocumentCount ( 2 )
75
+ . Format ( "yyyy-MM-dd'T'HH:mm:ss||date_optional_time" )
70
76
. ExtendedBounds ( FixedDate . AddYears ( - 1 ) , FixedDate . AddYears ( 1 ) )
71
77
. Order ( HistogramOrder . CountAscending )
72
78
. Missing ( FixedDate )
@@ -90,6 +96,7 @@ public DateHistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage
90
96
Field = Field < Project > ( p => p . StartedOn ) ,
91
97
Interval = DateInterval . Month ,
92
98
MinimumDocumentCount = 2 ,
99
+ Format = "yyyy-MM-dd'T'HH:mm:ss||date_optional_time" ,
93
100
ExtendedBounds = new ExtendedBounds < DateTime >
94
101
{
95
102
Minimum = FixedDate . AddYears ( - 1 ) ,
0 commit comments