Skip to content

Commit e79776b

Browse files
REST tests for variable width historam (elastic#84836)
This expands on the super basic REST tests for variable width histogram with some ever so slightly less basic tests. They are still pretty basic, but they do a good job of making sure that we don't break backwards compatibility with the API. Co-authored-by: Elastic Machine <[email protected]>
1 parent a3d111b commit e79776b

File tree

1 file changed

+82
-8
lines changed

1 file changed

+82
-8
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.aggregation/350_variable_width_histogram.yml

Lines changed: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,47 @@ setup:
2424
- '{"number": 4}'
2525
- '{"index": {}}'
2626
- '{"number": 5}'
27+
- '{"index": {}}'
28+
- '{"number": 6}'
29+
- '{"index": {}}'
30+
- '{"number": 7}'
31+
- '{"index": {}}'
32+
- '{"number": 8}'
33+
- '{"index": {}}'
34+
- '{"number": 9}'
35+
- '{"index": {}}'
36+
- '{"number": 10}'
37+
- '{"index": {}}'
38+
- '{"number": 11}'
39+
40+
---
41+
defaults:
42+
- skip:
43+
version: " - 7.8.99"
44+
reason: added in 7.9.0
45+
- do:
46+
search:
47+
body:
48+
size: 0
49+
aggs:
50+
histo:
51+
variable_width_histogram:
52+
field: number
53+
- match: { hits.total.value: 11 }
54+
- length: { aggregations.histo.buckets: 10 }
55+
- match: { aggregations.histo.buckets.0: {"min": -3.0, "key": -2.5, "max": -2.0, "doc_count": 2 } }
56+
- match: { aggregations.histo.buckets.1: {"min": 1.0, "key": 1.0, "max": 1.0, "doc_count": 1 } }
57+
- match: { aggregations.histo.buckets.2: {"min": 4.0, "key": 4.0, "max": 4.0, "doc_count": 1 } }
58+
- match: { aggregations.histo.buckets.3: {"min": 5.0, "key": 5.0, "max": 5.0, "doc_count": 1 } }
59+
- match: { aggregations.histo.buckets.4: {"min": 6.0, "key": 6.0, "max": 6.0, "doc_count": 1 } }
60+
- match: { aggregations.histo.buckets.5: {"min": 7.0, "key": 7.0, "max": 7.0, "doc_count": 1 } }
61+
- match: { aggregations.histo.buckets.6: {"min": 8.0, "key": 8.0, "max": 8.0, "doc_count": 1 } }
62+
- match: { aggregations.histo.buckets.7: {"min": 9.0, "key": 9.0, "max": 9.0, "doc_count": 1 } }
63+
- match: { aggregations.histo.buckets.8: {"min": 10.0, "key": 10.0, "max": 10.0, "doc_count": 1 } }
64+
- match: { aggregations.histo.buckets.9: {"min": 11.0, "key": 11.0, "max": 11.0, "doc_count": 1 } }
2765

2866
---
29-
"basic":
67+
num_buckets:
3068
- skip:
3169
version: " - 7.8.99"
3270
reason: added in 7.9.0
@@ -39,12 +77,48 @@ setup:
3977
variable_width_histogram:
4078
field: number
4179
buckets: 3
42-
- match: { hits.total.value: 5 }
80+
- match: { hits.total.value: 11 }
4381
- length: { aggregations.histo.buckets: 3 }
44-
- match: { aggregations.histo.buckets.0.key: -2.5 }
45-
- match: { aggregations.histo.buckets.0.doc_count: 2 }
46-
- match: { aggregations.histo.buckets.1.key: 1.0 }
47-
- match: { aggregations.histo.buckets.1.doc_count: 1 }
48-
- match: { aggregations.histo.buckets.2.key: 4.5 }
49-
- match: { aggregations.histo.buckets.2.doc_count: 2 }
82+
- match: { aggregations.histo.buckets.0: {"min": -3.0, "key": -1.3333333333333333, "max": 1.0, "doc_count": 3 } }
83+
- match: { aggregations.histo.buckets.1: {"min": 4.0, "key": 5.5, "max": 7.0, "doc_count": 4 } }
84+
- match: { aggregations.histo.buckets.2: {"min": 8.0, "key": 9.5, "max": 11.0, "doc_count": 4 } }
85+
86+
---
87+
shard_size:
88+
- skip:
89+
version: " - 7.8.99"
90+
reason: added in 7.9.0
91+
- do:
92+
search:
93+
body:
94+
size: 0
95+
aggs:
96+
histo:
97+
variable_width_histogram:
98+
field: number
99+
buckets: 2
100+
shard_size: 10000 # This is an accuracy tuning parameter that the tests can't do much with. This just makes sure you can set it.
101+
- match: { hits.total.value: 11 }
102+
- length: { aggregations.histo.buckets: 2 }
103+
- match: { aggregations.histo.buckets.0: {"min": -3.0, "key": -1.3333333333333333, "max": 1.0, "doc_count": 3 } }
104+
- match: { aggregations.histo.buckets.1: {"min": 4.0, "key": 7.5, "max": 11.0, "doc_count": 8 } }
50105

106+
---
107+
initial_buffer:
108+
- skip:
109+
version: " - 7.8.99"
110+
reason: added in 7.9.0
111+
- do:
112+
search:
113+
body:
114+
size: 0
115+
aggs:
116+
histo:
117+
variable_width_histogram:
118+
field: number
119+
buckets: 2
120+
initial_buffer: 10000 # This is an accuracy tuning parameter that the tests can't do much with. This just makes sure you can set it.
121+
- match: { hits.total.value: 11 }
122+
- length: { aggregations.histo.buckets: 2 }
123+
- match: { aggregations.histo.buckets.0: {"min": -3.0, "key": -1.3333333333333333, "max": 1.0, "doc_count": 3 } }
124+
- match: { aggregations.histo.buckets.1: {"min": 4.0, "key": 7.5, "max": 11.0, "doc_count": 8 } }

0 commit comments

Comments
 (0)