From 10e6ab1d3c83529f9707ca558a5cde558ddb7d9e Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Wed, 9 Mar 2022 13:56:47 -0500 Subject: [PATCH] REST tests for variable width historam 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. --- .../350_variable_width_histogram.yml | 90 +++++++++++++++++-- 1 file changed, 82 insertions(+), 8 deletions(-) diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.aggregation/350_variable_width_histogram.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.aggregation/350_variable_width_histogram.yml index 08d76a82aaa3b..2e2e086dc0bcb 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.aggregation/350_variable_width_histogram.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.aggregation/350_variable_width_histogram.yml @@ -24,9 +24,47 @@ setup: - '{"number": 4}' - '{"index": {}}' - '{"number": 5}' + - '{"index": {}}' + - '{"number": 6}' + - '{"index": {}}' + - '{"number": 7}' + - '{"index": {}}' + - '{"number": 8}' + - '{"index": {}}' + - '{"number": 9}' + - '{"index": {}}' + - '{"number": 10}' + - '{"index": {}}' + - '{"number": 11}' + +--- +defaults: + - skip: + version: " - 7.8.99" + reason: added in 7.9.0 + - do: + search: + body: + size: 0 + aggs: + histo: + variable_width_histogram: + field: number + - match: { hits.total.value: 11 } + - length: { aggregations.histo.buckets: 10 } + - match: { aggregations.histo.buckets.0: {"min": -3.0, "key": -2.5, "max": -2.0, "doc_count": 2 } } + - match: { aggregations.histo.buckets.1: {"min": 1.0, "key": 1.0, "max": 1.0, "doc_count": 1 } } + - match: { aggregations.histo.buckets.2: {"min": 4.0, "key": 4.0, "max": 4.0, "doc_count": 1 } } + - match: { aggregations.histo.buckets.3: {"min": 5.0, "key": 5.0, "max": 5.0, "doc_count": 1 } } + - match: { aggregations.histo.buckets.4: {"min": 6.0, "key": 6.0, "max": 6.0, "doc_count": 1 } } + - match: { aggregations.histo.buckets.5: {"min": 7.0, "key": 7.0, "max": 7.0, "doc_count": 1 } } + - match: { aggregations.histo.buckets.6: {"min": 8.0, "key": 8.0, "max": 8.0, "doc_count": 1 } } + - match: { aggregations.histo.buckets.7: {"min": 9.0, "key": 9.0, "max": 9.0, "doc_count": 1 } } + - match: { aggregations.histo.buckets.8: {"min": 10.0, "key": 10.0, "max": 10.0, "doc_count": 1 } } + - match: { aggregations.histo.buckets.9: {"min": 11.0, "key": 11.0, "max": 11.0, "doc_count": 1 } } --- -"basic": +num_buckets: - skip: version: " - 7.8.99" reason: added in 7.9.0 @@ -39,12 +77,48 @@ setup: variable_width_histogram: field: number buckets: 3 - - match: { hits.total.value: 5 } + - match: { hits.total.value: 11 } - length: { aggregations.histo.buckets: 3 } - - match: { aggregations.histo.buckets.0.key: -2.5 } - - match: { aggregations.histo.buckets.0.doc_count: 2 } - - match: { aggregations.histo.buckets.1.key: 1.0 } - - match: { aggregations.histo.buckets.1.doc_count: 1 } - - match: { aggregations.histo.buckets.2.key: 4.5 } - - match: { aggregations.histo.buckets.2.doc_count: 2 } + - match: { aggregations.histo.buckets.0: {"min": -3.0, "key": -1.3333333333333333, "max": 1.0, "doc_count": 3 } } + - match: { aggregations.histo.buckets.1: {"min": 4.0, "key": 5.5, "max": 7.0, "doc_count": 4 } } + - match: { aggregations.histo.buckets.2: {"min": 8.0, "key": 9.5, "max": 11.0, "doc_count": 4 } } + +--- +shard_size: + - skip: + version: " - 7.8.99" + reason: added in 7.9.0 + - do: + search: + body: + size: 0 + aggs: + histo: + variable_width_histogram: + field: number + buckets: 2 + 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. + - match: { hits.total.value: 11 } + - length: { aggregations.histo.buckets: 2 } + - match: { aggregations.histo.buckets.0: {"min": -3.0, "key": -1.3333333333333333, "max": 1.0, "doc_count": 3 } } + - match: { aggregations.histo.buckets.1: {"min": 4.0, "key": 7.5, "max": 11.0, "doc_count": 8 } } +--- +initial_buffer: + - skip: + version: " - 7.8.99" + reason: added in 7.9.0 + - do: + search: + body: + size: 0 + aggs: + histo: + variable_width_histogram: + field: number + buckets: 2 + 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. + - match: { hits.total.value: 11 } + - length: { aggregations.histo.buckets: 2 } + - match: { aggregations.histo.buckets.0: {"min": -3.0, "key": -1.3333333333333333, "max": 1.0, "doc_count": 3 } } + - match: { aggregations.histo.buckets.1: {"min": 4.0, "key": 7.5, "max": 11.0, "doc_count": 8 } }