Skip to content

Commit

Permalink
Rest test for weekly agg over DST
Browse files Browse the repository at this point in the history
Signed-off-by: Finn Carroll <[email protected]>
  • Loading branch information
finnegancarroll committed Aug 7, 2024
1 parent 97c1bf0 commit 0b63e32
Showing 1 changed file with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,59 @@ setup:
- match: { aggregations.histo.buckets.8.doc_count: 1 }
- match: { aggregations.histo.buckets.12.key_as_string: "2016-06-01T00:00:00.000Z" }
- match: { aggregations.histo.buckets.12.doc_count: 1 }

---
"date_histogram bucket offset over daylight savings":
- skip:
version: " - 2.16.99"
reason: 2.17 bug fix

- do:
indices.create:
index: dst_test
body:
mappings:
properties:
weekday:
type: text
date:
type: date

- do:
bulk:
index: dst_test
refresh: true
body:
- '{"index": {}}'
- '{"date": "2024-03-08", "weekday": "friday"}'
- '{"index": {}}'
- '{"date": "2024-03-09", "weekday": "saturday"}'
- '{"index": {}}'
- '{"date": "2024-03-10", "weekday": "sunday - -1d offset expected bucket start"}'
- '{"index": {}}'
- '{"date": "2016-03-11", "weekday": "monday - NO offset bucket start"}'
- '{"index": {}}'
- '{"date": "2016-03-12", "weekday": "tuesday"}'

- do:
search:
index: dst_test
body:
size: 0
aggs:
weekly_histogram:
date_histogram:
field: date
calendar_interval: week
offset: "-1d"
format: "yyyy-MM-dd"
time_zone: "America/New_York"

- match: { hits.total.value: 5 }
- length: { aggregations.weekly_histogram.buckets: 2 }

- match: { aggregations.weekly_histogram.buckets.0.key_as_string: "2024-03-03" }
- match: { aggregations.weekly_histogram.buckets.0.doc_count: 2 }

- match: { aggregations.weekly_histogram.buckets.1.key_as_string: "2024-03-10" }
- match: { aggregations.weekly_histogram.buckets.1.doc_count: 3 }

0 comments on commit 0b63e32

Please sign in to comment.