From 25ca53bfc59b8ea440fcbf135d878150bf9d9923 Mon Sep 17 00:00:00 2001 From: Zachary Tong Date: Wed, 16 Aug 2017 10:32:36 -0400 Subject: [PATCH 1/2] Add REST tests for value_count, stats, extended_stats and cardinality aggs Related to #26220 --- .../140_value_count_metric.yml | 173 +++++++++++ .../search.aggregation/150_stats_metric.yml | 194 ++++++++++++ .../160_extended_stats_metric.yml | 289 ++++++++++++++++++ .../170_cardinality_metric.yml | 211 +++++++++++++ 4 files changed, 867 insertions(+) create mode 100644 rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/140_value_count_metric.yml create mode 100644 rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/150_stats_metric.yml create mode 100644 rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/160_extended_stats_metric.yml create mode 100644 rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/170_cardinality_metric.yml diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/140_value_count_metric.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/140_value_count_metric.yml new file mode 100644 index 0000000000000..7de76c0d56d89 --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/140_value_count_metric.yml @@ -0,0 +1,173 @@ +setup: + - do: + indices.create: + index: test_1 + body: + settings: + number_of_replicas: 0 + mappings: + test: + properties: + int_field: + type : integer + double_field: + type : double + string_field: + type: keyword + - do: + bulk: + refresh: true + body: + - index: + _index: test_1 + _type: test + _id: 1 + - int_field: 1 + double_field: 1.0 + string_field: foo + - index: + _index: test_1 + _type: test + _id: 2 + - int_field: 51 + double_field: 51.0 + string_field: foo + - index: + _index: test_1 + _type: test + _id: 3 + - int_field: 101 + double_field: 101.0 + string_field: foo + - index: + _index: test_1 + _type: test + _id: 4 + - int_field: 151 + double_field: 151.0 + string_field: foo +--- +"Basic test": + + - do: + search: + body: + aggs: + the_int_value_count: + value_count: + field: int_field + the_double_value_count: + value_count: + field: double_field + the_string_value_count: + value_count: + field: string_field + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - match: { aggregations.the_int_value_count.value: 4 } + - match: { aggregations.the_double_value_count.value: 4 } + - match: { aggregations.the_string_value_count.value: 4 } + +--- +"Only aggs test": + + - do: + search: + body: + size: 0 + aggs: + the_int_value_count: + value_count: + field: int_field + the_double_value_count: + value_count: + field: double_field + the_string_value_count: + value_count: + field: string_field + + - match: { hits.total: 4 } + - length: { hits.hits: 0 } + - match: { aggregations.the_int_value_count.value: 4 } + - match: { aggregations.the_double_value_count.value: 4 } + - match: { aggregations.the_string_value_count.value: 4 } + +--- +"Filtered test": + + - do: + search: + body: + query: + constant_score: + filter: + range: + int_field: + gte: 50 + aggs: + the_int_value_count: + value_count: + field: int_field + the_double_value_count: + value_count: + field: double_field + the_string_value_count: + value_count: + field: string_field + + - match: { hits.total: 3 } + - length: { hits.hits: 3 } + - match: { aggregations.the_int_value_count.value: 3 } + - match: { aggregations.the_double_value_count.value: 3 } + - match: { aggregations.the_string_value_count.value: 3 } + + +--- +"Missing field with missing param": + + - do: + search: + body: + aggs: + the_missing_value_count: + value_count: + field: foo + missing: 1 + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - match: { aggregations.the_missing_value_count.value: 4 } + +--- +"Missing field without missing param": + + - do: + search: + body: + aggs: + the_missing_value_count: + value_count: + field: foo + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - is_false: aggregations.the_missing_value_count.value + +--- +"Metadata test": + + - do: + search: + body: + aggs: + the_int_value_count: + meta: + foo: bar + value_count: + field: int_field + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - match: { aggregations.the_int_value_count.value: 4 } + - match: { aggregations.the_int_value_count.meta.foo: "bar" } diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/150_stats_metric.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/150_stats_metric.yml new file mode 100644 index 0000000000000..fe89512065694 --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/150_stats_metric.yml @@ -0,0 +1,194 @@ +setup: + - do: + indices.create: + index: test_1 + body: + settings: + number_of_replicas: 0 + mappings: + test: + properties: + int_field: + type : integer + double_field: + type : double + string_field: + type: keyword + - do: + bulk: + refresh: true + body: + - index: + _index: test_1 + _type: test + _id: 1 + - int_field: 1 + double_field: 1.0 + string_field: foo + - index: + _index: test_1 + _type: test + _id: 2 + - int_field: 51 + double_field: 51.0 + string_field: foo + - index: + _index: test_1 + _type: test + _id: 3 + - int_field: 101 + double_field: 101.0 + string_field: foo + - index: + _index: test_1 + _type: test + _id: 4 + - int_field: 151 + double_field: 151.0 + string_field: foo +--- +"Basic test": + + - do: + search: + body: + aggs: + the_int_stats: + stats: + field: int_field + the_double_stats: + stats: + field: double_field + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - match: { aggregations.the_int_stats.count: 4 } + - match: { aggregations.the_int_stats.min: 1.0 } + - match: { aggregations.the_int_stats.max: 151.0 } + - match: { aggregations.the_int_stats.avg: 76.0 } + - match: { aggregations.the_int_stats.sum: 304.0 } + - match: { aggregations.the_double_stats.count: 4 } + - match: { aggregations.the_double_stats.min: 1.0 } + - match: { aggregations.the_double_stats.max: 151.0 } + - match: { aggregations.the_double_stats.avg: 76.0 } + - match: { aggregations.the_double_stats.sum: 304.0 } + +--- +"Only aggs test": + + - do: + search: + body: + size: 0 + aggs: + the_int_stats: + stats: + field: int_field + the_double_stats: + stats: + field: double_field + + - match: { hits.total: 4 } + - length: { hits.hits: 0 } + - match: { aggregations.the_int_stats.count: 4 } + - match: { aggregations.the_int_stats.min: 1.0 } + - match: { aggregations.the_int_stats.max: 151.0 } + - match: { aggregations.the_int_stats.avg: 76.0 } + - match: { aggregations.the_int_stats.sum: 304.0 } + - match: { aggregations.the_double_stats.count: 4 } + - match: { aggregations.the_double_stats.min: 1.0 } + - match: { aggregations.the_double_stats.max: 151.0 } + - match: { aggregations.the_double_stats.avg: 76.0 } + - match: { aggregations.the_double_stats.sum: 304.0 } + +--- +"Filtered test": + + - do: + search: + body: + query: + constant_score: + filter: + range: + int_field: + gte: 50 + aggs: + the_int_stats: + stats: + field: int_field + the_double_stats: + stats: + field: double_field + + - match: { hits.total: 3 } + - length: { hits.hits: 3 } + - match: { aggregations.the_int_stats.count: 3 } + - match: { aggregations.the_int_stats.min: 51.0 } + - match: { aggregations.the_int_stats.max: 151.0 } + - match: { aggregations.the_int_stats.avg: 101.0 } + - match: { aggregations.the_int_stats.sum: 303.0 } + - match: { aggregations.the_double_stats.count: 3 } + - match: { aggregations.the_double_stats.min: 51.0 } + - match: { aggregations.the_double_stats.max: 151.0 } + - match: { aggregations.the_double_stats.avg: 101.0 } + - match: { aggregations.the_double_stats.sum: 303.0 } + + +--- +"Missing field with missing param": + + - do: + search: + body: + aggs: + the_missing_stats: + stats: + field: foo + missing: 1 + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - match: { aggregations.the_missing_stats.count: 4 } + - match: { aggregations.the_missing_stats.min: 1.0 } + - match: { aggregations.the_missing_stats.max: 1.0 } + - match: { aggregations.the_missing_stats.avg: 1.0 } + - match: { aggregations.the_missing_stats.sum: 4.0 } + +--- +"Missing field without missing param": + + - do: + search: + body: + aggs: + the_missing_stats: + stats: + field: foo + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - is_false: aggregations.the_missing_stats.value + +--- +"Metadata test": + + - do: + search: + body: + aggs: + the_int_stats: + meta: + foo: bar + stats: + field: int_field + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - match: { aggregations.the_int_stats.count: 4 } + - match: { aggregations.the_int_stats.min: 1.0 } + - match: { aggregations.the_int_stats.max: 151.0 } + - match: { aggregations.the_int_stats.avg: 76.0 } + - match: { aggregations.the_int_stats.sum: 304.0 } + + diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/160_extended_stats_metric.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/160_extended_stats_metric.yml new file mode 100644 index 0000000000000..17bde6c872f6e --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/160_extended_stats_metric.yml @@ -0,0 +1,289 @@ +setup: + - do: + indices.create: + index: test_1 + body: + settings: + number_of_replicas: 0 + mappings: + test: + properties: + int_field: + type : integer + double_field: + type : double + string_field: + type: keyword + - do: + bulk: + refresh: true + body: + - index: + _index: test_1 + _type: test + _id: 1 + - int_field: 1 + double_field: 1.0 + string_field: foo + - index: + _index: test_1 + _type: test + _id: 2 + - int_field: 51 + double_field: 51.0 + string_field: foo + - index: + _index: test_1 + _type: test + _id: 3 + - int_field: 101 + double_field: 101.0 + string_field: foo + - index: + _index: test_1 + _type: test + _id: 4 + - int_field: 151 + double_field: 151.0 + string_field: foo +--- +"Basic test": + + - do: + search: + body: + aggs: + the_int_extended_stats: + extended_stats: + field: int_field + the_double_extended_stats: + extended_stats: + field: double_field + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - match: { aggregations.the_int_extended_stats.count: 4 } + - match: { aggregations.the_int_extended_stats.min: 1.0 } + - match: { aggregations.the_int_extended_stats.max: 151.0 } + - match: { aggregations.the_int_extended_stats.avg: 76.0 } + - match: { aggregations.the_int_extended_stats.sum: 304.0 } + - match: { aggregations.the_int_extended_stats.sum_of_squares: 35604.0 } + - match: { aggregations.the_int_extended_stats.std_deviation: 55.90169943749474 } + - match: { aggregations.the_int_extended_stats.std_deviation_bounds.upper: 187.80339887498948 } + - match: { aggregations.the_int_extended_stats.std_deviation_bounds.lower: -35.80339887498948 } + - match: { aggregations.the_double_extended_stats.count: 4 } + - match: { aggregations.the_double_extended_stats.min: 1.0 } + - match: { aggregations.the_double_extended_stats.max: 151.0 } + - match: { aggregations.the_double_extended_stats.avg: 76.0 } + - match: { aggregations.the_double_extended_stats.sum: 304.0 } + - match: { aggregations.the_double_extended_stats.sum_of_squares: 35604.0 } + - match: { aggregations.the_double_extended_stats.std_deviation: 55.90169943749474 } + - match: { aggregations.the_double_extended_stats.std_deviation_bounds.upper: 187.80339887498948 } + - match: { aggregations.the_double_extended_stats.std_deviation_bounds.lower: -35.80339887498948 } + +--- +"Only aggs test": + + - do: + search: + body: + size: 0 + aggs: + the_int_extended_stats: + extended_stats: + field: int_field + the_double_extended_stats: + extended_stats: + field: double_field + + - match: { hits.total: 4 } + - length: { hits.hits: 0 } + - match: { aggregations.the_int_extended_stats.count: 4 } + - match: { aggregations.the_int_extended_stats.min: 1.0 } + - match: { aggregations.the_int_extended_stats.max: 151.0 } + - match: { aggregations.the_int_extended_stats.avg: 76.0 } + - match: { aggregations.the_int_extended_stats.sum: 304.0 } + - match: { aggregations.the_int_extended_stats.sum_of_squares: 35604.0 } + - match: { aggregations.the_int_extended_stats.std_deviation: 55.90169943749474 } + - match: { aggregations.the_int_extended_stats.variance: 3125.0 } + - match: { aggregations.the_int_extended_stats.std_deviation_bounds.upper: 187.80339887498948 } + - match: { aggregations.the_int_extended_stats.std_deviation_bounds.lower: -35.80339887498948 } + - match: { aggregations.the_double_extended_stats.count: 4 } + - match: { aggregations.the_double_extended_stats.min: 1.0 } + - match: { aggregations.the_double_extended_stats.max: 151.0 } + - match: { aggregations.the_double_extended_stats.avg: 76.0 } + - match: { aggregations.the_double_extended_stats.sum: 304.0 } + - match: { aggregations.the_double_extended_stats.sum_of_squares: 35604.0 } + - match: { aggregations.the_double_extended_stats.std_deviation: 55.90169943749474 } + - match: { aggregations.the_double_extended_stats.variance: 3125.0 } + - match: { aggregations.the_double_extended_stats.std_deviation_bounds.upper: 187.80339887498948 } + - match: { aggregations.the_double_extended_stats.std_deviation_bounds.lower: -35.80339887498948 } + +--- +"Filtered test": + + - do: + search: + body: + query: + constant_score: + filter: + range: + int_field: + gte: 50 + aggs: + the_int_extended_stats: + extended_stats: + field: int_field + the_double_extended_stats: + extended_stats: + field: double_field + + - match: { hits.total: 3 } + - length: { hits.hits: 3 } + - match: { aggregations.the_int_extended_stats.count: 3 } + - match: { aggregations.the_int_extended_stats.min: 51.0 } + - match: { aggregations.the_int_extended_stats.max: 151.0 } + - match: { aggregations.the_int_extended_stats.avg: 101.0 } + - match: { aggregations.the_int_extended_stats.sum: 303.0 } + - match: { aggregations.the_int_extended_stats.sum_of_squares: 35603.0 } + - match: { aggregations.the_int_extended_stats.variance: 1666.6666666666667 } + - match: { aggregations.the_int_extended_stats.std_deviation: 40.824829046386306 } + - match: { aggregations.the_int_extended_stats.std_deviation_bounds.upper: 182.6496580927726 } + - match: { aggregations.the_int_extended_stats.std_deviation_bounds.lower: 19.35034190722739 } + - match: { aggregations.the_double_extended_stats.count: 3 } + - match: { aggregations.the_double_extended_stats.min: 51.0 } + - match: { aggregations.the_double_extended_stats.max: 151.0 } + - match: { aggregations.the_double_extended_stats.avg: 101.0 } + - match: { aggregations.the_double_extended_stats.sum: 303.0 } + - match: { aggregations.the_double_extended_stats.sum_of_squares: 35603.0 } + - match: { aggregations.the_double_extended_stats.variance: 1666.6666666666667 } + - match: { aggregations.the_double_extended_stats.std_deviation: 40.824829046386306 } + - match: { aggregations.the_double_extended_stats.std_deviation_bounds.upper: 182.6496580927726 } + - match: { aggregations.the_double_extended_stats.std_deviation_bounds.lower: 19.35034190722739 } + + +--- +"Missing field with missing param": + + - do: + search: + body: + aggs: + the_missing_extended_stats: + extended_stats: + field: foo + missing: 1 + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - match: { aggregations.the_missing_extended_stats.count: 4 } + - match: { aggregations.the_missing_extended_stats.min: 1.0 } + - match: { aggregations.the_missing_extended_stats.max: 1.0 } + - match: { aggregations.the_missing_extended_stats.avg: 1.0 } + - match: { aggregations.the_missing_extended_stats.sum: 4.0 } + - match: { aggregations.the_missing_extended_stats.sum_of_squares: 4.0 } + - match: { aggregations.the_missing_extended_stats.variance: 0.0 } + - match: { aggregations.the_missing_extended_stats.std_deviation: 0.0 } + - match: { aggregations.the_missing_extended_stats.std_deviation_bounds.upper: 1.0 } + - match: { aggregations.the_missing_extended_stats.std_deviation_bounds.lower: 1.0 } + +--- +"Missing field without missing param": + + - do: + search: + body: + aggs: + the_missing_extended_stats: + extended_stats: + field: foo + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - is_false: aggregations.the_missing_extended_stats.value + +--- +"Metadata test": + + - do: + search: + body: + aggs: + the_int_extended_stats: + meta: + foo: bar + extended_stats: + field: int_field + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - match: { aggregations.the_int_extended_stats.count: 4 } + - match: { aggregations.the_int_extended_stats.min: 1.0 } + - match: { aggregations.the_int_extended_stats.max: 151.0 } + - match: { aggregations.the_int_extended_stats.avg: 76.0 } + - match: { aggregations.the_int_extended_stats.sum: 304.0 } + - match: { aggregations.the_int_extended_stats.sum_of_squares: 35604.0 } + - match: { aggregations.the_int_extended_stats.std_deviation: 55.90169943749474 } + - match: { aggregations.the_int_extended_stats.std_deviation_bounds.upper: 187.80339887498948 } + - match: { aggregations.the_int_extended_stats.std_deviation_bounds.lower: -35.80339887498948 } + +--- +"Sigma test": + + - do: + search: + body: + aggs: + the_int_extended_stats: + extended_stats: + field: int_field + sigma: 3 + the_double_extended_stats: + extended_stats: + field: double_field + sigma: 3 + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - match: { aggregations.the_int_extended_stats.count: 4 } + - match: { aggregations.the_int_extended_stats.min: 1.0 } + - match: { aggregations.the_int_extended_stats.max: 151.0 } + - match: { aggregations.the_int_extended_stats.avg: 76.0 } + - match: { aggregations.the_int_extended_stats.sum: 304.0 } + - match: { aggregations.the_int_extended_stats.sum_of_squares: 35604.0 } + - match: { aggregations.the_int_extended_stats.std_deviation: 55.90169943749474 } + - match: { aggregations.the_int_extended_stats.std_deviation_bounds.upper: 243.7050983124842 } + - match: { aggregations.the_int_extended_stats.std_deviation_bounds.lower: -91.70509831248421 } + - match: { aggregations.the_double_extended_stats.count: 4 } + - match: { aggregations.the_double_extended_stats.min: 1.0 } + - match: { aggregations.the_double_extended_stats.max: 151.0 } + - match: { aggregations.the_double_extended_stats.avg: 76.0 } + - match: { aggregations.the_double_extended_stats.sum: 304.0 } + - match: { aggregations.the_double_extended_stats.sum_of_squares: 35604.0 } + - match: { aggregations.the_double_extended_stats.std_deviation: 55.90169943749474 } + - match: { aggregations.the_double_extended_stats.std_deviation_bounds.upper: 243.7050983124842 } + - match: { aggregations.the_double_extended_stats.std_deviation_bounds.lower: -91.70509831248421 } + +--- +"Bad sigma test": + + - do: + catch: /\[sigma\] must be greater than or equal to 0. Found \[-1.0\] in \[the_int_extended_stats\]/ + search: + body: + aggs: + the_int_extended_stats: + extended_stats: + field: int_field + sigma: -1 + + - do: + catch: /parsing_exception/ + search: + body: + aggs: + the_int_extended_stats: + extended_stats: + field: int_field + sigma: "foo" diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/170_cardinality_metric.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/170_cardinality_metric.yml new file mode 100644 index 0000000000000..d2ccf4f97c6d0 --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/170_cardinality_metric.yml @@ -0,0 +1,211 @@ +setup: + - do: + indices.create: + index: test_1 + body: + settings: + number_of_replicas: 0 + mappings: + test: + properties: + int_field: + type : integer + double_field: + type : double + string_field: + type: keyword + - do: + bulk: + refresh: true + body: + - index: + _index: test_1 + _type: test + _id: 1 + - int_field: 1 + double_field: 1.0 + string_field: foo + - index: + _index: test_1 + _type: test + _id: 2 + - int_field: 51 + double_field: 51.0 + string_field: foo + - index: + _index: test_1 + _type: test + _id: 3 + - int_field: 101 + double_field: 101.0 + string_field: foo + - index: + _index: test_1 + _type: test + _id: 4 + - int_field: 151 + double_field: 151.0 + string_field: foo +--- +"Basic test": + + - do: + search: + body: + aggs: + distinct_int: + cardinality: + field: int_field + distinct_double: + cardinality: + field: double_field + distinct_string: + cardinality: + field: string_field + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - match: { aggregations.distinct_int.value: 4 } + - match: { aggregations.distinct_double.value: 4 } + - match: { aggregations.distinct_string.value: 1 } + + - do: + search: + body: + aggs: + distinct_int: + cardinality: + field: int_field + precision_threshold: 100 + distinct_double: + cardinality: + field: double_field + precision_threshold: 100 + distinct_string: + cardinality: + field: string_field + precision_threshold: 100 + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - match: { aggregations.distinct_int.value: 4 } + - match: { aggregations.distinct_double.value: 4 } + - match: { aggregations.distinct_string.value: 1 } + +--- +"Only aggs test": + + - do: + search: + body: + size: 0 + aggs: + distinct_int: + cardinality: + field: int_field + distinct_double: + cardinality: + field: double_field + distinct_string: + cardinality: + field: string_field + + - match: { hits.total: 4 } + - length: { hits.hits: 0 } + - match: { aggregations.distinct_int.value: 4 } + - match: { aggregations.distinct_double.value: 4 } + - match: { aggregations.distinct_string.value: 1 } + +--- +"Filtered test": + + - do: + search: + body: + query: + constant_score: + filter: + range: + int_field: + gte: 50 + aggs: + distinct_int: + cardinality: + field: int_field + distinct_double: + cardinality: + field: double_field + distinct_string: + cardinality: + field: string_field + + - match: { hits.total: 3 } + - length: { hits.hits: 3 } + - match: { aggregations.distinct_int.value: 3 } + - match: { aggregations.distinct_double.value: 3 } + - match: { aggregations.distinct_string.value: 1 } + + +--- +"Missing field with missing param": + + - do: + search: + body: + aggs: + distinct_missing: + cardinality: + field: missing_field + missing: "foo" + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - match: { aggregations.distinct_missing.value: 1 } + +--- +"Missing field without missing param": + + - do: + search: + body: + aggs: + distinct_missing: + cardinality: + field: missing_field + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - is_false: aggregations.distinct_missing.value + +--- +"Metadata test": + + - do: + search: + body: + aggs: + distinct_missing: + meta: + foo: bar + cardinality: + field: int_field + + - match: { hits.total: 4 } + - length: { hits.hits: 4 } + - match: { aggregations.distinct_missing.value: 4 } + - match: { aggregations.distinct_missing.meta.foo: "bar" } + +--- +"Invalid Precision test": + + - do: + catch: /\[precisionThreshold\] must be greater than or equal to 0. Found \[-1\] in \[distinct_int\]/ + search: + body: + aggs: + distinct_int: + cardinality: + field: int_field + precision_threshold: -1 + + From d2ac4c39fc9b7ee65adce7af6a2b563d376d1e6e Mon Sep 17 00:00:00 2001 From: Zachary Tong Date: Thu, 17 Aug 2017 10:30:25 -0400 Subject: [PATCH 2/2] Change document type to `doc` --- .../test/search.aggregation/100_avg_metric.yml | 10 +++++----- .../test/search.aggregation/110_max_metric.yml | 12 +++++++----- .../test/search.aggregation/120_min_metric.yml | 12 +++++++----- .../test/search.aggregation/130_sum_metric.yml | 12 +++++++----- .../search.aggregation/140_value_count_metric.yml | 12 +++++++----- .../test/search.aggregation/150_stats_metric.yml | 12 +++++++----- .../search.aggregation/160_extended_stats_metric.yml | 12 +++++++----- .../search.aggregation/170_cardinality_metric.yml | 12 +++++++----- 8 files changed, 54 insertions(+), 40 deletions(-) diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/100_avg_metric.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/100_avg_metric.yml index 5aec7f9e67c66..2b5201d0410ce 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/100_avg_metric.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/100_avg_metric.yml @@ -6,7 +6,7 @@ setup: settings: number_of_replicas: 0 mappings: - test: + doc: properties: int_field: type : integer @@ -21,28 +21,28 @@ setup: body: - index: _index: test_1 - _type: test + _type: doc _id: 1 - int_field: 1 double_field: 1.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 2 - int_field: 51 double_field: 51.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 3 - int_field: 101 double_field: 101.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 4 - int_field: 151 double_field: 151.0 diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/110_max_metric.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/110_max_metric.yml index f3134f7bc857b..abfbcbc394865 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/110_max_metric.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/110_max_metric.yml @@ -6,7 +6,7 @@ setup: settings: number_of_replicas: 0 mappings: - test: + doc: properties: int_field: type : integer @@ -14,38 +14,40 @@ setup: type : double string_field: type: keyword + - do: bulk: refresh: true body: - index: _index: test_1 - _type: test + _type: doc _id: 1 - int_field: 1 double_field: 1.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 2 - int_field: 51 double_field: 51.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 3 - int_field: 101 double_field: 101.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 4 - int_field: 151 double_field: 151.0 string_field: foo + --- "Basic test": diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/120_min_metric.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/120_min_metric.yml index 26444bf0feb4b..5e1edaf845473 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/120_min_metric.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/120_min_metric.yml @@ -6,7 +6,7 @@ setup: settings: number_of_replicas: 0 mappings: - test: + doc: properties: int_field: type : integer @@ -14,38 +14,40 @@ setup: type : double string_field: type: keyword + - do: bulk: refresh: true body: - index: _index: test_1 - _type: test + _type: doc _id: 1 - int_field: 1 double_field: 1.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 2 - int_field: 51 double_field: 51.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 3 - int_field: 101 double_field: 101.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 4 - int_field: 151 double_field: 151.0 string_field: foo + --- "Basic test": diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/130_sum_metric.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/130_sum_metric.yml index ae26ac7d30c7d..1ce2c013863f4 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/130_sum_metric.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/130_sum_metric.yml @@ -6,7 +6,7 @@ setup: settings: number_of_replicas: 0 mappings: - test: + doc: properties: int_field: type : integer @@ -14,38 +14,40 @@ setup: type : double string_field: type: keyword + - do: bulk: refresh: true body: - index: _index: test_1 - _type: test + _type: doc _id: 1 - int_field: 1 double_field: 1.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 2 - int_field: 51 double_field: 51.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 3 - int_field: 101 double_field: 101.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 4 - int_field: 151 double_field: 151.0 string_field: foo + --- "Basic test": diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/140_value_count_metric.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/140_value_count_metric.yml index 7de76c0d56d89..088f81a0db300 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/140_value_count_metric.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/140_value_count_metric.yml @@ -6,7 +6,7 @@ setup: settings: number_of_replicas: 0 mappings: - test: + doc: properties: int_field: type : integer @@ -14,38 +14,40 @@ setup: type : double string_field: type: keyword + - do: bulk: refresh: true body: - index: _index: test_1 - _type: test + _type: doc _id: 1 - int_field: 1 double_field: 1.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 2 - int_field: 51 double_field: 51.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 3 - int_field: 101 double_field: 101.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 4 - int_field: 151 double_field: 151.0 string_field: foo + --- "Basic test": diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/150_stats_metric.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/150_stats_metric.yml index fe89512065694..a27f722509875 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/150_stats_metric.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/150_stats_metric.yml @@ -6,7 +6,7 @@ setup: settings: number_of_replicas: 0 mappings: - test: + doc: properties: int_field: type : integer @@ -14,38 +14,40 @@ setup: type : double string_field: type: keyword + - do: bulk: refresh: true body: - index: _index: test_1 - _type: test + _type: doc _id: 1 - int_field: 1 double_field: 1.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 2 - int_field: 51 double_field: 51.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 3 - int_field: 101 double_field: 101.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 4 - int_field: 151 double_field: 151.0 string_field: foo + --- "Basic test": diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/160_extended_stats_metric.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/160_extended_stats_metric.yml index 17bde6c872f6e..aff30d17de167 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/160_extended_stats_metric.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/160_extended_stats_metric.yml @@ -6,7 +6,7 @@ setup: settings: number_of_replicas: 0 mappings: - test: + doc: properties: int_field: type : integer @@ -14,38 +14,40 @@ setup: type : double string_field: type: keyword + - do: bulk: refresh: true body: - index: _index: test_1 - _type: test + _type: doc _id: 1 - int_field: 1 double_field: 1.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 2 - int_field: 51 double_field: 51.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 3 - int_field: 101 double_field: 101.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 4 - int_field: 151 double_field: 151.0 string_field: foo + --- "Basic test": diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/170_cardinality_metric.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/170_cardinality_metric.yml index d2ccf4f97c6d0..f706c5d864090 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/170_cardinality_metric.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/170_cardinality_metric.yml @@ -6,7 +6,7 @@ setup: settings: number_of_replicas: 0 mappings: - test: + doc: properties: int_field: type : integer @@ -14,38 +14,40 @@ setup: type : double string_field: type: keyword + - do: bulk: refresh: true body: - index: _index: test_1 - _type: test + _type: doc _id: 1 - int_field: 1 double_field: 1.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 2 - int_field: 51 double_field: 51.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 3 - int_field: 101 double_field: 101.0 string_field: foo - index: _index: test_1 - _type: test + _type: doc _id: 4 - int_field: 151 double_field: 151.0 string_field: foo + --- "Basic test":