@@ -32,6 +32,16 @@ setup:
3232 date :
3333 type : date
3434 format : " yyyy-MM-dd HH:mm:ss"
35+ - do :
36+ indices.create :
37+ index : test_timezone_date_nanos
38+ body :
39+ settings :
40+ number_of_replicas : 0
41+ mappings :
42+ properties :
43+ date :
44+ type : date_nanos
3545
3646 - do :
3747 bulk :
@@ -53,6 +63,19 @@ setup:
5363 - ' {"index": {}}'
5464 - ' { "date":["2021-05-01","2021-04-01","2021-04-22"], "date_not_indexed":["2021-05-01","2021-04-01","2021-03-22"]}'
5565
66+ - do :
67+ bulk :
68+ index : test_timezone_date_nanos
69+ refresh : true
70+ body :
71+ - { "index": { } }
72+ - { "date": "2015-01-01" }
73+ - { "index": { } }
74+ - { "date": "2015-01-01T12:10:30.123456789Z" }
75+ - { "index": { } }
76+ - { "date": 1420070400 }
77+ - { "index": { } }
78+
5679 - do :
5780 bulk :
5881 index : date_histogram_timezone_test
@@ -108,6 +131,126 @@ setup:
108131 - match : { aggregations.histo.buckets.12.key_as_string: "2016-06-01T00:00:00.000Z" }
109132 - match : { aggregations.histo.buckets.12.doc_count: 1 }
110133
134+ ---
135+ " date_histogram on date_nanos without timezone fixed interval " :
136+ - skip :
137+ version : " - 7.6.0"
138+ reason : bug fixed in 7.6.1
139+ - do :
140+ search :
141+ index : test_timezone_date_nanos
142+ body :
143+ size : 0
144+ aggregations :
145+ date_histogram :
146+ date_histogram :
147+ field : date
148+ fixed_interval : 30s
149+ min_doc_count : 1
150+
151+ - match : { hits.total.value: 3 }
152+ - match : { hits.total.relation: "eq" }
153+ - length : { aggregations.date_histogram.buckets: 3 }
154+ - match : { aggregations.date_histogram.buckets.0.doc_count: 1 }
155+ - match : { aggregations.date_histogram.buckets.0.key_as_string: "1970-01-17T10:27:30.000Z" }
156+ - match : { aggregations.date_histogram.buckets.0.key: 1420050000 }
157+ - match : { aggregations.date_histogram.buckets.1.doc_count: 1 }
158+ - match : { aggregations.date_histogram.buckets.1.key_as_string: "2015-01-01T00:00:00.000Z" }
159+ - match : { aggregations.date_histogram.buckets.1.key: 1420070400000 }
160+ - match : { aggregations.date_histogram.buckets.2.doc_count: 1 }
161+ - match : { aggregations.date_histogram.buckets.2.key_as_string: "2015-01-01T12:10:30.000Z" }
162+ - match : { aggregations.date_histogram.buckets.2.key: 1420114230000 }
163+
164+ ---
165+ " date_histogram on date_nanos with timezone fixed interval " :
166+ - skip :
167+ version : " - 7.6.0"
168+ reason : bug fixed in 7.6.1
169+ - do :
170+ search :
171+ index : test_timezone_date_nanos
172+ body :
173+ size : 0
174+ aggregations :
175+ date_histogram :
176+ date_histogram :
177+ field : date
178+ fixed_interval : 30s
179+ time_zone : Europe/Berlin
180+ min_doc_count : 1
181+
182+ - match : { hits.total.value: 3 }
183+ - match : { hits.total.relation: "eq" }
184+ - match : { aggregations.date_histogram.buckets.0.doc_count: 1 }
185+ - match : { aggregations.date_histogram.buckets.0.key_as_string: "1970-01-17T11:27:30.000+01:00" }
186+ - match : { aggregations.date_histogram.buckets.0.key: 1420050000 }
187+ - match : { aggregations.date_histogram.buckets.1.doc_count: 1 }
188+ - match : { aggregations.date_histogram.buckets.1.key_as_string: "2015-01-01T01:00:00.000+01:00" }
189+ - match : { aggregations.date_histogram.buckets.1.key: 1420070400000 }
190+ - match : { aggregations.date_histogram.buckets.2.doc_count: 1 }
191+ - match : { aggregations.date_histogram.buckets.2.key_as_string: "2015-01-01T13:10:30.000+01:00" }
192+ - match : { aggregations.date_histogram.buckets.2.key: 1420114230000 }
193+
194+ ---
195+ " date_histogram on date_nanos without timezone calendar interval " :
196+ - skip :
197+ version : " - 7.6.0"
198+ reason : bug fixed in 7.6.1
199+ - do :
200+ search :
201+ index : test_timezone_date_nanos
202+ body :
203+ size : 0
204+ aggregations :
205+ date_histogram :
206+ date_histogram :
207+ field : date
208+ calendar_interval : minute
209+ min_doc_count : 1
210+
211+ - match : { hits.total.value: 3 }
212+ - match : { hits.total.relation: "eq" }
213+ - length : { aggregations.date_histogram.buckets: 3 }
214+ - match : { aggregations.date_histogram.buckets.0.doc_count: 1 }
215+ - match : { aggregations.date_histogram.buckets.0.key_as_string: "1970-01-17T10:27:00.000Z" }
216+ - match : { aggregations.date_histogram.buckets.0.key: 1420020000 }
217+ - match : { aggregations.date_histogram.buckets.1.doc_count: 1 }
218+ - match : { aggregations.date_histogram.buckets.1.key_as_string: "2015-01-01T00:00:00.000Z" }
219+ - match : { aggregations.date_histogram.buckets.1.key: 1420070400000 }
220+ - match : { aggregations.date_histogram.buckets.2.doc_count: 1 }
221+ - match : { aggregations.date_histogram.buckets.2.key_as_string: "2015-01-01T12:10:00.000Z" }
222+ - match : { aggregations.date_histogram.buckets.2.key: 1420114200000 }
223+
224+ ---
225+ " date_histogram on date_nanos with timezone calendar interval " :
226+ - skip :
227+ version : " - 7.6.0"
228+ reason : bug fixed in 7.6.1
229+ - do :
230+ search :
231+ index : test_timezone_date_nanos
232+ body :
233+ size : 0
234+ aggregations :
235+ date_histogram :
236+ date_histogram :
237+ field : date
238+ calendar_interval : minute
239+ time_zone : Europe/Berlin
240+ min_doc_count : 1
241+
242+ - match : { hits.total.value: 3 }
243+ - match : { hits.total.relation: "eq" }
244+ - match : { aggregations.date_histogram.buckets.0.doc_count: 1 }
245+ - match : { aggregations.date_histogram.buckets.0.key_as_string: "1970-01-17T11:27:00.000+01:00" }
246+ - match : { aggregations.date_histogram.buckets.0.key: 1420020000 }
247+ - match : { aggregations.date_histogram.buckets.1.doc_count: 1 }
248+ - match : { aggregations.date_histogram.buckets.1.key_as_string: "2015-01-01T01:00:00.000+01:00" }
249+ - match : { aggregations.date_histogram.buckets.1.key: 1420070400000 }
250+ - match : { aggregations.date_histogram.buckets.2.doc_count: 1 }
251+ - match : { aggregations.date_histogram.buckets.2.key_as_string: "2015-01-01T13:10:00.000+01:00" }
252+ - match : { aggregations.date_histogram.buckets.2.key: 1420114200000 }
253+
111254---
112255" date_histogram and date_histogram_composite timezone " :
113256 - skip :
0 commit comments