-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Adds a hard_bounds parameter to explicitly limit the buckets that a histogram can generate. This is especially useful in case of open ended ranges that can produce a very large number of buckets.
- Loading branch information
Showing
27 changed files
with
865 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/360_date_histogram.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
setup: | ||
- skip: | ||
version: " - 7.1.99" | ||
reason: calendar_interval introduced in 7.2.0 | ||
|
||
- do: | ||
indices.create: | ||
index: test_date_hist | ||
body: | ||
settings: | ||
# There was a BWC issue that only showed up on empty shards. This | ||
# test has 4 docs and 5 shards makes sure we get one empty. | ||
number_of_shards: 5 | ||
mappings: | ||
properties: | ||
range: | ||
type: date_range | ||
|
||
- do: | ||
bulk: | ||
index: test_date_hist | ||
refresh: true | ||
body: | ||
- '{"index": {}}' | ||
- '{"range": {"gte": "2016-01-01", "lt": "2016-01-02"}}' | ||
- '{"index": {}}' | ||
- '{"range": {"gte": "2016-01-02", "lt": "2016-01-03"}}' | ||
- '{"index": {}}' | ||
- '{"range": {"gte": "2016-02-01", "lt": "2016-02-02"}}' | ||
- '{"index": {}}' | ||
- '{"range": {"gte": "2016-03-01", "lt": "2016-03-02"}}' | ||
- '{"index": {}}' | ||
- '{"range": {"gte": "2016-04-01"}}' | ||
- '{"index": {}}' | ||
- '{"range": {"lt": "2016-02-01"}}' | ||
|
||
--- | ||
"date_histogram on range with hard bounds": | ||
- skip: | ||
version: " - 7.9.99" | ||
reason: hard_bounds introduced in 7.10.0 | ||
|
||
- do: | ||
search: | ||
body: | ||
size: 0 | ||
aggs: | ||
histo: | ||
date_histogram: | ||
field: range | ||
calendar_interval: month | ||
hard_bounds: | ||
"min": "2015-06-01" | ||
"max": "2016-06-01" | ||
|
||
- match: { hits.total.value: 6 } | ||
- length: { aggregations.histo.buckets: 13 } | ||
- match: { aggregations.histo.buckets.0.key_as_string: "2015-06-01T00:00:00.000Z" } | ||
- match: { aggregations.histo.buckets.0.doc_count: 1 } | ||
- match: { aggregations.histo.buckets.8.key_as_string: "2016-02-01T00:00:00.000Z" } | ||
- 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 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.