diff --git a/docs/changelog/138968.yaml b/docs/changelog/138968.yaml new file mode 100644 index 0000000000000..af43b0bad21a8 --- /dev/null +++ b/docs/changelog/138968.yaml @@ -0,0 +1,19 @@ +pr: 138492 +summary: Enable new exponential histograms field type +area: Mapping +type: enhancement +issues: [] +highlight: + title: New exponential_histogram field type for native OpenTelemetry exponential histogram support + body: |- + A new `exponential_histogram` field type has been added to Elasticsearch, providing native support for + OpenTelemetry exponential histograms. + + Exponential histograms offer an efficient way to collect distributions (e.g. response times) at a high compression + ratio while still maintaining good accuracy for percentile estimation. They can be easily collected via + OpenTelemetry SDKs, as the only required configuration is the maximum allowed number of buckets. The actual buckets will be + chosen automatically based on the observed values. + + The new `exponential_histogram` field type is supported in ES|QL. + It can be aggregated using the `PERCENTILES`, `AVG`, `MIN`, `MAX` and `SUM` functions. + notable: true diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/absent.md b/docs/reference/query-languages/esql/_snippets/functions/types/absent.md index 109575169eb59..ec7dc4ad3cb11 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/absent.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/absent.md @@ -11,6 +11,7 @@ | date | boolean | | date_nanos | boolean | | double | boolean | +| exponential_histogram | boolean | | geo_point | boolean | | geo_shape | boolean | | geohash | boolean | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/absent_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/types/absent_over_time.md index 23e0f3f3ed47a..bb9e9d2aea082 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/absent_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/absent_over_time.md @@ -11,6 +11,7 @@ | date | | boolean | | date_nanos | | boolean | | double | | boolean | +| exponential_histogram | | boolean | | geo_point | | boolean | | geo_shape | | boolean | | geohash | | boolean | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/avg.md b/docs/reference/query-languages/esql/_snippets/functions/types/avg.md index d27a904332436..283fbfde6db7b 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/avg.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/avg.md @@ -6,6 +6,7 @@ | --- | --- | | aggregate_metric_double | double | | double | double | +| exponential_histogram | double | | integer | double | | long | double | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/avg_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/types/avg_over_time.md index 1e7e376f2982e..4719c46b77493 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/avg_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/avg_over_time.md @@ -6,6 +6,7 @@ | --- | --- | --- | | aggregate_metric_double | time_duration {applies_to}`stack: preview 9.3.0` | double | | double | time_duration {applies_to}`stack: preview 9.3.0` | double | +| exponential_histogram | time_duration {applies_to}`stack: preview 9.3.0` | double | | integer | time_duration {applies_to}`stack: preview 9.3.0` | double | | long | time_duration {applies_to}`stack: preview 9.3.0` | double | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/case.md b/docs/reference/query-languages/esql/_snippets/functions/types/case.md index dcc18f4f73660..ceb82639f0ec5 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/case.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/case.md @@ -18,6 +18,8 @@ | boolean | dense_vector | | dense_vector | | boolean | double | double | double | | boolean | double | | double | +| boolean | exponential_histogram | exponential_histogram | exponential_histogram | +| boolean | exponential_histogram | | exponential_histogram | | boolean | geo_point | geo_point | geo_point | | boolean | geo_point | | geo_point | | boolean | geo_shape | geo_shape | geo_shape | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/coalesce.md b/docs/reference/query-languages/esql/_snippets/functions/types/coalesce.md index 8fb034b63a6a3..5c14ab0bed335 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/coalesce.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/coalesce.md @@ -10,6 +10,7 @@ | cartesian_shape | cartesian_shape | cartesian_shape | | date | date | date | | date_nanos | date_nanos | date_nanos | +| exponential_histogram | exponential_histogram | exponential_histogram | | geo_point | geo_point | geo_point | | geo_shape | geo_shape | geo_shape | | geohash | geohash | geohash | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/first_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/types/first_over_time.md index 4ca0c6fd10d77..6956aa1f5d0e6 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/first_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/first_over_time.md @@ -8,6 +8,7 @@ | counter_integer | time_duration {applies_to}`stack: preview 9.3.0` | integer | | counter_long | time_duration {applies_to}`stack: preview 9.3.0` | long | | double | time_duration {applies_to}`stack: preview 9.3.0` | double | +| exponential_histogram | time_duration {applies_to}`stack: preview 9.3.0` | exponential_histogram | | integer | time_duration {applies_to}`stack: preview 9.3.0` | integer | | long | time_duration {applies_to}`stack: preview 9.3.0` | long | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/last_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/types/last_over_time.md index 4ca0c6fd10d77..6956aa1f5d0e6 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/last_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/last_over_time.md @@ -8,6 +8,7 @@ | counter_integer | time_duration {applies_to}`stack: preview 9.3.0` | integer | | counter_long | time_duration {applies_to}`stack: preview 9.3.0` | long | | double | time_duration {applies_to}`stack: preview 9.3.0` | double | +| exponential_histogram | time_duration {applies_to}`stack: preview 9.3.0` | exponential_histogram | | integer | time_duration {applies_to}`stack: preview 9.3.0` | integer | | long | time_duration {applies_to}`stack: preview 9.3.0` | long | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/max.md b/docs/reference/query-languages/esql/_snippets/functions/types/max.md index 9ff4654e9b8c1..2cce59675a295 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/max.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/max.md @@ -9,6 +9,7 @@ | date | date | | date_nanos | date_nanos | | double | double | +| exponential_histogram | double | | integer | integer | | ip | ip | | keyword | keyword | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/max_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/types/max_over_time.md index c3687d07d047c..6968acaa8ebb5 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/max_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/max_over_time.md @@ -9,6 +9,7 @@ | date | time_duration {applies_to}`stack: preview 9.3.0` | date | | date_nanos | time_duration {applies_to}`stack: preview 9.3.0` | date_nanos | | double | time_duration {applies_to}`stack: preview 9.3.0` | double | +| exponential_histogram | time_duration {applies_to}`stack: preview 9.3.0` | double | | integer | time_duration {applies_to}`stack: preview 9.3.0` | integer | | ip | time_duration {applies_to}`stack: preview 9.3.0` | ip | | keyword | time_duration {applies_to}`stack: preview 9.3.0` | keyword | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/median.md b/docs/reference/query-languages/esql/_snippets/functions/types/median.md index e204309f17bb1..681d3198c3abe 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/median.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/median.md @@ -5,6 +5,7 @@ | number | result | | --- | --- | | double | double | +| exponential_histogram | double | | integer | double | | long | double | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/min.md b/docs/reference/query-languages/esql/_snippets/functions/types/min.md index 9ff4654e9b8c1..2cce59675a295 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/min.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/min.md @@ -9,6 +9,7 @@ | date | date | | date_nanos | date_nanos | | double | double | +| exponential_histogram | double | | integer | integer | | ip | ip | | keyword | keyword | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/min_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/types/min_over_time.md index c3687d07d047c..6968acaa8ebb5 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/min_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/min_over_time.md @@ -9,6 +9,7 @@ | date | time_duration {applies_to}`stack: preview 9.3.0` | date | | date_nanos | time_duration {applies_to}`stack: preview 9.3.0` | date_nanos | | double | time_duration {applies_to}`stack: preview 9.3.0` | double | +| exponential_histogram | time_duration {applies_to}`stack: preview 9.3.0` | double | | integer | time_duration {applies_to}`stack: preview 9.3.0` | integer | | ip | time_duration {applies_to}`stack: preview 9.3.0` | ip | | keyword | time_duration {applies_to}`stack: preview 9.3.0` | keyword | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/percentile.md b/docs/reference/query-languages/esql/_snippets/functions/types/percentile.md index 6975dd8b2f7ff..453ab32fc91be 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/percentile.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/percentile.md @@ -7,6 +7,9 @@ | double | double | double | | double | integer | double | | double | long | double | +| exponential_histogram | double | double | +| exponential_histogram | integer | double | +| exponential_histogram | long | double | | integer | double | double | | integer | integer | double | | integer | long | double | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/percentile_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/types/percentile_over_time.md index 6975dd8b2f7ff..453ab32fc91be 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/percentile_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/percentile_over_time.md @@ -7,6 +7,9 @@ | double | double | double | | double | integer | double | | double | long | double | +| exponential_histogram | double | double | +| exponential_histogram | integer | double | +| exponential_histogram | long | double | | integer | double | double | | integer | integer | double | | integer | long | double | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/present.md b/docs/reference/query-languages/esql/_snippets/functions/types/present.md index 109575169eb59..ec7dc4ad3cb11 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/present.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/present.md @@ -11,6 +11,7 @@ | date | boolean | | date_nanos | boolean | | double | boolean | +| exponential_histogram | boolean | | geo_point | boolean | | geo_shape | boolean | | geohash | boolean | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/present_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/types/present_over_time.md index 23e0f3f3ed47a..bb9e9d2aea082 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/present_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/present_over_time.md @@ -11,6 +11,7 @@ | date | | boolean | | date_nanos | | boolean | | double | | boolean | +| exponential_histogram | | boolean | | geo_point | | boolean | | geo_shape | | boolean | | geohash | | boolean | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/sum.md b/docs/reference/query-languages/esql/_snippets/functions/types/sum.md index 962f012aa445a..bf614874bd968 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/sum.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/sum.md @@ -6,6 +6,7 @@ | --- | --- | | aggregate_metric_double | double | | double | double | +| exponential_histogram | double | | integer | long | | long | long | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/sum_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/types/sum_over_time.md index 356ffbbc80148..e40be10cbb9f9 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/sum_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/sum_over_time.md @@ -6,6 +6,7 @@ | --- | --- | --- | | aggregate_metric_double | time_duration {applies_to}`stack: preview 9.3.0` | double | | double | time_duration {applies_to}`stack: preview 9.3.0` | double | +| exponential_histogram | time_duration {applies_to}`stack: preview 9.3.0` | double | | integer | time_duration {applies_to}`stack: preview 9.3.0` | long | | long | time_duration {applies_to}`stack: preview 9.3.0` | long | diff --git a/docs/reference/query-languages/esql/_snippets/functions/types/to_string.md b/docs/reference/query-languages/esql/_snippets/functions/types/to_string.md index cb719a814ce45..0e28c50efb227 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/types/to_string.md +++ b/docs/reference/query-languages/esql/_snippets/functions/types/to_string.md @@ -12,6 +12,7 @@ | date_nanos | keyword | | dense_vector | keyword | | double | keyword | +| exponential_histogram | keyword | | geo_point | keyword | | geo_shape | keyword | | geohash | keyword | diff --git a/docs/reference/query-languages/esql/_snippets/operators/types/is_not_null.md b/docs/reference/query-languages/esql/_snippets/operators/types/is_not_null.md index 6f511d93fb57d..47ed2dab98bc7 100644 --- a/docs/reference/query-languages/esql/_snippets/operators/types/is_not_null.md +++ b/docs/reference/query-languages/esql/_snippets/operators/types/is_not_null.md @@ -15,6 +15,7 @@ | date_nanos | boolean | | dense_vector | boolean | | double | boolean | +| exponential_histogram | boolean | | geo_point | boolean | | geo_shape | boolean | | geohash | boolean | diff --git a/docs/reference/query-languages/esql/_snippets/operators/types/is_null.md b/docs/reference/query-languages/esql/_snippets/operators/types/is_null.md index 6f511d93fb57d..47ed2dab98bc7 100644 --- a/docs/reference/query-languages/esql/_snippets/operators/types/is_null.md +++ b/docs/reference/query-languages/esql/_snippets/operators/types/is_null.md @@ -15,6 +15,7 @@ | date_nanos | boolean | | dense_vector | boolean | | double | boolean | +| exponential_histogram | boolean | | geo_point | boolean | | geo_shape | boolean | | geohash | boolean | diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/absent.json b/docs/reference/query-languages/esql/kibana/definition/functions/absent.json index aa52950cebd1a..2e91c1ce8b3cc 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/absent.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/absent.json @@ -88,6 +88,18 @@ "variadic" : false, "returnType" : "boolean" }, + { + "params" : [ + { + "name" : "field", + "type" : "exponential_histogram", + "optional" : false, + "description" : "Expression that outputs values to be checked for absence." + } + ], + "variadic" : false, + "returnType" : "boolean" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/absent_over_time.json b/docs/reference/query-languages/esql/kibana/definition/functions/absent_over_time.json index 4f580ab9445b8..e09691a555fd5 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/absent_over_time.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/absent_over_time.json @@ -88,6 +88,18 @@ "variadic" : false, "returnType" : "boolean" }, + { + "params" : [ + { + "name" : "field", + "type" : "exponential_histogram", + "optional" : false, + "description" : "" + } + ], + "variadic" : false, + "returnType" : "boolean" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/avg.json b/docs/reference/query-languages/esql/kibana/definition/functions/avg.json index aa90ce69b4c18..b793a52247eb0 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/avg.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/avg.json @@ -28,6 +28,18 @@ "variadic" : false, "returnType" : "double" }, + { + "params" : [ + { + "name" : "number", + "type" : "exponential_histogram", + "optional" : false, + "description" : "Expression that outputs values to average." + } + ], + "variadic" : false, + "returnType" : "double" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/avg_over_time.json b/docs/reference/query-languages/esql/kibana/definition/functions/avg_over_time.json index 597bacad9b76d..a452f4830e7f7 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/avg_over_time.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/avg_over_time.json @@ -40,6 +40,24 @@ "variadic" : false, "returnType" : "double" }, + { + "params" : [ + { + "name" : "number", + "type" : "exponential_histogram", + "optional" : false, + "description" : "Expression that outputs values to average." + }, + { + "name" : "window", + "type" : "time_duration", + "optional" : true, + "description" : "the time window over which to compute the average" + } + ], + "variadic" : false, + "returnType" : "double" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/case.json b/docs/reference/query-languages/esql/kibana/definition/functions/case.json index b37f20a21dff9..44ff520068946 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/case.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/case.json @@ -298,6 +298,48 @@ "variadic" : true, "returnType" : "double" }, + { + "params" : [ + { + "name" : "condition", + "type" : "boolean", + "optional" : false, + "description" : "A condition." + }, + { + "name" : "trueValue", + "type" : "exponential_histogram", + "optional" : false, + "description" : "The value that’s returned when the corresponding condition is the first to evaluate to `true`. The default value is returned when no condition matches." + } + ], + "variadic" : true, + "returnType" : "exponential_histogram" + }, + { + "params" : [ + { + "name" : "condition", + "type" : "boolean", + "optional" : false, + "description" : "A condition." + }, + { + "name" : "trueValue", + "type" : "exponential_histogram", + "optional" : false, + "description" : "The value that’s returned when the corresponding condition is the first to evaluate to `true`. The default value is returned when no condition matches." + }, + { + "name" : "elseValue", + "type" : "exponential_histogram", + "optional" : true, + "description" : "The value that’s returned when no condition evaluates to `true`." + } + ], + "variadic" : true, + "returnType" : "exponential_histogram" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/coalesce.json b/docs/reference/query-languages/esql/kibana/definition/functions/coalesce.json index eca399992b3c3..93f55836cd17d 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/coalesce.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/coalesce.json @@ -106,6 +106,24 @@ "variadic" : true, "returnType" : "date_nanos" }, + { + "params" : [ + { + "name" : "first", + "type" : "exponential_histogram", + "optional" : false, + "description" : "Expression to evaluate." + }, + { + "name" : "rest", + "type" : "exponential_histogram", + "optional" : true, + "description" : "Other expression to evaluate." + } + ], + "variadic" : true, + "returnType" : "exponential_histogram" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/first_over_time.json b/docs/reference/query-languages/esql/kibana/definition/functions/first_over_time.json index db0de20946745..73e73b57a77ff 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/first_over_time.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/first_over_time.json @@ -76,6 +76,24 @@ "variadic" : false, "returnType" : "double" }, + { + "params" : [ + { + "name" : "field", + "type" : "exponential_histogram", + "optional" : false, + "description" : "" + }, + { + "name" : "window", + "type" : "time_duration", + "optional" : true, + "description" : "the time window over which to compute the first over time value" + } + ], + "variadic" : false, + "returnType" : "exponential_histogram" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/last_over_time.json b/docs/reference/query-languages/esql/kibana/definition/functions/last_over_time.json index 407279d5e3651..8c9835e2e49d4 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/last_over_time.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/last_over_time.json @@ -76,6 +76,24 @@ "variadic" : false, "returnType" : "double" }, + { + "params" : [ + { + "name" : "field", + "type" : "exponential_histogram", + "optional" : false, + "description" : "the field to calculate the latest value for" + }, + { + "name" : "window", + "type" : "time_duration", + "optional" : true, + "description" : "the time window over which to find the latest value" + } + ], + "variadic" : false, + "returnType" : "exponential_histogram" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/max.json b/docs/reference/query-languages/esql/kibana/definition/functions/max.json index 844448f1e7755..1bd951d444919 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/max.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/max.json @@ -64,6 +64,18 @@ "variadic" : false, "returnType" : "double" }, + { + "params" : [ + { + "name" : "field", + "type" : "exponential_histogram", + "optional" : false, + "description" : "" + } + ], + "variadic" : false, + "returnType" : "double" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/max_over_time.json b/docs/reference/query-languages/esql/kibana/definition/functions/max_over_time.json index e7b7e92f5933f..9bb2f065a6386 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/max_over_time.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/max_over_time.json @@ -94,6 +94,24 @@ "variadic" : false, "returnType" : "double" }, + { + "params" : [ + { + "name" : "field", + "type" : "exponential_histogram", + "optional" : false, + "description" : "" + }, + { + "name" : "window", + "type" : "time_duration", + "optional" : true, + "description" : "the time window over which to compute the maximum" + } + ], + "variadic" : false, + "returnType" : "double" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/median.json b/docs/reference/query-languages/esql/kibana/definition/functions/median.json index 9cfc2b069136d..2571a89f9f585 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/median.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/median.json @@ -17,6 +17,18 @@ "variadic" : false, "returnType" : "double" }, + { + "params" : [ + { + "name" : "number", + "type" : "exponential_histogram", + "optional" : false, + "description" : "Expression that outputs values to calculate the median of." + } + ], + "variadic" : false, + "returnType" : "double" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/min.json b/docs/reference/query-languages/esql/kibana/definition/functions/min.json index 8c90393a0bc36..a9bcc61ae9c56 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/min.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/min.json @@ -64,6 +64,18 @@ "variadic" : false, "returnType" : "double" }, + { + "params" : [ + { + "name" : "field", + "type" : "exponential_histogram", + "optional" : false, + "description" : "" + } + ], + "variadic" : false, + "returnType" : "double" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/min_over_time.json b/docs/reference/query-languages/esql/kibana/definition/functions/min_over_time.json index 35c4c975fabbb..7d46ff784126d 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/min_over_time.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/min_over_time.json @@ -94,6 +94,24 @@ "variadic" : false, "returnType" : "double" }, + { + "params" : [ + { + "name" : "field", + "type" : "exponential_histogram", + "optional" : false, + "description" : "" + }, + { + "name" : "window", + "type" : "time_duration", + "optional" : true, + "description" : "the time window over which to compute the minimum" + } + ], + "variadic" : false, + "returnType" : "double" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/percentile.json b/docs/reference/query-languages/esql/kibana/definition/functions/percentile.json index 81bcac562c4d2..19d0a8d9b381e 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/percentile.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/percentile.json @@ -58,6 +58,60 @@ "variadic" : false, "returnType" : "double" }, + { + "params" : [ + { + "name" : "number", + "type" : "exponential_histogram", + "optional" : false, + "description" : "" + }, + { + "name" : "percentile", + "type" : "double", + "optional" : false, + "description" : "" + } + ], + "variadic" : false, + "returnType" : "double" + }, + { + "params" : [ + { + "name" : "number", + "type" : "exponential_histogram", + "optional" : false, + "description" : "" + }, + { + "name" : "percentile", + "type" : "integer", + "optional" : false, + "description" : "" + } + ], + "variadic" : false, + "returnType" : "double" + }, + { + "params" : [ + { + "name" : "number", + "type" : "exponential_histogram", + "optional" : false, + "description" : "" + }, + { + "name" : "percentile", + "type" : "long", + "optional" : false, + "description" : "" + } + ], + "variadic" : false, + "returnType" : "double" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/percentile_over_time.json b/docs/reference/query-languages/esql/kibana/definition/functions/percentile_over_time.json index b217b03c8d9d3..f5c6908438369 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/percentile_over_time.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/percentile_over_time.json @@ -58,6 +58,60 @@ "variadic" : false, "returnType" : "double" }, + { + "params" : [ + { + "name" : "number", + "type" : "exponential_histogram", + "optional" : false, + "description" : "Expression that outputs values to calculate the percentile of." + }, + { + "name" : "percentile", + "type" : "double", + "optional" : false, + "description" : "" + } + ], + "variadic" : false, + "returnType" : "double" + }, + { + "params" : [ + { + "name" : "number", + "type" : "exponential_histogram", + "optional" : false, + "description" : "Expression that outputs values to calculate the percentile of." + }, + { + "name" : "percentile", + "type" : "integer", + "optional" : false, + "description" : "" + } + ], + "variadic" : false, + "returnType" : "double" + }, + { + "params" : [ + { + "name" : "number", + "type" : "exponential_histogram", + "optional" : false, + "description" : "Expression that outputs values to calculate the percentile of." + }, + { + "name" : "percentile", + "type" : "long", + "optional" : false, + "description" : "" + } + ], + "variadic" : false, + "returnType" : "double" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/present.json b/docs/reference/query-languages/esql/kibana/definition/functions/present.json index 0dc48a0bed330..e7543e33e0e2c 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/present.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/present.json @@ -88,6 +88,18 @@ "variadic" : false, "returnType" : "boolean" }, + { + "params" : [ + { + "name" : "field", + "type" : "exponential_histogram", + "optional" : false, + "description" : "Expression that outputs values to be checked for presence." + } + ], + "variadic" : false, + "returnType" : "boolean" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/present_over_time.json b/docs/reference/query-languages/esql/kibana/definition/functions/present_over_time.json index 087a2c2190318..9d9e8b780a75e 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/present_over_time.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/present_over_time.json @@ -88,6 +88,18 @@ "variadic" : false, "returnType" : "boolean" }, + { + "params" : [ + { + "name" : "field", + "type" : "exponential_histogram", + "optional" : false, + "description" : "" + } + ], + "variadic" : false, + "returnType" : "boolean" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/sum.json b/docs/reference/query-languages/esql/kibana/definition/functions/sum.json index 5549f37d47e44..bc238e71ae320 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/sum.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/sum.json @@ -28,6 +28,18 @@ "variadic" : false, "returnType" : "double" }, + { + "params" : [ + { + "name" : "number", + "type" : "exponential_histogram", + "optional" : false, + "description" : "" + } + ], + "variadic" : false, + "returnType" : "double" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/sum_over_time.json b/docs/reference/query-languages/esql/kibana/definition/functions/sum_over_time.json index 2e339673f9011..8d44833a04ed4 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/sum_over_time.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/sum_over_time.json @@ -40,6 +40,24 @@ "variadic" : false, "returnType" : "double" }, + { + "params" : [ + { + "name" : "field", + "type" : "exponential_histogram", + "optional" : false, + "description" : "" + }, + { + "name" : "window", + "type" : "time_duration", + "optional" : true, + "description" : "the time window over which to compute the sum over time" + } + ], + "variadic" : false, + "returnType" : "double" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/to_string.json b/docs/reference/query-languages/esql/kibana/definition/functions/to_string.json index 58d550875ba5e..3853d12750328 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/to_string.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/to_string.json @@ -100,6 +100,18 @@ "variadic" : false, "returnType" : "keyword" }, + { + "params" : [ + { + "name" : "field", + "type" : "exponential_histogram", + "optional" : false, + "description" : "Input value. The input can be a single- or multi-valued column or an expression." + } + ], + "variadic" : false, + "returnType" : "keyword" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/operators/is_not_null.json b/docs/reference/query-languages/esql/kibana/definition/operators/is_not_null.json index cf027c3598e43..95a98c2c31b57 100644 --- a/docs/reference/query-languages/esql/kibana/definition/operators/is_not_null.json +++ b/docs/reference/query-languages/esql/kibana/definition/operators/is_not_null.json @@ -138,6 +138,18 @@ "variadic" : false, "returnType" : "boolean" }, + { + "params" : [ + { + "name" : "field", + "type" : "exponential_histogram", + "optional" : false, + "description" : "Value to check. It can be a single- or multi-valued column or an expression." + } + ], + "variadic" : false, + "returnType" : "boolean" + }, { "params" : [ { diff --git a/docs/reference/query-languages/esql/kibana/definition/operators/is_null.json b/docs/reference/query-languages/esql/kibana/definition/operators/is_null.json index 77aa0007b256f..e24829ab79312 100644 --- a/docs/reference/query-languages/esql/kibana/definition/operators/is_null.json +++ b/docs/reference/query-languages/esql/kibana/definition/operators/is_null.json @@ -138,6 +138,18 @@ "variadic" : false, "returnType" : "boolean" }, + { + "params" : [ + { + "name" : "field", + "type" : "exponential_histogram", + "optional" : false, + "description" : "Value to check. It can be a single- or multi-valued column or an expression." + } + ], + "variadic" : false, + "returnType" : "boolean" + }, { "params" : [ { diff --git a/server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java b/server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java index 40b3df36b4a29..aac2ba5d08936 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java @@ -64,6 +64,7 @@ public class MapperFeatures implements FeatureSpecification { static final NodeFeature BBQ_DISK_STATS_SUPPORT = new NodeFeature("mapper.bbq_disk_stats_support"); static final NodeFeature SKIPPERS_ON_UNINDEXED_FIELDS = new NodeFeature("mapper.skippers_on_unindexed_fields"); static final NodeFeature STORED_FIELDS_SPEC_MERGE_BUG = new NodeFeature("mapper.stored_fields_spec_merge_bug"); + static final NodeFeature EXPONENTIAL_HISTOGRAM_TYPE = new NodeFeature("mapper.exponential_histogram_type"); @Override public Set getTestFeatures() { @@ -111,7 +112,8 @@ public Set getTestFeatures() { BBQ_DISK_STATS_SUPPORT, SKIPPERS_ON_UNINDEXED_FIELDS, STORED_FIELDS_SPEC_MERGE_BUG, - GENERIC_VECTOR_FORMAT + GENERIC_VECTOR_FORMAT, + EXPONENTIAL_HISTOGRAM_TYPE ); } } diff --git a/server/src/main/resources/transport/definitions/referable/esql_exponential_histogram_supported_version.csv b/server/src/main/resources/transport/definitions/referable/esql_exponential_histogram_supported_version.csv new file mode 100644 index 0000000000000..4641401f3c780 --- /dev/null +++ b/server/src/main/resources/transport/definitions/referable/esql_exponential_histogram_supported_version.csv @@ -0,0 +1 @@ +9239000 diff --git a/server/src/main/resources/transport/upper_bounds/9.3.csv b/server/src/main/resources/transport/upper_bounds/9.3.csv index a9da24708ea99..b901d3b0d2eb7 100644 --- a/server/src/main/resources/transport/upper_bounds/9.3.csv +++ b/server/src/main/resources/transport/upper_bounds/9.3.csv @@ -1 +1 @@ -esql_base_conversion,9238000 +esql_exponential_histogram_supported_version,9239000 diff --git a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/mapper/ExponentialHistogramParser.java b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/mapper/ExponentialHistogramParser.java index 716a395f56374..8e28995a4fb03 100644 --- a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/mapper/ExponentialHistogramParser.java +++ b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/mapper/ExponentialHistogramParser.java @@ -7,7 +7,6 @@ package org.elasticsearch.xpack.analytics.mapper; -import org.elasticsearch.common.util.FeatureFlag; import org.elasticsearch.exponentialhistogram.ExponentialHistogram; import org.elasticsearch.exponentialhistogram.ExponentialHistogramXContent; import org.elasticsearch.exponentialhistogram.ZeroBucket; @@ -67,8 +66,6 @@ public class ExponentialHistogramParser { private static final ParseField BUCKET_INDICES_FIELD = new ParseField(ExponentialHistogramXContent.BUCKET_INDICES_FIELD); private static final ParseField BUCKET_COUNTS_FIELD = new ParseField(ExponentialHistogramXContent.BUCKET_COUNTS_FIELD); - public static final FeatureFlag EXPONENTIAL_HISTOGRAM_FEATURE = new FeatureFlag("exponential_histogram"); - private static final Set ROOT_FIELD_NAMES = Set.of( SCALE_FIELD.getPreferredName(), SUM_FIELD.getPreferredName(), diff --git a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/mapper/HistogramFieldMapper.java b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/mapper/HistogramFieldMapper.java index 30e73efa73cd2..02e1a4fa4be21 100644 --- a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/mapper/HistogramFieldMapper.java +++ b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/mapper/HistogramFieldMapper.java @@ -92,11 +92,7 @@ public Builder(String name, boolean ignoreMalformedByDefault, boolean coerceByDe @Override protected Parameter[] getParameters() { - if (ExponentialHistogramParser.EXPONENTIAL_HISTOGRAM_FEATURE.isEnabled()) { - return new Parameter[] { ignoreMalformed, coerce, meta }; - } else { - return new Parameter[] { ignoreMalformed, meta }; - } + return new Parameter[] { ignoreMalformed, coerce, meta }; } @Override @@ -322,8 +318,7 @@ public void parse(DocumentParserContext context) throws IOException { subParser.nextToken(); HistogramParser.ParsedHistogram parsedHistogram; - if (ExponentialHistogramParser.EXPONENTIAL_HISTOGRAM_FEATURE.isEnabled() - && coerce() + if (coerce() && subParser.currentToken() == XContentParser.Token.FIELD_NAME && ExponentialHistogramParser.isExponentialHistogramSubFieldName(subParser.currentName())) { ExponentialHistogramParser.ParsedExponentialHistogram parsedExponential = ExponentialHistogramParser.parse( diff --git a/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/HistogramFieldMapperTests.java b/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/HistogramFieldMapperTests.java index 973908972f8df..9432074bfed07 100644 --- a/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/HistogramFieldMapperTests.java +++ b/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/HistogramFieldMapperTests.java @@ -67,9 +67,7 @@ protected void minimalMapping(XContentBuilder b) throws IOException { @Override protected void registerParameters(ParameterChecker checker) throws IOException { checker.registerUpdateCheck(b -> b.field("ignore_malformed", true), m -> assertTrue(((HistogramFieldMapper) m).ignoreMalformed())); - if (ExponentialHistogramParser.EXPONENTIAL_HISTOGRAM_FEATURE.isEnabled()) { - checker.registerUpdateCheck(b -> b.field("coerce", false), m -> assertFalse(((HistogramFieldMapper) m).coerce())); - } + checker.registerUpdateCheck(b -> b.field("coerce", false), m -> assertFalse(((HistogramFieldMapper) m).coerce())); } @Override @@ -149,24 +147,15 @@ public void testCoerce() throws IOException { ); DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(this::minimalMapping)); - if (ExponentialHistogramParser.EXPONENTIAL_HISTOGRAM_FEATURE.isEnabled() == false) { - // feature flag is disabled, so coerce should not work - ThrowingRunnable runnable = () -> defaultMapper.parse(new SourceToParse("1", inputDocBytes, XContentType.JSON)); - DocumentParsingException e = expectThrows(DocumentParsingException.class, runnable); - assertThat(e.getCause().getMessage(), containsString("unknown parameter [scale]")); - } else { - ParsedDocument doc = defaultMapper.parse(new SourceToParse("1", inputDocBytes, XContentType.JSON)); - List fields = doc.rootDoc().getFields("field"); - assertThat(fields.size(), equalTo(1)); - assertThat(docValueToParsedHistogram(fields.getFirst()), equalTo(expectedCoerced)); - - DocumentMapper coerceDisabledMapper = createDocumentMapper( - fieldMapping(b -> b.field("type", "histogram").field("coerce", false)) - ); - ThrowingRunnable runnable = () -> coerceDisabledMapper.parse(new SourceToParse("1", inputDocBytes, XContentType.JSON)); - DocumentParsingException e = expectThrows(DocumentParsingException.class, runnable); - assertThat(e.getCause().getMessage(), containsString("unknown parameter [scale]")); - } + ParsedDocument doc = defaultMapper.parse(new SourceToParse("1", inputDocBytes, XContentType.JSON)); + List fields = doc.rootDoc().getFields("field"); + assertThat(fields.size(), equalTo(1)); + assertThat(docValueToParsedHistogram(fields.getFirst()), equalTo(expectedCoerced)); + + DocumentMapper coerceDisabledMapper = createDocumentMapper(fieldMapping(b -> b.field("type", "histogram").field("coerce", false))); + ThrowingRunnable runnable = () -> coerceDisabledMapper.parse(new SourceToParse("1", inputDocBytes, XContentType.JSON)); + DocumentParsingException e = expectThrows(DocumentParsingException.class, runnable); + assertThat(e.getCause().getMessage(), containsString("unknown parameter [scale]")); } private static HistogramParser.ParsedHistogram docValueToParsedHistogram(IndexableField indexableField) { diff --git a/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldBlockLoaderTests.java b/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldBlockLoaderTests.java index 6a8f1bb23d04d..e005cecf5c500 100644 --- a/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldBlockLoaderTests.java +++ b/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldBlockLoaderTests.java @@ -39,7 +39,7 @@ protected Collection getPlugins() { @Before public void setup() { - assumeTrue("Only when exponential_histogram feature flag is enabled", TDigestFieldMapper.TDIGEST_FIELD_MAPPER.isEnabled()); + assumeTrue("Only when tdigest_field_mapper feature flag is enabled", TDigestFieldMapper.TDIGEST_FIELD_MAPPER.isEnabled()); } private static DataSourceHandler DATA_SOURCE_HANDLER = new DataSourceHandler() { diff --git a/x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DownsampleIT.java b/x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DownsampleIT.java index b28f0f737fa4e..fe6a5d2f84a11 100644 --- a/x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DownsampleIT.java +++ b/x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DownsampleIT.java @@ -7,7 +7,6 @@ package org.elasticsearch.xpack.downsample; -import org.elasticsearch.Build; import org.elasticsearch.action.admin.cluster.node.capabilities.NodesCapabilitiesRequest; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; import org.elasticsearch.action.admin.indices.delete.TransportDeleteIndexAction; @@ -148,8 +147,6 @@ public void testAggregateMethod() throws Exception { } private void downsampleWithSamplingMethod(DownsampleConfig.SamplingMethod method) throws Exception { - // TODO: remove when FeatureFlag is removed and add minimum required version to yaml spec - assumeTrue("Only when exponential_histogram feature flag is enabled", Build.current().isSnapshot()); String dataStreamName = "metrics-foo"; String mapping = """ { diff --git a/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/RestDownsampleAction.java b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/RestDownsampleAction.java index 43325b4a04f89..060ca351702ce 100644 --- a/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/RestDownsampleAction.java +++ b/x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/RestDownsampleAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.action.downsample.DownsampleAction; import org.elasticsearch.action.downsample.DownsampleConfig; import org.elasticsearch.client.internal.node.NodeClient; -import org.elasticsearch.common.util.FeatureFlag; import org.elasticsearch.core.TimeValue; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; @@ -21,23 +20,18 @@ import java.io.IOException; import java.util.List; -import java.util.Objects; import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; import static org.elasticsearch.rest.RestRequest.Method.POST; @ServerlessScope(Scope.INTERNAL) public class RestDownsampleAction extends BaseRestHandler { - public static final FeatureFlag EXPONENTIAL_HISTOGRAM_FEATURE = new FeatureFlag("exponential_histogram"); - - private final Set CAPABILITIES = Stream.of( + private final Set CAPABILITIES = Set.of( "downsample.sampling_mode.last_value", "downsample.multi_field_fix", - EXPONENTIAL_HISTOGRAM_FEATURE.isEnabled() ? "downsampling.exponential_histograms" : null - ).filter(Objects::nonNull).collect(Collectors.toSet()); + "downsampling.exponential_histograms" + ); @Override public List routes() { diff --git a/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/plugin/EsqlCorePlugin.java b/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/plugin/EsqlCorePlugin.java index 5bcff64bc7149..067b106a401cb 100644 --- a/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/plugin/EsqlCorePlugin.java +++ b/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/plugin/EsqlCorePlugin.java @@ -13,8 +13,6 @@ public class EsqlCorePlugin extends Plugin implements ExtensiblePlugin { - public static final FeatureFlag EXPONENTIAL_HISTOGRAM_FEATURE_FLAG = new FeatureFlag("esql_exponential_histogram"); - // Note, there is also a feature flag for the field type in the analytics plugin, but for visibility reasons we need // another one here. public static final FeatureFlag T_DIGEST_ESQL_SUPPORT = new FeatureFlag("esql_t_digest_support"); diff --git a/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/type/DataType.java b/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/type/DataType.java index 9bef9b1c6db7d..2e5815a0c9d2e 100644 --- a/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/type/DataType.java +++ b/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/type/DataType.java @@ -370,7 +370,10 @@ public enum DataType implements Writeable { builder().esType("exponential_histogram") .estimatedSize(16 * 160)// guess 160 buckets (OTEL default for positive values only histograms) with 16 bytes per bucket .docValues() - .underConstruction(DataTypesTransportVersions.TEXT_SIMILARITY_RANK_DOC_EXPLAIN_CHUNKS_VERSION) + .supportedSince( + DataTypesTransportVersions.TEXT_SIMILARITY_RANK_DOC_EXPLAIN_CHUNKS_VERSION, + DataTypesTransportVersions.ESQL_EXPONENTIAL_HISTOGRAM_SUPPORTED_VERSION + ) ), TDIGEST( @@ -1048,6 +1051,10 @@ public static class DataTypesTransportVersions { "text_similarity_rank_docs_explain_chunks" ); + public static final TransportVersion ESQL_EXPONENTIAL_HISTOGRAM_SUPPORTED_VERSION = TransportVersion.fromName( + "esql_exponential_histogram_supported_version" + ); + private static final TransportVersion ESQL_SERIALIZEABLE_TDIGEST = TransportVersion.fromName("esql_serializeable_tdigest"); } diff --git a/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterSpecIT.java b/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterSpecIT.java index 4a01001d92e2f..a6b3e9709e1f4 100644 --- a/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterSpecIT.java +++ b/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterSpecIT.java @@ -359,11 +359,11 @@ protected boolean supportsExponentialHistograms() { try { return RestEsqlTestCase.hasCapabilities( client(), - List.of(EsqlCapabilities.Cap.EXPONENTIAL_HISTOGRAM_PRE_TECH_PREVIEW_V8.capabilityName()) + List.of(EsqlCapabilities.Cap.EXPONENTIAL_HISTOGRAM_TECH_PREVIEW.capabilityName()) ) && RestEsqlTestCase.hasCapabilities( remoteClusterClient(), - List.of(EsqlCapabilities.Cap.EXPONENTIAL_HISTOGRAM_PRE_TECH_PREVIEW_V8.capabilityName()) + List.of(EsqlCapabilities.Cap.EXPONENTIAL_HISTOGRAM_TECH_PREVIEW.capabilityName()) ); } catch (IOException e) { throw new RuntimeException(e); diff --git a/x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/EsqlSpecIT.java b/x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/EsqlSpecIT.java index ed718dde490b3..aa973a2018331 100644 --- a/x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/EsqlSpecIT.java +++ b/x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/EsqlSpecIT.java @@ -58,7 +58,7 @@ protected boolean supportsSourceFieldMapping() { protected boolean supportsExponentialHistograms() { return RestEsqlTestCase.hasCapabilities( client(), - List.of(EsqlCapabilities.Cap.EXPONENTIAL_HISTOGRAM_PRE_TECH_PREVIEW_V8.capabilityName()) + List.of(EsqlCapabilities.Cap.EXPONENTIAL_HISTOGRAM_TECH_PREVIEW.capabilityName()) ); } diff --git a/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/AllSupportedFieldsTestCase.java b/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/AllSupportedFieldsTestCase.java index 8fd9b5491d07c..65e076b576fd1 100644 --- a/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/AllSupportedFieldsTestCase.java +++ b/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/AllSupportedFieldsTestCase.java @@ -19,7 +19,11 @@ import org.elasticsearch.client.RestClient; import org.elasticsearch.common.Strings; import org.elasticsearch.common.logging.LoggerMessageFormat; +import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.core.Tuple; +import org.elasticsearch.exponentialhistogram.ExponentialHistogram; +import org.elasticsearch.exponentialhistogram.ExponentialHistogramCircuitBreaker; +import org.elasticsearch.exponentialhistogram.ExponentialHistogramXContent; import org.elasticsearch.index.IndexMode; import org.elasticsearch.index.mapper.MappedFieldType; import org.elasticsearch.test.MapMatcher; @@ -41,6 +45,7 @@ import java.util.Set; import java.util.TreeMap; import java.util.stream.Collectors; +import java.util.stream.IntStream; import static org.elasticsearch.common.xcontent.support.XContentMapValues.extractValue; import static org.elasticsearch.test.ListMatcher.matchesList; @@ -340,7 +345,7 @@ protected static MapMatcher allTypesColumnsMatcher( ) { MapMatcher expectedColumns = matchesMap().entry(LOOKUP_ID_FIELD, "integer"); for (DataType type : DataType.values()) { - if (supportedInIndex(type) == false) { + if (supportedInIndex(type, minimumVersion) == false) { continue; } if (expectNonEnrichableFields == false && supportedInEnrich(type) == false) { @@ -372,7 +377,7 @@ protected static MapMatcher allTypesValuesMatcher( MapMatcher expectedValues = matchesMap(); expectedValues = expectedValues.entry(LOOKUP_ID_FIELD, equalTo(123)); for (DataType type : DataType.values()) { - if (supportedInIndex(type) == false) { + if (supportedInIndex(type, minimumVersion) == false) { continue; } if (expectNonEnrichableFields == false && supportedInEnrich(type) == false) { @@ -724,6 +729,9 @@ protected static String indexName(IndexMode mode, String nodeName) { private static final String LOOKUP_ID_FIELD = "lookup_id"; protected static void createAllTypesIndex(RestClient client, String indexName, String nodeId, IndexMode mode) throws IOException { + Map nodeInfoMap = fetchNodeToInfo(client, null); + TransportVersion minimumVersion = minVersion(nodeInfoMap); + XContentBuilder config = JsonXContent.contentBuilder().startObject(); { config.startObject("settings"); @@ -746,7 +754,7 @@ protected static void createAllTypesIndex(RestClient client, String indexName, S config.endObject(); for (DataType type : DataType.values()) { - if (supportedInIndex(type) == false) { + if (supportedInIndex(type, minimumVersion) == false) { continue; } config.startObject(fieldName(type)); @@ -784,12 +792,21 @@ private static void typeMapping(IndexMode indexMode, XContentBuilder config, Dat } } + private static final ExponentialHistogram EXPONENTIAL_HISTOGRAM_VALUE = ExponentialHistogram.create( + 10, + ExponentialHistogramCircuitBreaker.noop(), + IntStream.range(0, 100).mapToDouble(i -> i).toArray() + ); + protected static void createAllTypesDoc(RestClient client, String indexName) throws IOException { + Map nodeInfoMap = fetchNodeToInfo(client, null); + TransportVersion minimumVersion = minVersion(nodeInfoMap); + XContentBuilder doc = JsonXContent.contentBuilder().startObject(); doc.field(LOOKUP_ID_FIELD); doc.value(123); for (DataType type : DataType.values()) { - if (supportedInIndex(type) == false) { + if (supportedInIndex(type, minimumVersion) == false) { continue; } doc.field(fieldName(type)); @@ -811,6 +828,7 @@ protected static void createAllTypesDoc(RestClient client, String indexName) thr doc.field("value_count", 25); doc.endObject(); } + case EXPONENTIAL_HISTOGRAM -> ExponentialHistogramXContent.serialize(doc, EXPONENTIAL_HISTOGRAM_VALUE); case DENSE_VECTOR -> doc.value(List.of(0.5, 10, 6)); default -> throw new AssertionError("unsupported field type [" + type + "]"); } @@ -823,6 +841,9 @@ protected static void createAllTypesDoc(RestClient client, String indexName) thr } protected static void createEnrichPolicy(RestClient client, String indexName, String policyName) throws IOException { + Map nodeInfoMap = fetchNodeToInfo(client, null); + TransportVersion minimumVersion = minVersion(nodeInfoMap); + XContentBuilder policyConfig = JsonXContent.contentBuilder().startObject(); { policyConfig.startObject("match"); @@ -831,7 +852,7 @@ protected static void createEnrichPolicy(RestClient client, String indexName, St policyConfig.field("match_field", LOOKUP_ID_FIELD); List enrichFields = new ArrayList<>(); for (DataType type : DataType.values()) { - if (supportedInIndex(type) == false || supportedInEnrich(type) == false) { + if (supportedInIndex(type, minimumVersion) == false || supportedInEnrich(type) == false) { continue; } enrichFields.add(fieldName(type)); @@ -883,6 +904,15 @@ private static Matcher expectedValue( } yield equalTo("{\"min\":-302.5,\"max\":702.3,\"sum\":200.0,\"value_count\":25}"); } + case EXPONENTIAL_HISTOGRAM -> { + try (XContentBuilder builder = JsonXContent.contentBuilder()) { + ExponentialHistogramXContent.serialize(builder, EXPONENTIAL_HISTOGRAM_VALUE); + Map parsedJson = XContentHelper.convertToMap(JsonXContent.jsonXContent, Strings.toString(builder), true); + yield equalTo(parsedJson); + } catch (IOException e) { + throw new RuntimeException(e); + } + } case DENSE_VECTOR -> { // See expectedType for an explanation if (coordinatorVersion.supports(RESOLVE_FIELDS_RESPONSE_USED_TV) == false @@ -898,7 +928,7 @@ private static Matcher expectedValue( /** * Is the type supported in indices? */ - private static boolean supportedInIndex(DataType t) { + private static boolean supportedInIndex(DataType t, TransportVersion minimumVersion) { return switch (t) { // These are supported but implied by the index process. // TODO: current versions already support _tsid; update this once we can tell whether all nodes support it. @@ -907,11 +937,12 @@ private static boolean supportedInIndex(DataType t) { UNSUPPORTED, // You can't index these - they are just constants. DATE_PERIOD, TIME_DURATION, GEOTILE, GEOHASH, GEOHEX, - // TODO(b/133393): Once we remove the feature-flag of the exp-histo field type (!= ES|QL type), + // TODO(b/133393): Once we remove the feature-flag of the tdigest field type (!= ES|QL type), // replace this with a capability check - EXPONENTIAL_HISTOGRAM, TDIGEST, + TDIGEST, // TODO fix geo CARTESIAN_POINT, CARTESIAN_SHAPE -> false; + case EXPONENTIAL_HISTOGRAM -> DataType.EXPONENTIAL_HISTOGRAM.supportedVersion().supportedOn(minimumVersion, false); default -> true; }; } @@ -924,6 +955,8 @@ private static boolean supportedInEnrich(DataType t) { // Enrich policies don't work with types that have mandatory fields in the mapping. // https://github.com/elastic/elasticsearch/issues/127350 case AGGREGATE_METRIC_DOUBLE, SCALED_FLOAT, + // https://github.com/elastic/elasticsearch/issues/139255 + EXPONENTIAL_HISTOGRAM, // https://github.com/elastic/elasticsearch/issues/137699 DENSE_VECTOR -> false; default -> true; @@ -1069,7 +1102,7 @@ protected TransportVersion minVersion() throws IOException { return minVersion(allNodeToInfo()); } - protected TransportVersion minVersion(Map nodeToInfo) throws IOException { + protected static TransportVersion minVersion(Map nodeToInfo) throws IOException { return nodeToInfo.values().stream().map(NodeInfo::version).min(Comparator.naturalOrder()).get(); } } diff --git a/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/EsqlSpecTestCase.java b/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/EsqlSpecTestCase.java index 825a38a782ebc..115cc28e6a537 100644 --- a/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/EsqlSpecTestCase.java +++ b/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/EsqlSpecTestCase.java @@ -290,7 +290,7 @@ protected boolean supportsSourceFieldMapping() throws IOException { protected boolean supportsExponentialHistograms() { return RestEsqlTestCase.hasCapabilities( client(), - List.of(EsqlCapabilities.Cap.EXPONENTIAL_HISTOGRAM_PRE_TECH_PREVIEW_V8.capabilityName()) + List.of(EsqlCapabilities.Cap.EXPONENTIAL_HISTOGRAM_TECH_PREVIEW.capabilityName()) ); } diff --git a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/exponential_histogram.csv-spec b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/exponential_histogram.csv-spec index f110c7fa92611..7e2564771e249 100644 --- a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/exponential_histogram.csv-spec +++ b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/exponential_histogram.csv-spec @@ -1,5 +1,5 @@ loadFiltered -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | WHERE STARTS_WITH(instance, "dummy") | SORT instance | KEEP instance, responseTime ; @@ -15,7 +15,7 @@ dummy-zero_threshold_only | "{""scale"":0,""zero"":{""threshold"":2.0E-5}}" ; toString -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | WHERE STARTS_WITH(instance, "dummy") | SORT instance | EVAL str=TO_STRING(responseTime) | KEEP instance, str ; @@ -31,7 +31,7 @@ dummy-zero_threshold_only | "{""scale"":0,""zero"":{""threshold"":2.0E-5}}" ; allAggsGrouped -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | EVAL instance = CASE(STARTS_WITH(instance, "dummy"), "dummy-grouped", instance) @@ -50,7 +50,7 @@ instance-2 | 2.2E-4 | 2.744054 | 6.469E-4 | 0.0016068 | 27.706 allAggsFiltered -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | STATS min = MIN(responseTime) WHERE instance == "instance-0", @@ -69,7 +69,7 @@ min:double | max:double | median:double | p75:double | sum:double | avg:double allAggsGroupedFiltered -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | WHERE NOT STARTS_WITH(instance, "dummy") @@ -93,7 +93,7 @@ instance-2 | null | null | 6.469E-4 | null | null allAggsGroupedEmptyGroups -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | STATS min = MIN(responseTime) WHERE instance == "idontexist", @@ -110,7 +110,7 @@ null | null | null | null | null | null ; allAggsInlineGrouped -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | INLINE STATS min = MIN(responseTime), max = MAX(responseTime), median = MEDIAN(responseTime), p75 = PERCENTILE(responseTime,75), sum = SUM(responseTime), avg = AVG(responseTime) BY instance @@ -141,7 +141,7 @@ instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 allAggsOnEmptyHistogram -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | WHERE instance == "dummy-empty" | STATS min = MIN(responseTime), max = MAX(responseTime), median = MEDIAN(responseTime), p75 = PERCENTILE(responseTime,75), sum = SUM(responseTime), avg = AVG(responseTime) @@ -154,7 +154,7 @@ NULL | NULL | NULL | NULL | NULL | NULL histoAsCaseValue -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | INLINE STATS p50 = PERCENTILE(responseTime, 50) BY instance, @timestamp @@ -168,7 +168,7 @@ filteredCount:long ; ungroupedPercentiles -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | WHERE NOT STARTS_WITH(instance, "dummy") | STATS p0 = PERCENTILE(responseTime,0), p50 = PERCENTILE(responseTime,50), p99 = PERCENTILE(responseTime, 99), p100 = PERCENTILE(responseTime,100) @@ -183,7 +183,7 @@ p0:double | p50:double | p99:double | p100:double groupedPercentiles -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | WHERE NOT STARTS_WITH(instance, "dummy") | STATS p0 = PERCENTILE(responseTime,0), p50 = PERCENTILE(responseTime,50), p99 = PERCENTILE(responseTime, 99), p100 = PERCENTILE(responseTime,100) BY instance @@ -201,7 +201,7 @@ instance-2 | 2.2E-4 | 6.469E-4 | 0.0857672 | 2.7059714542564097 percentileOnEmptyHistogram -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | WHERE instance == "dummy-empty" | STATS p50 = PERCENTILE(responseTime,50) @@ -215,7 +215,7 @@ NULL ungroupedMinMax -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | WHERE NOT STARTS_WITH(instance, "dummy") | STATS min = MIN(responseTime), max = MAX(responseTime) @@ -229,7 +229,7 @@ min:double | max:double groupedMinMax -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | WHERE NOT STARTS_WITH(instance, "dummy") | STATS min = MIN(responseTime), max = MAX(responseTime) BY instance @@ -246,7 +246,7 @@ instance-2 | 2.2E-4 | 2.744054 minMaxOnEmptyHistogram -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | WHERE instance == "dummy-empty" | STATS min = MIN(responseTime), max = MAX(responseTime) @@ -259,7 +259,7 @@ NULL | NULL ungroupedAvg -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | WHERE NOT STARTS_WITH(instance, "dummy") | STATS avg = ROUND(AVG(responseTime), 7) // rounding to avoid floating point precision issues @@ -272,7 +272,7 @@ avg:double groupedAvg -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | WHERE NOT STARTS_WITH(instance, "dummy") | STATS avg = ROUND(AVG(responseTime), 7) BY instance // rounding to avoid floating point precision issues @@ -288,7 +288,7 @@ instance-2 | 0.008197 avgOnEmptyHistogram -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | WHERE instance == "dummy-empty" | STATS avg = AVG(responseTime) @@ -301,7 +301,7 @@ NULL ungroupedSum -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | WHERE NOT STARTS_WITH(instance, "dummy") | STATS sum = ROUND(SUM(responseTime), 7) // rounding to avoid floating point precision issues @@ -314,7 +314,7 @@ sum:double groupedSum -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview FROM exp_histo_sample | WHERE NOT STARTS_WITH(instance, "dummy") | STATS sum = ROUND(SUM(responseTime), 7) BY instance // rounding to avoid floating point precision issues @@ -330,7 +330,7 @@ instance-2 | 27.706021 timeseriesAllAggsNoBucket -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview required_capability: ts_command_v0 TS exp_histo_sample @@ -349,7 +349,7 @@ instance-2 | 2.2E-4 | 2.744054 | 6.469E-4 | 0.0016068 | 27.706 timeseriesAllAggsFilteredAndBucketed -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview required_capability: ts_command_v0 TS exp_histo_sample @@ -378,7 +378,7 @@ instance-2 | 2025-09-25T01:00:00.000Z | 2.45E-4 | 0.008362 | 4.777E-4 timeseriesAllAggsUngrouped -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview required_capability: ts_command_v0 TS exp_histo_sample @@ -394,7 +394,7 @@ min:double | max:double | median:double | p75:double | sum:double | avg:double timseriesAllAggsGroupedFiltered -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview required_capability: ts_command_v0 TS exp_histo_sample @@ -419,7 +419,7 @@ instance-2 | null | null | 6.469E-4 | null | null timeseriesAllAggsLastOverTimeNoBucket -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview required_capability: ts_command_v0 @@ -441,7 +441,7 @@ min:double | max:double | median:double | p75:double | sum:double | avg:double timeseriesAllAggsLastOverTimeBucketed -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview required_capability: ts_command_v0 TS exp_histo_sample @@ -466,7 +466,7 @@ instance-2 | 2.59E-4 | 0.068249 | 5.209E-4 | 0.0014578 | 0.097 timeseriesAllAggsLastOverTimeEmptyBuckets -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview required_capability: ts_command_v0 @@ -492,7 +492,7 @@ instance-2 | null | null | null | null | null timeseriesAllAggsFirstOverTimeNoBucket -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview required_capability: ts_command_v0 TS exp_histo_sample @@ -512,7 +512,7 @@ min:double | max:double | median:double | p75:double | sum:double | avg:double timeseriesAllAggsFirstOverTimeBucketed -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview required_capability: ts_command_v0 TS exp_histo_sample @@ -538,7 +538,7 @@ instance-2 | 2.65E-4 | 0.067933 | 5.571E-4 | 7.289E-4 | 0.1081 timeseriesAllAggsFirstOverTimeEmptyBuckets -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview required_capability: ts_command_v0 @@ -564,7 +564,7 @@ instance-2 | null | null | null | null | null timeseriesAllMathOverTimeAggsGrouped -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview required_capability: ts_command_v0 TS exp_histo_sample @@ -589,7 +589,7 @@ instance-2 | 2.2E-4 | 2.744054 | 0.0016068 | 27.706021 | 0.008197 timeseriesAllMathOverTimeAggsUngrouped -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview required_capability: ts_command_v0 TS exp_histo_sample @@ -610,7 +610,7 @@ min:double | max:double | p75:double | sum:double | avg:double timeseriesPresentAbsentOverTime -required_capability: exponential_histogram_pre_tech_preview_v8 +required_capability: exponential_histogram_tech_preview required_capability: ts_command_v0 TS exp_histo_sample diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java index 53001f6996bb7..e44a137672979 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java @@ -19,7 +19,6 @@ import java.util.Locale; import java.util.Set; -import static org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin.EXPONENTIAL_HISTOGRAM_FEATURE_FLAG; import static org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin.T_DIGEST_ESQL_SUPPORT; /** @@ -1582,11 +1581,9 @@ public enum Cap { PACK_DIMENSIONS_IN_TS, /** - * Support for exponential_histogram type, before it is released into tech preview. - * When implementing changes on this type, we'll simply increment the version suffix at the end to prevent bwc tests from running. - * As soon as we move into tech preview, we'll replace this capability with a "EXPONENTIAL_HISTOGRAM_TECH_PREVIEW" one. + * Support for exponential_histogram fields in the state of when it first was released into tech preview. */ - EXPONENTIAL_HISTOGRAM_PRE_TECH_PREVIEW_V8(EXPONENTIAL_HISTOGRAM_FEATURE_FLAG), + EXPONENTIAL_HISTOGRAM_TECH_PREVIEW, TDIGEST_FIELD_TYPE_SUPPORT_V1(T_DIGEST_ESQL_SUPPORT), diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/MultiRowTestCaseSupplier.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/MultiRowTestCaseSupplier.java index 879f43d2f90ea..e140f435188c4 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/MultiRowTestCaseSupplier.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/MultiRowTestCaseSupplier.java @@ -23,7 +23,6 @@ import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.esql.EsqlTestUtils; import org.elasticsearch.xpack.esql.WriteableExponentialHistogram; -import org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin; import org.elasticsearch.xpack.esql.core.type.DataType; import org.elasticsearch.xpack.versionfield.Version; @@ -496,24 +495,22 @@ public static List geohexCases(int minRows, int maxRows) { public static List exponentialHistogramCases(int minRows, int maxRows) { List cases = new ArrayList<>(); - if (EsqlCorePlugin.EXPONENTIAL_HISTOGRAM_FEATURE_FLAG.isEnabled()) { - addSuppliers( - cases, - minRows, - maxRows, - "empty exponential histograms", - DataType.EXPONENTIAL_HISTOGRAM, - () -> new WriteableExponentialHistogram(ExponentialHistogram.empty()) - ); - addSuppliers( - cases, - minRows, - maxRows, - "random exponential histograms", - DataType.EXPONENTIAL_HISTOGRAM, - EsqlTestUtils::randomExponentialHistogram - ); - } + addSuppliers( + cases, + minRows, + maxRows, + "empty exponential histograms", + DataType.EXPONENTIAL_HISTOGRAM, + () -> new WriteableExponentialHistogram(ExponentialHistogram.empty()) + ); + addSuppliers( + cases, + minRows, + maxRows, + "random exponential histograms", + DataType.EXPONENTIAL_HISTOGRAM, + EsqlTestUtils::randomExponentialHistogram + ); return cases; } diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/TestCaseSupplier.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/TestCaseSupplier.java index d660459a03ea5..cd8d96c457b0a 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/TestCaseSupplier.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/TestCaseSupplier.java @@ -29,7 +29,6 @@ import org.elasticsearch.xpack.esql.core.expression.Expression; import org.elasticsearch.xpack.esql.core.expression.Literal; import org.elasticsearch.xpack.esql.core.expression.MapExpression; -import org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin; import org.elasticsearch.xpack.esql.core.tree.Location; import org.elasticsearch.xpack.esql.core.tree.Source; import org.elasticsearch.xpack.esql.core.type.DataType; @@ -881,16 +880,14 @@ public static void forUnaryExponentialHistogram( Function expectedValue, List warnings ) { - if (EsqlCorePlugin.EXPONENTIAL_HISTOGRAM_FEATURE_FLAG.isEnabled()) { - unary( - suppliers, - expectedEvaluatorToString, - exponentialHistogramCases(), - expectedType, - v -> expectedValue.apply((ExponentialHistogram) v), - warnings - ); - } + unary( + suppliers, + expectedEvaluatorToString, + exponentialHistogramCases(), + expectedType, + v -> expectedValue.apply((ExponentialHistogram) v), + warnings + ); } private static void unaryNumeric( diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AbsentTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AbsentTests.java index 9737f8ce1cf72..25c613d0b575c 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AbsentTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AbsentTests.java @@ -11,7 +11,6 @@ import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; import org.elasticsearch.xpack.esql.core.expression.Expression; -import org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin; import org.elasticsearch.xpack.esql.core.tree.Source; import org.elasticsearch.xpack.esql.core.type.DataType; import org.elasticsearch.xpack.esql.expression.function.AbstractAggregationTestCase; @@ -79,12 +78,9 @@ public static Iterable parameters() { DataType.LONG, DataType.TEXT, DataType.UNSIGNED_LONG, - DataType.VERSION + DataType.VERSION, + DataType.EXPONENTIAL_HISTOGRAM ); - if (EsqlCorePlugin.EXPONENTIAL_HISTOGRAM_FEATURE_FLAG.isEnabled()) { - types = new ArrayList<>(types); - types.add(DataType.EXPONENTIAL_HISTOGRAM); - } for (var dataType : types) { suppliers.add( new TestCaseSupplier( diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/CountErrorTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/CountErrorTests.java index 5e9478926ff10..affbbbfdd5d80 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/CountErrorTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/CountErrorTests.java @@ -44,6 +44,6 @@ protected Matcher expectedTypeErrorMatcher(List> validPerP @Override protected void assertNumberOfCheckedSignatures(int checked) { - assertThat(checked, equalTo(1)); + assertThat("all signatures except for dense_vector or exponential_histogram should be supported", checked, equalTo(2)); } } diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/HistogramMergeErrorTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/HistogramMergeErrorTests.java index f7867ffd651cd..b164ebaec8437 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/HistogramMergeErrorTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/HistogramMergeErrorTests.java @@ -8,13 +8,11 @@ package org.elasticsearch.xpack.esql.expression.function.aggregate; import org.elasticsearch.xpack.esql.core.expression.Expression; -import org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin; import org.elasticsearch.xpack.esql.core.tree.Source; import org.elasticsearch.xpack.esql.core.type.DataType; import org.elasticsearch.xpack.esql.expression.function.ErrorsForCasesWithoutExamplesTestCase; import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier; import org.hamcrest.Matcher; -import org.junit.Before; import java.util.List; import java.util.Set; @@ -23,14 +21,6 @@ public class HistogramMergeErrorTests extends ErrorsForCasesWithoutExamplesTestCase { - @Before - public void setup() { - assumeTrue( - "Only when esql_exponential_histogram feature flag is enabled", - EsqlCorePlugin.EXPONENTIAL_HISTOGRAM_FEATURE_FLAG.isEnabled() - ); - } - @Override protected List cases() { return paramsToSuppliers(HistogramMergeTests.parameters()); diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/PresentTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/PresentTests.java index 4980af59623df..fc2fb93b4ed5d 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/PresentTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/PresentTests.java @@ -11,7 +11,6 @@ import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; import org.elasticsearch.xpack.esql.core.expression.Expression; -import org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin; import org.elasticsearch.xpack.esql.core.tree.Source; import org.elasticsearch.xpack.esql.core.type.DataType; import org.elasticsearch.xpack.esql.expression.function.AbstractAggregationTestCase; @@ -79,12 +78,9 @@ public static Iterable parameters() { DataType.LONG, DataType.TEXT, DataType.UNSIGNED_LONG, - DataType.VERSION + DataType.VERSION, + DataType.EXPONENTIAL_HISTOGRAM ); - if (EsqlCorePlugin.EXPONENTIAL_HISTOGRAM_FEATURE_FLAG.isEnabled()) { - types = new ArrayList<>(types); - types.add(DataType.EXPONENTIAL_HISTOGRAM); - } for (var dataType : types) { suppliers.add( new TestCaseSupplier( diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/ValuesErrorTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/ValuesErrorTests.java index 8273958acc2dc..09457a78486d0 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/ValuesErrorTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/ValuesErrorTests.java @@ -44,6 +44,10 @@ protected Matcher expectedTypeErrorMatcher(List> validPerP @Override protected void assertNumberOfCheckedSignatures(int checked) { - assertThat(checked, equalTo(2)); + assertThat( + "all signatures except for dense_vector, aggregate_metric_double or exponential_histogram should be supported", + checked, + equalTo(3) + ); } } diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/conditional/CaseTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/conditional/CaseTests.java index 479c3e20de1e8..4c90f5f79457c 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/conditional/CaseTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/conditional/CaseTests.java @@ -61,6 +61,7 @@ public class CaseTests extends AbstractScalarFunctionTestCase { DataType.GEOHASH, DataType.GEOTILE, DataType.GEOHEX, + DataType.EXPONENTIAL_HISTOGRAM, DataType.NULL ).collect(Collectors.toList()); if (Build.current().isSnapshot()) { diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/ExtractHistogramComponentErrorTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/ExtractHistogramComponentErrorTests.java index be43d2bf46636..d9debe974e82e 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/ExtractHistogramComponentErrorTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/ExtractHistogramComponentErrorTests.java @@ -8,13 +8,11 @@ package org.elasticsearch.xpack.esql.expression.function.scalar.histogram; import org.elasticsearch.xpack.esql.core.expression.Expression; -import org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin; import org.elasticsearch.xpack.esql.core.tree.Source; import org.elasticsearch.xpack.esql.core.type.DataType; import org.elasticsearch.xpack.esql.expression.function.ErrorsForCasesWithoutExamplesTestCase; import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier; import org.hamcrest.Matcher; -import org.junit.Before; import java.util.List; import java.util.Set; @@ -23,14 +21,6 @@ public class ExtractHistogramComponentErrorTests extends ErrorsForCasesWithoutExamplesTestCase { - @Before - public void setup() { - assumeTrue( - "Only when esql_exponential_histogram feature flag is enabled", - EsqlCorePlugin.EXPONENTIAL_HISTOGRAM_FEATURE_FLAG.isEnabled() - ); - } - @Override protected List cases() { return paramsToSuppliers(HistogramPercentileTests.parameters()); diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/ExtractHistogramComponentSerializationTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/ExtractHistogramComponentSerializationTests.java index 1682d2c36fff5..8af44e11a36cf 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/ExtractHistogramComponentSerializationTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/ExtractHistogramComponentSerializationTests.java @@ -10,23 +10,13 @@ import org.elasticsearch.compute.data.ExponentialHistogramBlock; import org.elasticsearch.xpack.esql.core.expression.Expression; import org.elasticsearch.xpack.esql.core.expression.Literal; -import org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin; import org.elasticsearch.xpack.esql.core.type.DataType; import org.elasticsearch.xpack.esql.expression.AbstractExpressionSerializationTests; -import org.junit.Before; import java.io.IOException; public class ExtractHistogramComponentSerializationTests extends AbstractExpressionSerializationTests { - @Before - public void setup() { - assumeTrue( - "Only when esql_exponential_histogram feature flag is enabled", - EsqlCorePlugin.EXPONENTIAL_HISTOGRAM_FEATURE_FLAG.isEnabled() - ); - } - @Override protected ExtractHistogramComponent createTestInstance() { return new ExtractHistogramComponent(randomSource(), randomChild(), randomComponentOrdinal()); diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/ExtractHistogramComponentTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/ExtractHistogramComponentTests.java index 09f56ffd2d50a..d79c5e927b648 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/ExtractHistogramComponentTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/ExtractHistogramComponentTests.java @@ -13,12 +13,10 @@ import org.elasticsearch.compute.data.ExponentialHistogramBlock; import org.elasticsearch.exponentialhistogram.ExponentialHistogram; import org.elasticsearch.xpack.esql.core.expression.Expression; -import org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin; import org.elasticsearch.xpack.esql.core.tree.Source; import org.elasticsearch.xpack.esql.core.type.DataType; import org.elasticsearch.xpack.esql.expression.function.AbstractScalarFunctionTestCase; import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier; -import org.junit.Before; import java.util.ArrayList; import java.util.List; @@ -28,14 +26,6 @@ public class ExtractHistogramComponentTests extends AbstractScalarFunctionTestCase { - @Before - public void setup() { - assumeTrue( - "Only when esql_exponential_histogram feature flag is enabled", - EsqlCorePlugin.EXPONENTIAL_HISTOGRAM_FEATURE_FLAG.isEnabled() - ); - } - public ExtractHistogramComponentTests(@Name("TestCase") Supplier testCaseSupplier) { this.testCase = testCaseSupplier.get(); } diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/HistogramPercentileErrorTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/HistogramPercentileErrorTests.java index 5c45e569b78aa..a199c058e3b59 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/HistogramPercentileErrorTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/HistogramPercentileErrorTests.java @@ -8,13 +8,11 @@ package org.elasticsearch.xpack.esql.expression.function.scalar.histogram; import org.elasticsearch.xpack.esql.core.expression.Expression; -import org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin; import org.elasticsearch.xpack.esql.core.tree.Source; import org.elasticsearch.xpack.esql.core.type.DataType; import org.elasticsearch.xpack.esql.expression.function.ErrorsForCasesWithoutExamplesTestCase; import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier; import org.hamcrest.Matcher; -import org.junit.Before; import java.util.List; import java.util.Set; @@ -23,14 +21,6 @@ public class HistogramPercentileErrorTests extends ErrorsForCasesWithoutExamplesTestCase { - @Before - public void setup() { - assumeTrue( - "Only when esql_exponential_histogram feature flag is enabled", - EsqlCorePlugin.EXPONENTIAL_HISTOGRAM_FEATURE_FLAG.isEnabled() - ); - } - @Override protected List cases() { return paramsToSuppliers(HistogramPercentileTests.parameters()); diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/HistogramPercentileSerializationTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/HistogramPercentileSerializationTests.java index a052cd7820ce1..56e187dea2f41 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/HistogramPercentileSerializationTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/HistogramPercentileSerializationTests.java @@ -7,22 +7,12 @@ package org.elasticsearch.xpack.esql.expression.function.scalar.histogram; -import org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin; import org.elasticsearch.xpack.esql.expression.AbstractExpressionSerializationTests; -import org.junit.Before; import java.io.IOException; public class HistogramPercentileSerializationTests extends AbstractExpressionSerializationTests { - @Before - public void setup() { - assumeTrue( - "Only when esql_exponential_histogram feature flag is enabled", - EsqlCorePlugin.EXPONENTIAL_HISTOGRAM_FEATURE_FLAG.isEnabled() - ); - } - @Override protected HistogramPercentile createTestInstance() { return new HistogramPercentile(randomSource(), randomChild(), randomChild()); diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/HistogramPercentileTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/HistogramPercentileTests.java index e283e379aaf6b..1fe08e4b95d77 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/HistogramPercentileTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/histogram/HistogramPercentileTests.java @@ -13,12 +13,10 @@ import org.elasticsearch.exponentialhistogram.ExponentialHistogram; import org.elasticsearch.exponentialhistogram.ExponentialHistogramQuantile; import org.elasticsearch.xpack.esql.core.expression.Expression; -import org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin; import org.elasticsearch.xpack.esql.core.tree.Source; import org.elasticsearch.xpack.esql.core.type.DataType; import org.elasticsearch.xpack.esql.expression.function.AbstractScalarFunctionTestCase; import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier; -import org.junit.Before; import java.util.ArrayList; import java.util.List; @@ -31,14 +29,6 @@ public class HistogramPercentileTests extends AbstractScalarFunctionTestCase { - @Before - public void setup() { - assumeTrue( - "Only when esql_exponential_histogram feature flag is enabled", - EsqlCorePlugin.EXPONENTIAL_HISTOGRAM_FEATURE_FLAG.isEnabled() - ); - } - public HistogramPercentileTests(@Name("TestCase") Supplier testCaseSupplier) { this.testCase = testCaseSupplier.get(); } diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvCountErrorTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvCountErrorTests.java index 531bb557cd3f5..72f9afa42688e 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvCountErrorTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvCountErrorTests.java @@ -44,7 +44,11 @@ protected Matcher expectedTypeErrorMatcher(List> validPerP @Override protected void assertNumberOfCheckedSignatures(int checked) { - assertThat("all signatures except dense_vector and aggregate_metric_double should be supported", checked, equalTo(2)); + assertThat( + "all signatures except dense_vector, aggregate_metric_double and exponential_histogram should be supported", + checked, + equalTo(3) + ); } } diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvDedupeErrorTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvDedupeErrorTests.java index f86521918faa9..fa15af60097bf 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvDedupeErrorTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvDedupeErrorTests.java @@ -48,7 +48,11 @@ protected void assertNumberOfCheckedSignatures(int checked) { * In general MvDedupe should support all signatures. While building a * new type you may we to temporarily relax this. */ - assertThat("all signatures except dense_vector and aggregate_metric_double should be supported", checked, equalTo(2)); + assertThat( + "all signatures except dense_vector, aggregate_metric_double and exponential_histogram should be supported", + checked, + equalTo(3) + ); } } diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvFirstErrorTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvFirstErrorTests.java index 614ddf73a6368..f6fe8c3ade24d 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvFirstErrorTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvFirstErrorTests.java @@ -44,6 +44,10 @@ protected Matcher expectedTypeErrorMatcher(List> validPerP @Override protected void assertNumberOfCheckedSignatures(int checked) { - assertThat("all signatures except dense_vector and aggregate_metric_double should be supported", checked, equalTo(2)); + assertThat( + "all signatures except dense_vector, aggregate_metric_double and exponential_histogram should be supported", + checked, + equalTo(3) + ); } } diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvLastErrorTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvLastErrorTests.java index fef10e727c6e2..fa5b76e72e613 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvLastErrorTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvLastErrorTests.java @@ -44,6 +44,10 @@ protected Matcher expectedTypeErrorMatcher(List> validPerP @Override protected void assertNumberOfCheckedSignatures(int checked) { - assertThat("all signatures except dense_vector and aggregate_metric_double should be supported", checked, equalTo(2)); + assertThat( + "all signatures except dense_vector, aggregate_metric_double and exponential_histogram should be supported", + checked, + equalTo(3) + ); } } diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/nulls/CoalesceTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/nulls/CoalesceTests.java index 909c0db499e66..dbb7d20026ecb 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/nulls/CoalesceTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/nulls/CoalesceTests.java @@ -26,7 +26,6 @@ import org.elasticsearch.xpack.esql.core.expression.FoldContext; import org.elasticsearch.xpack.esql.core.expression.Literal; import org.elasticsearch.xpack.esql.core.expression.Nullability; -import org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin; import org.elasticsearch.xpack.esql.core.tree.Source; import org.elasticsearch.xpack.esql.core.type.DataType; import org.elasticsearch.xpack.esql.core.type.EsField; @@ -122,21 +121,19 @@ public static Iterable parameters() { equalTo(firstDate == null ? secondDate : firstDate) ); })); - if (EsqlCorePlugin.EXPONENTIAL_HISTOGRAM_FEATURE_FLAG.isEnabled()) { - noNullsSuppliers.add(new TestCaseSupplier(List.of(DataType.EXPONENTIAL_HISTOGRAM, DataType.EXPONENTIAL_HISTOGRAM), () -> { - ExponentialHistogram firstHisto = randomBoolean() ? null : EsqlTestUtils.randomExponentialHistogram(); - ExponentialHistogram secondHisto = EsqlTestUtils.randomExponentialHistogram(); - return new TestCaseSupplier.TestCase( - List.of( - new TestCaseSupplier.TypedData(firstHisto, DataType.EXPONENTIAL_HISTOGRAM, "first"), - new TestCaseSupplier.TypedData(secondHisto, DataType.EXPONENTIAL_HISTOGRAM, "second") - ), - "CoalesceExponentialHistogramEagerEvaluator[values=[Attribute[channel=0], Attribute[channel=1]]]", - DataType.EXPONENTIAL_HISTOGRAM, - equalTo(firstHisto == null ? secondHisto : firstHisto) - ); - })); - } + noNullsSuppliers.add(new TestCaseSupplier(List.of(DataType.EXPONENTIAL_HISTOGRAM, DataType.EXPONENTIAL_HISTOGRAM), () -> { + ExponentialHistogram firstHisto = randomBoolean() ? null : EsqlTestUtils.randomExponentialHistogram(); + ExponentialHistogram secondHisto = EsqlTestUtils.randomExponentialHistogram(); + return new TestCaseSupplier.TestCase( + List.of( + new TestCaseSupplier.TypedData(firstHisto, DataType.EXPONENTIAL_HISTOGRAM, "first"), + new TestCaseSupplier.TypedData(secondHisto, DataType.EXPONENTIAL_HISTOGRAM, "second") + ), + "CoalesceExponentialHistogramEagerEvaluator[values=[Attribute[channel=0], Attribute[channel=1]]]", + DataType.EXPONENTIAL_HISTOGRAM, + equalTo(firstHisto == null ? secondHisto : firstHisto) + ); + })); List suppliers = new ArrayList<>(noNullsSuppliers); for (TestCaseSupplier s : noNullsSuppliers) { for (int nullUpTo = 1; nullUpTo < s.types().size(); nullUpTo++) { diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/AbstractLogicalPlanOptimizerTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/AbstractLogicalPlanOptimizerTests.java index 5732395ca7580..1f7125b5a3a09 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/AbstractLogicalPlanOptimizerTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/AbstractLogicalPlanOptimizerTests.java @@ -173,7 +173,7 @@ public static void init() { ); List metricIndices = new ArrayList<>(); - if (EsqlCapabilities.Cap.EXPONENTIAL_HISTOGRAM_PRE_TECH_PREVIEW_V8.isEnabled()) { + if (EsqlCapabilities.Cap.EXPONENTIAL_HISTOGRAM_TECH_PREVIEW.isEnabled()) { Map expHistoMetricMapping = loadMapping("exp_histo_sample-mappings.json"); metricIndices.add( EsIndexGenerator.esIndex("exp_histo_sample", expHistoMetricMapping, Map.of("exp_histo_sample", IndexMode.TIME_SERIES)) diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/LogicalPlanOptimizerTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/LogicalPlanOptimizerTests.java index 743c3cea2614a..36755343a6fb1 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/LogicalPlanOptimizerTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/LogicalPlanOptimizerTests.java @@ -7888,7 +7888,6 @@ public void testTranslateWithInlineFilterWithImplicitLastOverTime() { } public void testTranslateHistogramSumWithImplicitMergeOverTime() { - assumeTrue("exponenial histogram support required", EsqlCapabilities.Cap.EXPONENTIAL_HISTOGRAM_PRE_TECH_PREVIEW_V8.isEnabled()); var query = """ TS exp_histo_sample | STATS SUM(responseTime) BY bucket(@timestamp, 1 minute) | LIMIT 10 """; @@ -7920,7 +7919,6 @@ public void testTranslateHistogramSumWithImplicitMergeOverTime() { } public void testTranslateHistogramSumWithImplicitMergeOverTimeAndFilter() { - assumeTrue("exponenial histogram support required", EsqlCapabilities.Cap.EXPONENTIAL_HISTOGRAM_PRE_TECH_PREVIEW_V8.isEnabled()); var query = """ TS exp_histo_sample | STATS SUM(responseTime) WHERE instance == "foobar" BY bucket(@timestamp, 1 minute) | LIMIT 10 """; @@ -7953,7 +7951,6 @@ public void testTranslateHistogramSumWithImplicitMergeOverTimeAndFilter() { } public void testTranslateHistogramPercentileWithImplicitMergeOverTime() { - assumeTrue("exponenial histogram support required", EsqlCapabilities.Cap.EXPONENTIAL_HISTOGRAM_PRE_TECH_PREVIEW_V8.isEnabled()); var query = """ TS exp_histo_sample | STATS PERCENTILE(responseTime, 50) BY bucket(@timestamp, 1 minute) | LIMIT 10 """; @@ -7986,7 +7983,6 @@ public void testTranslateHistogramPercentileWithImplicitMergeOverTime() { } public void testTranslateHistogramPercentileWithImplicitMergeOverTimeAndFilter() { - assumeTrue("exponenial histogram support required", EsqlCapabilities.Cap.EXPONENTIAL_HISTOGRAM_PRE_TECH_PREVIEW_V8.isEnabled()); var query = """ TS exp_histo_sample | STATS PERCENTILE(responseTime, 50) WHERE instance == "foobar" BY bucket(@timestamp, 1 minute) | LIMIT 10 """; diff --git a/x-pack/plugin/mapper-exponential-histogram/build.gradle b/x-pack/plugin/mapper-exponential-histogram/build.gradle index 76509577fae8b..e6d6c59ca8ae3 100644 --- a/x-pack/plugin/mapper-exponential-histogram/build.gradle +++ b/x-pack/plugin/mapper-exponential-histogram/build.gradle @@ -6,7 +6,6 @@ */ apply plugin: 'elasticsearch.internal-es-plugin' -apply plugin: 'elasticsearch.internal-yaml-rest-test' esplugin { name = 'exponential-histogram' @@ -18,11 +17,6 @@ base { archivesName = 'x-pack-exponential-histogram' } -restResources { - restApi { - include 'bulk', 'search', 'indices', 'cluster' - } -} dependencies { api project(":libs:exponential-histogram") api project(xpackModule('analytics')) @@ -30,15 +24,4 @@ dependencies { compileOnly project(path: xpackModule('core')) testImplementation(testArtifact(project(":libs:exponential-histogram"))) - - yamlRestTestImplementation(testArtifact(project(xpackModule('core')))) - clusterModules(project(xpackModule('analytics'))) //histogram field type - clusterModules(project(xpackModule('mapper-aggregate-metric'))) //aggregate_metric_double field type - clusterModules project(':modules:data-streams') -} - -restResources { - restApi { - include '_common', 'indices', 'index', 'get' - } } diff --git a/x-pack/plugin/mapper-exponential-histogram/src/main/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramMapperPlugin.java b/x-pack/plugin/mapper-exponential-histogram/src/main/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramMapperPlugin.java index 57f3cb3e106d8..411c613f24b4e 100644 --- a/x-pack/plugin/mapper-exponential-histogram/src/main/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramMapperPlugin.java +++ b/x-pack/plugin/mapper-exponential-histogram/src/main/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramMapperPlugin.java @@ -12,11 +12,8 @@ import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.SearchPlugin; import org.elasticsearch.search.aggregations.support.ValuesSourceRegistry; -import org.elasticsearch.xpack.analytics.mapper.ExponentialHistogramParser; import org.elasticsearch.xpack.exponentialhistogram.aggregations.ExponentialHistogramAggregatorsRegistrar; -import java.util.Collections; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.function.Consumer; @@ -27,23 +24,16 @@ public class ExponentialHistogramMapperPlugin extends Plugin implements MapperPlugin, SearchPlugin { @Override public Map getMappers() { - Map mappers = new LinkedHashMap<>(); - if (ExponentialHistogramParser.EXPONENTIAL_HISTOGRAM_FEATURE.isEnabled()) { - mappers.put(ExponentialHistogramFieldMapper.CONTENT_TYPE, ExponentialHistogramFieldMapper.PARSER); - } - return Collections.unmodifiableMap(mappers); + return Map.of(ExponentialHistogramFieldMapper.CONTENT_TYPE, ExponentialHistogramFieldMapper.PARSER); } @Override public List> getAggregationExtentions() { - if (ExponentialHistogramParser.EXPONENTIAL_HISTOGRAM_FEATURE.isEnabled()) { - return List.of( - ExponentialHistogramAggregatorsRegistrar::registerValueCountAggregator, - ExponentialHistogramAggregatorsRegistrar::registerSumAggregator, - ExponentialHistogramAggregatorsRegistrar::registerAvgAggregator, - ExponentialHistogramAggregatorsRegistrar::registerHistogramAggregator - ); - } - return Collections.emptyList(); + return List.of( + ExponentialHistogramAggregatorsRegistrar::registerValueCountAggregator, + ExponentialHistogramAggregatorsRegistrar::registerSumAggregator, + ExponentialHistogramAggregatorsRegistrar::registerAvgAggregator, + ExponentialHistogramAggregatorsRegistrar::registerHistogramAggregator + ); } } diff --git a/x-pack/plugin/mapper-exponential-histogram/src/test/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramFieldBlockLoaderTests.java b/x-pack/plugin/mapper-exponential-histogram/src/test/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramFieldBlockLoaderTests.java index bcc5f43b274df..b94a90be04704 100644 --- a/x-pack/plugin/mapper-exponential-histogram/src/test/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramFieldBlockLoaderTests.java +++ b/x-pack/plugin/mapper-exponential-histogram/src/test/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramFieldBlockLoaderTests.java @@ -23,8 +23,6 @@ import org.elasticsearch.xcontent.XContentParser; import org.elasticsearch.xcontent.XContentParserConfiguration; import org.elasticsearch.xcontent.json.JsonXContent; -import org.elasticsearch.xpack.analytics.mapper.ExponentialHistogramParser; -import org.junit.Before; import java.io.IOException; import java.util.Collection; @@ -40,14 +38,6 @@ public ExponentialHistogramFieldBlockLoaderTests(Params params) { super(ExponentialHistogramFieldMapper.CONTENT_TYPE, List.of(DATA_SOURCE_HANDLER), params); } - @Before - public void setup() { - assumeTrue( - "Only when exponential_histogram feature flag is enabled", - ExponentialHistogramParser.EXPONENTIAL_HISTOGRAM_FEATURE.isEnabled() - ); - } - @Override protected Collection getPlugins() { return Collections.singletonList(new ExponentialHistogramMapperPlugin()); diff --git a/x-pack/plugin/mapper-exponential-histogram/src/test/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramFieldMapperTests.java b/x-pack/plugin/mapper-exponential-histogram/src/test/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramFieldMapperTests.java index 0f235d9e065c9..c375ead5af266 100644 --- a/x-pack/plugin/mapper-exponential-histogram/src/test/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramFieldMapperTests.java +++ b/x-pack/plugin/mapper-exponential-histogram/src/test/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramFieldMapperTests.java @@ -47,7 +47,6 @@ import org.elasticsearch.xpack.analytics.mapper.ParsedHistogramConverter; import org.elasticsearch.xpack.exponentialhistogram.aggregations.ExponentialHistogramAggregatorTestCase; import org.junit.AssumptionViolatedException; -import org.junit.Before; import java.io.IOException; import java.util.ArrayList; @@ -73,14 +72,6 @@ public class ExponentialHistogramFieldMapperTests extends MapperTestCase { - @Before - public void setup() { - assumeTrue( - "Only when exponential_histogram feature flag is enabled", - ExponentialHistogramParser.EXPONENTIAL_HISTOGRAM_FEATURE.isEnabled() - ); - } - protected Collection getPlugins() { return Collections.singletonList(new ExponentialHistogramMapperPlugin()); } diff --git a/x-pack/plugin/mapper-exponential-histogram/src/test/java/org/elasticsearch/xpack/exponentialhistogram/aggregations/ExponentialHistogramAggregatorTestCase.java b/x-pack/plugin/mapper-exponential-histogram/src/test/java/org/elasticsearch/xpack/exponentialhistogram/aggregations/ExponentialHistogramAggregatorTestCase.java index 8b5134245a66b..9f6fa4e838599 100644 --- a/x-pack/plugin/mapper-exponential-histogram/src/test/java/org/elasticsearch/xpack/exponentialhistogram/aggregations/ExponentialHistogramAggregatorTestCase.java +++ b/x-pack/plugin/mapper-exponential-histogram/src/test/java/org/elasticsearch/xpack/exponentialhistogram/aggregations/ExponentialHistogramAggregatorTestCase.java @@ -17,7 +17,6 @@ import org.elasticsearch.xpack.analytics.mapper.IndexWithCount; import org.elasticsearch.xpack.exponentialhistogram.ExponentialHistogramFieldMapper; import org.elasticsearch.xpack.exponentialhistogram.ExponentialHistogramMapperPlugin; -import org.junit.Before; import java.io.IOException; import java.util.Arrays; @@ -25,15 +24,8 @@ import java.util.stream.IntStream; import java.util.stream.Stream; -import static org.elasticsearch.xpack.analytics.mapper.ExponentialHistogramParser.EXPONENTIAL_HISTOGRAM_FEATURE; - public abstract class ExponentialHistogramAggregatorTestCase extends AggregatorTestCase { - @Before - public void setup() { - assumeTrue("Only when exponential_histogram feature flag is enabled", EXPONENTIAL_HISTOGRAM_FEATURE.isEnabled()); - } - @Override protected List getSearchPlugins() { return List.of(new ExponentialHistogramMapperPlugin()); diff --git a/x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramYamlTestSuiteIT.java b/x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramYamlTestSuiteIT.java deleted file mode 100644 index 4e3c5732f2bf3..0000000000000 --- a/x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramYamlTestSuiteIT.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -package org.elasticsearch.xpack.exponentialhistogram; - -import com.carrotsearch.randomizedtesting.annotations.Name; -import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; - -import org.elasticsearch.Build; -import org.elasticsearch.test.cluster.ElasticsearchCluster; -import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate; -import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase; -import org.junit.Before; -import org.junit.ClassRule; - -public class ExponentialHistogramYamlTestSuiteIT extends ESClientYamlSuiteTestCase { - - public ExponentialHistogramYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) { - super(testCandidate); - } - - @Before - public void setup() { - // TODO: remove when FeatureFlag is removed and add minimum required version to yaml spec - assumeTrue("Only when exponential_histogram feature flag is enabled", Build.current().isSnapshot()); - } - - @ParametersFactory - public static Iterable parameters() throws Exception { - return ESClientYamlSuiteTestCase.createParameters(); - } - - @ClassRule - public static ElasticsearchCluster cluster = ElasticsearchCluster.local() - .module("x-pack-aggregate-metric") - .module("x-pack-analytics") - .module("exponential-histogram") - .module("data-streams") - .build(); - - @Override - protected String getTestRestCluster() { - return cluster.getHttpAddresses(); - } -} diff --git a/x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/resources/rest-api-spec/test/10_synthetic_source.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/exponential_histogram/10_synthetic_source.yml similarity index 98% rename from x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/resources/rest-api-spec/test/10_synthetic_source.yml rename to x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/exponential_histogram/10_synthetic_source.yml index 44215f2068a61..ef11908d967a6 100644 --- a/x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/resources/rest-api-spec/test/10_synthetic_source.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/exponential_histogram/10_synthetic_source.yml @@ -1,9 +1,7 @@ setup: - -# - skip: -# version: " - 8.12.99" -# reason: "exponential_histogram was added in 8.13" - + - requires: + cluster_features: [ "mapper.exponential_histogram_type" ] + reason: exponential_histogram field type was introduced - do: indices.create: index: test_exponential_histogram diff --git a/x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/resources/rest-api-spec/test/20_aggregations.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/exponential_histogram/20_aggregations.yml similarity index 95% rename from x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/resources/rest-api-spec/test/20_aggregations.yml rename to x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/exponential_histogram/20_aggregations.yml index 4f008220456db..e6fb8487c12f7 100644 --- a/x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/resources/rest-api-spec/test/20_aggregations.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/exponential_histogram/20_aggregations.yml @@ -1,9 +1,7 @@ setup: - -# - skip: -# version: " - 8.12.99" -# reason: "exponential_histogram was added in 8.13" - + - requires: + cluster_features: [ "mapper.exponential_histogram_type" ] + reason: exponential_histogram field type was introduced - do: indices.create: index: test_exponential_histogram diff --git a/x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/resources/rest-api-spec/test/30_aggregate_metric_aggregations_compatibility.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/exponential_histogram/30_aggregate_metric_aggregations_compatibility.yml similarity index 95% rename from x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/resources/rest-api-spec/test/30_aggregate_metric_aggregations_compatibility.yml rename to x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/exponential_histogram/30_aggregate_metric_aggregations_compatibility.yml index 02f9d44a29ad8..6f01125951aff 100644 --- a/x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/resources/rest-api-spec/test/30_aggregate_metric_aggregations_compatibility.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/exponential_histogram/30_aggregate_metric_aggregations_compatibility.yml @@ -1,4 +1,7 @@ setup: + - requires: + cluster_features: [ "mapper.exponential_histogram_type" ] + reason: exponential_histogram field type was introduced # Create an index template for the data stream with aggregate_metric_double field - do: indices.put_index_template: diff --git a/x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/resources/rest-api-spec/test/40_tdigest_histogram_aggregations_compatibility.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/exponential_histogram/40_tdigest_histogram_aggregations_compatibility.yml similarity index 95% rename from x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/resources/rest-api-spec/test/40_tdigest_histogram_aggregations_compatibility.yml rename to x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/exponential_histogram/40_tdigest_histogram_aggregations_compatibility.yml index 05666edaf3566..6b91ac9c7b052 100644 --- a/x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/resources/rest-api-spec/test/40_tdigest_histogram_aggregations_compatibility.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/exponential_histogram/40_tdigest_histogram_aggregations_compatibility.yml @@ -1,4 +1,7 @@ setup: + - requires: + cluster_features: [ "mapper.exponential_histogram_type" ] + reason: exponential_histogram field type was introduced # Create an index template for the data stream with histogram field - do: indices.put_index_template: diff --git a/x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/resources/rest-api-spec/test/50_time_series_metric.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/exponential_histogram/50_time_series_metric.yml similarity index 95% rename from x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/resources/rest-api-spec/test/50_time_series_metric.yml rename to x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/exponential_histogram/50_time_series_metric.yml index 9be756999eeeb..b53736a00672e 100644 --- a/x-pack/plugin/mapper-exponential-histogram/src/yamlRestTest/resources/rest-api-spec/test/50_time_series_metric.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/exponential_histogram/50_time_series_metric.yml @@ -1,4 +1,7 @@ -# TODO we need to add "requires capability" when the feature flag is removed +setup: + - requires: + cluster_features: [ "mapper.exponential_histogram_type" ] + reason: exponential_histogram field type was introduced --- "Create time series metric with exponential histogram": - do: