From c4fd2334ea934362cbeae0284d752edb6fc734aa Mon Sep 17 00:00:00 2001 From: Kostas Krikellas Date: Mon, 29 Sep 2025 13:23:57 +0300 Subject: [PATCH 01/19] Extend rate documentation --- .../esql/_snippets/functions/description/rate.md | 2 +- .../esql/kibana/definition/functions/rate.json | 2 +- .../query-languages/esql/kibana/docs/functions/rate.md | 4 +++- .../xpack/esql/expression/function/aggregate/Rate.java | 8 +++++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/reference/query-languages/esql/_snippets/functions/description/rate.md b/docs/reference/query-languages/esql/_snippets/functions/description/rate.md index 0de1312951f82..d6c3f859d9a49 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/description/rate.md +++ b/docs/reference/query-languages/esql/_snippets/functions/description/rate.md @@ -2,5 +2,5 @@ **Description** -Calculates the rate of a counter field. +Calculates the per-second average rate of increase of a [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation for each time bucketing interval. Rate is the most appropriate aggregate function for counters. It is only allowed in a [STATS](/reference/query-languages/esql/commands/stats-by.md) command under a [`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series. diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/rate.json b/docs/reference/query-languages/esql/kibana/definition/functions/rate.json index 751619fb00472..870ee03413eb0 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/rate.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/rate.json @@ -2,7 +2,7 @@ "comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.", "type" : "time_series_agg", "name" : "rate", - "description" : "Calculates the rate of a counter field.", + "description" : "Calculates the per-second average rate of increase of a counter. Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation for each time bucketing interval.\n\nRate is the most appropriate aggregate function for counters. It is only allowed in a STATS command under a `TS` source command, to be properly applied per time series.", "signatures" : [ { "params" : [ diff --git a/docs/reference/query-languages/esql/kibana/docs/functions/rate.md b/docs/reference/query-languages/esql/kibana/docs/functions/rate.md index 66cbfffb695ab..795a447e305f1 100644 --- a/docs/reference/query-languages/esql/kibana/docs/functions/rate.md +++ b/docs/reference/query-languages/esql/kibana/docs/functions/rate.md @@ -1,7 +1,9 @@ % This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it. ### RATE -Calculates the rate of a counter field. +Calculates the per-second average rate of increase of a [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation for each time bucketing interval. + +Rate is the most appropriate aggregate function for counters. It is only allowed in a [STATS](https://www.elastic.co/docs/reference/query-languages/esql/commands/stats-by) command under a [`TS`](https://www.elastic.co/docs/reference/query-languages/esql/commands/ts) source command, to be properly applied per time series. ```esql TS k8s diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java index c9e4a2eb68e15..987d9e176f3c1 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java @@ -44,10 +44,16 @@ public class Rate extends TimeSeriesAggregateFunction implements OptionalArgumen @FunctionInfo( type = FunctionType.TIME_SERIES_AGGREGATE, returnType = { "double" }, - description = "Calculates the rate of a counter field.", + description = "Calculates the per-second average rate of increase of a" + + " [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). " + + "Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation" + + " for each time bucketing interval.\n\nRate is the most appropriate aggregate function for counters. It is only allowed in a " + + "[STATS](/reference/query-languages/esql/commands/stats-by.md) command under a " + + "[`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series.", appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, examples = { @Example(file = "k8s-timeseries", tag = "rate") } ) + public Rate(Source source, @Param(name = "field", type = { "counter_long", "counter_integer", "counter_double" }) Expression field) { this(source, field, new UnresolvedAttribute(source, "@timestamp")); } From fa6421ee2abdbcd5ef8553254872f5c661b7ce55 Mon Sep 17 00:00:00 2001 From: elasticsearchmachine Date: Mon, 29 Sep 2025 10:37:23 +0000 Subject: [PATCH 02/19] [CI] Auto commit changes from spotless --- .../esql/expression/function/aggregate/Rate.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java index 987d9e176f3c1..260d708fdd78d 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java @@ -44,12 +44,12 @@ public class Rate extends TimeSeriesAggregateFunction implements OptionalArgumen @FunctionInfo( type = FunctionType.TIME_SERIES_AGGREGATE, returnType = { "double" }, - description = "Calculates the per-second average rate of increase of a" + - " [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). " + - "Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation" + - " for each time bucketing interval.\n\nRate is the most appropriate aggregate function for counters. It is only allowed in a " + - "[STATS](/reference/query-languages/esql/commands/stats-by.md) command under a " + - "[`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series.", + description = "Calculates the per-second average rate of increase of a" + + " [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). " + + "Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation" + + " for each time bucketing interval.\n\nRate is the most appropriate aggregate function for counters. It is only allowed in a " + + "[STATS](/reference/query-languages/esql/commands/stats-by.md) command under a " + + "[`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series.", appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, examples = { @Example(file = "k8s-timeseries", tag = "rate") } ) From a4b69eaa5206d57c93d5b2ccf0191051e97bb704 Mon Sep 17 00:00:00 2001 From: Kostas Krikellas Date: Mon, 29 Sep 2025 16:02:22 +0300 Subject: [PATCH 03/19] add link in stats --- .../esql/_snippets/commands/layout/stats-by.md | 6 ++++++ .../xpack/esql/expression/function/aggregate/Rate.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md index 4f694b9db59d0..ade04a599903a 100644 --- a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md +++ b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md @@ -56,6 +56,12 @@ The following [grouping functions](/reference/query-languages/esql/functions-ope :::{include} ../../lists/grouping-functions.md ::: +When nested under [`TS`](/reference/query-languages/esql/commands/ts.md) source command, +time-series aggregate functions are also supported: + +:::{include} ../../lists/ts-aggregation-functions.md +::: + ::::{note} `STATS` without any groups is much much faster than adding a group. :::: diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java index 987d9e176f3c1..19f460c540e4a 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java @@ -47,7 +47,7 @@ public class Rate extends TimeSeriesAggregateFunction implements OptionalArgumen description = "Calculates the per-second average rate of increase of a" + " [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). " + "Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation" + - " for each time bucketing interval.\n\nRate is the most appropriate aggregate function for counters. It is only allowed in a " + + " for each time bucketing interval.Rate is the most appropriate aggregate function for counters. It is only allowed in a " + "[STATS](/reference/query-languages/esql/commands/stats-by.md) command under a " + "[`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series.", appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, From a102b96ff9b5ca2698e3684aa19d1e66926dc3e1 Mon Sep 17 00:00:00 2001 From: Kostas Krikellas Date: Mon, 29 Sep 2025 16:32:47 +0300 Subject: [PATCH 04/19] add link in stats --- .../esql/_snippets/functions/description/rate.md | 2 +- .../esql/kibana/definition/functions/rate.json | 2 +- .../query-languages/esql/kibana/docs/functions/rate.md | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/reference/query-languages/esql/_snippets/functions/description/rate.md b/docs/reference/query-languages/esql/_snippets/functions/description/rate.md index d6c3f859d9a49..a3db82edea1e0 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/description/rate.md +++ b/docs/reference/query-languages/esql/_snippets/functions/description/rate.md @@ -2,5 +2,5 @@ **Description** -Calculates the per-second average rate of increase of a [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation for each time bucketing interval. Rate is the most appropriate aggregate function for counters. It is only allowed in a [STATS](/reference/query-languages/esql/commands/stats-by.md) command under a [`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series. +Calculates the per-second average rate of increase of a [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation for each time bucketing interval.Rate is the most appropriate aggregate function for counters. It is only allowed in a [STATS](/reference/query-languages/esql/commands/stats-by.md) command under a [`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series. diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/rate.json b/docs/reference/query-languages/esql/kibana/definition/functions/rate.json index 870ee03413eb0..1a58fec334354 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/rate.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/rate.json @@ -2,7 +2,7 @@ "comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.", "type" : "time_series_agg", "name" : "rate", - "description" : "Calculates the per-second average rate of increase of a counter. Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation for each time bucketing interval.\n\nRate is the most appropriate aggregate function for counters. It is only allowed in a STATS command under a `TS` source command, to be properly applied per time series.", + "description" : "Calculates the per-second average rate of increase of a counter. Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation for each time bucketing interval.Rate is the most appropriate aggregate function for counters. It is only allowed in a STATS command under a `TS` source command, to be properly applied per time series.", "signatures" : [ { "params" : [ diff --git a/docs/reference/query-languages/esql/kibana/docs/functions/rate.md b/docs/reference/query-languages/esql/kibana/docs/functions/rate.md index 795a447e305f1..7e0bcd1f31ab4 100644 --- a/docs/reference/query-languages/esql/kibana/docs/functions/rate.md +++ b/docs/reference/query-languages/esql/kibana/docs/functions/rate.md @@ -1,9 +1,7 @@ % This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it. ### RATE -Calculates the per-second average rate of increase of a [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation for each time bucketing interval. - -Rate is the most appropriate aggregate function for counters. It is only allowed in a [STATS](https://www.elastic.co/docs/reference/query-languages/esql/commands/stats-by) command under a [`TS`](https://www.elastic.co/docs/reference/query-languages/esql/commands/ts) source command, to be properly applied per time series. +Calculates the per-second average rate of increase of a [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation for each time bucketing interval.Rate is the most appropriate aggregate function for counters. It is only allowed in a [STATS](https://www.elastic.co/docs/reference/query-languages/esql/commands/stats-by) command under a [`TS`](https://www.elastic.co/docs/reference/query-languages/esql/commands/ts) source command, to be properly applied per time series. ```esql TS k8s From deb086a39e70e87776b95b1159552507404c8f4e Mon Sep 17 00:00:00 2001 From: Kostas Krikellas <131142368+kkrik-es@users.noreply.github.com> Date: Mon, 29 Sep 2025 16:34:09 +0300 Subject: [PATCH 05/19] Update stats-by.md --- .../query-languages/esql/_snippets/commands/layout/stats-by.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md index ade04a599903a..894b40069c9d8 100644 --- a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md +++ b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md @@ -57,7 +57,7 @@ The following [grouping functions](/reference/query-languages/esql/functions-ope ::: When nested under [`TS`](/reference/query-languages/esql/commands/ts.md) source command, -time-series aggregate functions are also supported: +time series aggregate functions are also supported: :::{include} ../../lists/ts-aggregation-functions.md ::: From 4c3ca1a4d462fc7fb0ed9a5ec43a4b0c9e21b8d3 Mon Sep 17 00:00:00 2001 From: Kostas Krikellas Date: Mon, 29 Sep 2025 16:37:56 +0300 Subject: [PATCH 06/19] fix link --- .../query-languages/esql/_snippets/commands/layout/stats-by.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md index ade04a599903a..1812025425846 100644 --- a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md +++ b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md @@ -59,7 +59,7 @@ The following [grouping functions](/reference/query-languages/esql/functions-ope When nested under [`TS`](/reference/query-languages/esql/commands/ts.md) source command, time-series aggregate functions are also supported: -:::{include} ../../lists/ts-aggregation-functions.md +:::{include} ../../lists/time-series-aggregation-functions.md ::: ::::{note} From b5e327edc36d46b4a3357179646d4801853a096c Mon Sep 17 00:00:00 2001 From: Kostas Krikellas Date: Mon, 29 Sep 2025 16:42:31 +0300 Subject: [PATCH 07/19] fix preview --- .../time-series-aggregation-functions.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/reference/query-languages/esql/_snippets/lists/time-series-aggregation-functions.md b/docs/reference/query-languages/esql/_snippets/lists/time-series-aggregation-functions.md index 17db563e9dade..802efda2a8042 100644 --- a/docs/reference/query-languages/esql/_snippets/lists/time-series-aggregation-functions.md +++ b/docs/reference/query-languages/esql/_snippets/lists/time-series-aggregation-functions.md @@ -1,11 +1,11 @@ -* [preview] [`ABSENT_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-absent_over_time) -* [preview] [`AVG_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-avg_over_time) -* [preview] [`COUNT_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-count_over_time) -* [preview] [`COUNT_DISTINCT_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-count_distinct_over_time) -* [preview] [`FIRST_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-first_over_time) -* [preview] [`LAST_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-last_over_time) -* [preview] [`MAX_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-max_over_time) -* [preview] [`MIN_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-min_over_time) -* [preview] [`PRESENT_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-present_over_time) -* [preview] [`RATE`](../../functions-operators/time-series-aggregation-functions.md#esql-rate) -* [preview] [`SUM_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-sum_over_time) +* {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview` [`ABSENT_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-absent_over_time) +* {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview` [`AVG_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-avg_over_time) +* {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview` [`COUNT_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-count_over_time) +* {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview` [`COUNT_DISTINCT_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-count_distinct_over_time) +* {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview` [`FIRST_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-first_over_time) +* {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview` [`LAST_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-last_over_time) +* {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview` [`MAX_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-max_over_time) +* {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview` [`MIN_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-min_over_time) +* {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview` [`PRESENT_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-present_over_time) +* {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview` [`RATE`](../../functions-operators/time-series-aggregation-functions.md#esql-rate) +* {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview` [`SUM_OVER_TIME`](../../functions-operators/time-series-aggregation-functions.md#esql-sum_over_time) From fb1c4c00debb2f31c62f61955b445098238c2507 Mon Sep 17 00:00:00 2001 From: elasticsearchmachine Date: Mon, 29 Sep 2025 13:51:59 +0000 Subject: [PATCH 08/19] [CI] Auto commit changes from spotless --- .../esql/expression/function/aggregate/Rate.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java index 19f460c540e4a..4f316956d5a13 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java @@ -44,12 +44,12 @@ public class Rate extends TimeSeriesAggregateFunction implements OptionalArgumen @FunctionInfo( type = FunctionType.TIME_SERIES_AGGREGATE, returnType = { "double" }, - description = "Calculates the per-second average rate of increase of a" + - " [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). " + - "Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation" + - " for each time bucketing interval.Rate is the most appropriate aggregate function for counters. It is only allowed in a " + - "[STATS](/reference/query-languages/esql/commands/stats-by.md) command under a " + - "[`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series.", + description = "Calculates the per-second average rate of increase of a" + + " [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). " + + "Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation" + + " for each time bucketing interval.Rate is the most appropriate aggregate function for counters. It is only allowed in a " + + "[STATS](/reference/query-languages/esql/commands/stats-by.md) command under a " + + "[`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series.", appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, examples = { @Example(file = "k8s-timeseries", tag = "rate") } ) From 518c32257612032b64c71acba765e5c56cacfbbd Mon Sep 17 00:00:00 2001 From: Kostas Krikellas Date: Mon, 29 Sep 2025 16:58:42 +0300 Subject: [PATCH 09/19] fix preview --- .../query-languages/esql/_snippets/commands/layout/stats-by.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md index 00530949d0938..c38dcafc073c4 100644 --- a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md +++ b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md @@ -57,7 +57,8 @@ The following [grouping functions](/reference/query-languages/esql/functions-ope ::: When nested under [`TS`](/reference/query-languages/esql/commands/ts.md) source command, -time series aggregate functions are also supported: +[time series aggregate functions] (/reference/query-languages/esql/functions-operators/time-series-aggregation-functions.md) +are also supported: :::{include} ../../lists/time-series-aggregation-functions.md ::: From 1b150e7090594ca3c4ae5c8ce4c601adfdc620e2 Mon Sep 17 00:00:00 2001 From: Kostas Krikellas Date: Mon, 29 Sep 2025 16:59:45 +0300 Subject: [PATCH 10/19] fix preview --- .../esql/_snippets/commands/layout/stats-by.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md index c38dcafc073c4..4ffe1d90c01ca 100644 --- a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md +++ b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md @@ -51,16 +51,13 @@ The following [aggregation functions](/reference/query-languages/esql/functions- :::{include} ../../lists/aggregation-functions.md ::: -The following [grouping functions](/reference/query-languages/esql/functions-operators/grouping-functions.md) are supported: - -:::{include} ../../lists/grouping-functions.md -::: - When nested under [`TS`](/reference/query-languages/esql/commands/ts.md) source command, [time series aggregate functions] (/reference/query-languages/esql/functions-operators/time-series-aggregation-functions.md) -are also supported: +are also supported. + +The following [grouping functions](/reference/query-languages/esql/functions-operators/grouping-functions.md) are supported: -:::{include} ../../lists/time-series-aggregation-functions.md +:::{include} ../../lists/grouping-functions.md ::: ::::{note} From 5fd2e7a462161f1f1c531e3b99f51d8c59e384f7 Mon Sep 17 00:00:00 2001 From: Kostas Krikellas Date: Mon, 29 Sep 2025 17:03:28 +0300 Subject: [PATCH 11/19] fix preview --- .../esql/_snippets/commands/layout/stats-by.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md index 4ffe1d90c01ca..b2ced902b097c 100644 --- a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md +++ b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md @@ -51,8 +51,8 @@ The following [aggregation functions](/reference/query-languages/esql/functions- :::{include} ../../lists/aggregation-functions.md ::: -When nested under [`TS`](/reference/query-languages/esql/commands/ts.md) source command, -[time series aggregate functions] (/reference/query-languages/esql/functions-operators/time-series-aggregation-functions.md) +When `STATS` is nested under [`TS`](/reference/query-languages/esql/commands/ts.md) source command, +[time series aggregate functions](/reference/query-languages/esql/functions-operators/time-series-aggregation-functions.md) are also supported. The following [grouping functions](/reference/query-languages/esql/functions-operators/grouping-functions.md) are supported: From e1609f016c609f6f970fdb9bbcac900fa504bfe1 Mon Sep 17 00:00:00 2001 From: Kostas Krikellas <131142368+kkrik-es@users.noreply.github.com> Date: Tue, 30 Sep 2025 10:13:45 +0300 Subject: [PATCH 12/19] Apply suggestions from code review Co-authored-by: Liam Thompson --- .../query-languages/esql/_snippets/commands/layout/stats-by.md | 2 +- .../xpack/esql/expression/function/aggregate/Rate.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md index b2ced902b097c..a0709ec4cee52 100644 --- a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md +++ b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md @@ -51,7 +51,7 @@ The following [aggregation functions](/reference/query-languages/esql/functions- :::{include} ../../lists/aggregation-functions.md ::: -When `STATS` is nested under [`TS`](/reference/query-languages/esql/commands/ts.md) source command, +When `STATS` is nested under the [`TS`](/reference/query-languages/esql/commands/ts.md) source command, [time series aggregate functions](/reference/query-languages/esql/functions-operators/time-series-aggregation-functions.md) are also supported. diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java index 4f316956d5a13..3d2bf9066a79d 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java @@ -47,7 +47,7 @@ public class Rate extends TimeSeriesAggregateFunction implements OptionalArgumen description = "Calculates the per-second average rate of increase of a" + " [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). " + "Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation" - + " for each time bucketing interval.Rate is the most appropriate aggregate function for counters. It is only allowed in a " + + " for each time bucketing interval. Rate is the most appropriate aggregate function for counters. It is only allowed in a " + "[STATS](/reference/query-languages/esql/commands/stats-by.md) command under a " + "[`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series.", appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, From b9ecfeda8a6d13c4fb8186e4298175bc1725b679 Mon Sep 17 00:00:00 2001 From: Kostas Krikellas Date: Tue, 30 Sep 2025 10:18:18 +0300 Subject: [PATCH 13/19] update from comments --- .../esql/_snippets/functions/description/rate.md | 2 +- .../esql/kibana/definition/functions/rate.json | 2 +- .../query-languages/esql/kibana/docs/functions/rate.md | 2 +- .../xpack/esql/expression/function/aggregate/Rate.java | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/reference/query-languages/esql/_snippets/functions/description/rate.md b/docs/reference/query-languages/esql/_snippets/functions/description/rate.md index a3db82edea1e0..5ca874e1bd44c 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/description/rate.md +++ b/docs/reference/query-languages/esql/_snippets/functions/description/rate.md @@ -2,5 +2,5 @@ **Description** -Calculates the per-second average rate of increase of a [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation for each time bucketing interval.Rate is the most appropriate aggregate function for counters. It is only allowed in a [STATS](/reference/query-languages/esql/commands/stats-by.md) command under a [`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series. +Calculates the per-second average rate of increase of a [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and extrapolate values within each bucketed time interval. Rate is the most appropriate aggregate function for counters. It is only allowed in a [STATS](/reference/query-languages/esql/commands/stats-by.md) command under a [`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series. diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/rate.json b/docs/reference/query-languages/esql/kibana/definition/functions/rate.json index 1a58fec334354..c8ed332ff0b05 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/rate.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/rate.json @@ -2,7 +2,7 @@ "comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.", "type" : "time_series_agg", "name" : "rate", - "description" : "Calculates the per-second average rate of increase of a counter. Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation for each time bucketing interval.Rate is the most appropriate aggregate function for counters. It is only allowed in a STATS command under a `TS` source command, to be properly applied per time series.", + "description" : "Calculates the per-second average rate of increase of a counter. Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and extrapolate values within each bucketed time interval. Rate is the most appropriate aggregate function for counters. It is only allowed in a STATS command under a `TS` source command, to be properly applied per time series.", "signatures" : [ { "params" : [ diff --git a/docs/reference/query-languages/esql/kibana/docs/functions/rate.md b/docs/reference/query-languages/esql/kibana/docs/functions/rate.md index 7e0bcd1f31ab4..85f85ad5a2af3 100644 --- a/docs/reference/query-languages/esql/kibana/docs/functions/rate.md +++ b/docs/reference/query-languages/esql/kibana/docs/functions/rate.md @@ -1,7 +1,7 @@ % This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it. ### RATE -Calculates the per-second average rate of increase of a [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation for each time bucketing interval.Rate is the most appropriate aggregate function for counters. It is only allowed in a [STATS](https://www.elastic.co/docs/reference/query-languages/esql/commands/stats-by) command under a [`TS`](https://www.elastic.co/docs/reference/query-languages/esql/commands/ts) source command, to be properly applied per time series. +Calculates the per-second average rate of increase of a [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and extrapolate values within each bucketed time interval. Rate is the most appropriate aggregate function for counters. It is only allowed in a [STATS](https://www.elastic.co/docs/reference/query-languages/esql/commands/stats-by) command under a [`TS`](https://www.elastic.co/docs/reference/query-languages/esql/commands/ts) source command, to be properly applied per time series. ```esql TS k8s diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java index 3d2bf9066a79d..3b9ea6400e6b9 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java @@ -46,9 +46,9 @@ public class Rate extends TimeSeriesAggregateFunction implements OptionalArgumen returnType = { "double" }, description = "Calculates the per-second average rate of increase of a" + " [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). " - + "Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and use extrapolation" - + " for each time bucketing interval. Rate is the most appropriate aggregate function for counters. It is only allowed in a " - + "[STATS](/reference/query-languages/esql/commands/stats-by.md) command under a " + + "Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and extrapolate " + + "values within each bucketed time interval. Rate is the most appropriate aggregate function for counters. It is only allowed " + + "in a [STATS](/reference/query-languages/esql/commands/stats-by.md) command under a " + "[`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series.", appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, examples = { @Example(file = "k8s-timeseries", tag = "rate") } From d4eadf174a238d78a158ad39dfc74b1138777243 Mon Sep 17 00:00:00 2001 From: Kostas Krikellas Date: Tue, 30 Sep 2025 10:28:24 +0300 Subject: [PATCH 14/19] mark time series aggs as preview --- .../esql/_snippets/functions/layout/absent_over_time.md | 1 + .../esql/_snippets/functions/layout/avg_over_time.md | 1 + .../_snippets/functions/layout/count_distinct_over_time.md | 1 + .../esql/_snippets/functions/layout/count_over_time.md | 1 + .../esql/_snippets/functions/layout/first_over_time.md | 1 + .../esql/_snippets/functions/layout/last_over_time.md | 1 + .../esql/_snippets/functions/layout/max_over_time.md | 1 + .../esql/_snippets/functions/layout/min_over_time.md | 1 + .../esql/_snippets/functions/layout/present_over_time.md | 1 + .../query-languages/esql/_snippets/functions/layout/rate.md | 1 + .../esql/_snippets/functions/layout/sum_over_time.md | 1 + .../esql/kibana/definition/functions/absent_over_time.json | 2 +- .../esql/kibana/definition/functions/avg_over_time.json | 2 +- .../kibana/definition/functions/count_distinct_over_time.json | 2 +- .../esql/kibana/definition/functions/count_over_time.json | 2 +- .../esql/kibana/definition/functions/first_over_time.json | 2 +- .../esql/kibana/definition/functions/last_over_time.json | 2 +- .../esql/kibana/definition/functions/max_over_time.json | 2 +- .../esql/kibana/definition/functions/min_over_time.json | 2 +- .../esql/kibana/definition/functions/present_over_time.json | 2 +- .../query-languages/esql/kibana/definition/functions/rate.json | 2 +- .../esql/kibana/definition/functions/sum_over_time.json | 2 +- .../esql/expression/function/aggregate/AbsentOverTime.java | 1 + .../xpack/esql/expression/function/aggregate/AvgOverTime.java | 1 + .../expression/function/aggregate/CountDistinctOverTime.java | 1 + .../esql/expression/function/aggregate/CountOverTime.java | 1 + .../xpack/esql/expression/function/aggregate/Delta.java | 3 ++- .../esql/expression/function/aggregate/FirstOverTime.java | 1 + .../xpack/esql/expression/function/aggregate/Idelta.java | 3 ++- .../xpack/esql/expression/function/aggregate/Increase.java | 3 ++- .../xpack/esql/expression/function/aggregate/Irate.java | 1 + .../xpack/esql/expression/function/aggregate/LastOverTime.java | 1 + .../xpack/esql/expression/function/aggregate/MaxOverTime.java | 1 + .../xpack/esql/expression/function/aggregate/MinOverTime.java | 1 + .../esql/expression/function/aggregate/PresentOverTime.java | 1 + .../xpack/esql/expression/function/aggregate/Rate.java | 1 + .../xpack/esql/expression/function/aggregate/SumOverTime.java | 1 + 37 files changed, 40 insertions(+), 14 deletions(-) diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/absent_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/layout/absent_over_time.md index 38d6822dab0b6..cd13f23decfc4 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/layout/absent_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/layout/absent_over_time.md @@ -3,6 +3,7 @@ ## `ABSENT_OVER_TIME` [esql-absent_over_time] ```{applies_to} stack: preview 9.2.0 +serverless: preview ``` **Syntax** diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/avg_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/layout/avg_over_time.md index 88acfef1f7f5d..f01a5a76fd27b 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/layout/avg_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/layout/avg_over_time.md @@ -3,6 +3,7 @@ ## `AVG_OVER_TIME` [esql-avg_over_time] ```{applies_to} stack: preview 9.2.0 +serverless: preview ``` **Syntax** diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/count_distinct_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/layout/count_distinct_over_time.md index 2bc1e286cab68..2d1c0f5e0384d 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/layout/count_distinct_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/layout/count_distinct_over_time.md @@ -3,6 +3,7 @@ ## `COUNT_DISTINCT_OVER_TIME` [esql-count_distinct_over_time] ```{applies_to} stack: preview 9.2.0 +serverless: preview ``` **Syntax** diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/count_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/layout/count_over_time.md index 292dff0e10e06..3040e7c0f596a 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/layout/count_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/layout/count_over_time.md @@ -3,6 +3,7 @@ ## `COUNT_OVER_TIME` [esql-count_over_time] ```{applies_to} stack: preview 9.2.0 +serverless: preview ``` **Syntax** diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/first_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/layout/first_over_time.md index 50462fef0d1ab..e77911f4b7627 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/layout/first_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/layout/first_over_time.md @@ -3,6 +3,7 @@ ## `FIRST_OVER_TIME` [esql-first_over_time] ```{applies_to} stack: preview 9.2.0 +serverless: preview ``` **Syntax** diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/last_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/layout/last_over_time.md index 0fdb3f6c06912..1a0a2251e17de 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/layout/last_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/layout/last_over_time.md @@ -3,6 +3,7 @@ ## `LAST_OVER_TIME` [esql-last_over_time] ```{applies_to} stack: preview 9.2.0 +serverless: preview ``` **Syntax** diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/max_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/layout/max_over_time.md index 4d0732a26cded..0cec101fd928b 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/layout/max_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/layout/max_over_time.md @@ -3,6 +3,7 @@ ## `MAX_OVER_TIME` [esql-max_over_time] ```{applies_to} stack: preview 9.2.0 +serverless: preview ``` **Syntax** diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/min_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/layout/min_over_time.md index 3644fde260d58..3a9e14fd8901b 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/layout/min_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/layout/min_over_time.md @@ -3,6 +3,7 @@ ## `MIN_OVER_TIME` [esql-min_over_time] ```{applies_to} stack: preview 9.2.0 +serverless: preview ``` **Syntax** diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/present_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/layout/present_over_time.md index 04fb44bc9f672..d7f35b92b46b8 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/layout/present_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/layout/present_over_time.md @@ -3,6 +3,7 @@ ## `PRESENT_OVER_TIME` [esql-present_over_time] ```{applies_to} stack: preview 9.2.0 +serverless: preview ``` **Syntax** diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/rate.md b/docs/reference/query-languages/esql/_snippets/functions/layout/rate.md index fc62158b7213a..f27eddd78521b 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/layout/rate.md +++ b/docs/reference/query-languages/esql/_snippets/functions/layout/rate.md @@ -3,6 +3,7 @@ ## `RATE` [esql-rate] ```{applies_to} stack: preview 9.2.0 +serverless: preview ``` **Syntax** diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/sum_over_time.md b/docs/reference/query-languages/esql/_snippets/functions/layout/sum_over_time.md index 647ff06f7181e..db9dd9936f0bf 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/layout/sum_over_time.md +++ b/docs/reference/query-languages/esql/_snippets/functions/layout/sum_over_time.md @@ -3,6 +3,7 @@ ## `SUM_OVER_TIME` [esql-sum_over_time] ```{applies_to} stack: preview 9.2.0 +serverless: preview ``` **Syntax** 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 879918c653dda..52f43004884ae 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 @@ -224,6 +224,6 @@ "examples" : [ "TS k8s\n| WHERE cluster == \"prod\" AND pod == \"two\"\n| STATS events_received = max(absent_over_time(events_received)) BY pod, time_bucket = tbucket(2 minute)" ], - "preview" : false, + "preview" : true, "snapshot_only" : false } 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 5f449bb6459f5..71c81f9e6713b 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 @@ -44,6 +44,6 @@ "examples" : [ "TS k8s\n| STATS max_cost=max(avg_over_time(network.cost)) BY cluster, time_bucket = bucket(@timestamp,1minute)" ], - "preview" : false, + "preview" : true, "snapshot_only" : false } diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/count_distinct_over_time.json b/docs/reference/query-languages/esql/kibana/definition/functions/count_distinct_over_time.json index fd994aa15537e..0d3204f99270b 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/count_distinct_over_time.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/count_distinct_over_time.json @@ -668,6 +668,6 @@ "examples" : [ "TS k8s\n| STATS distincts=count_distinct(count_distinct_over_time(network.cost)),\n distincts_imprecise=count_distinct(count_distinct_over_time(network.cost, 100))\n BY cluster, time_bucket = bucket(@timestamp,1minute)" ], - "preview" : false, + "preview" : true, "snapshot_only" : false } diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/count_over_time.json b/docs/reference/query-languages/esql/kibana/definition/functions/count_over_time.json index efdc885ee1265..219ebe563b2c2 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/count_over_time.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/count_over_time.json @@ -224,6 +224,6 @@ "examples" : [ "TS k8s\n| STATS count=count(count_over_time(network.cost))\n BY cluster, time_bucket = bucket(@timestamp,1minute)" ], - "preview" : false, + "preview" : true, "snapshot_only" : false } 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 052b2a65e223c..e2cc52285e8e9 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 @@ -44,6 +44,6 @@ "examples" : [ "TS k8s\n| STATS max_cost=max(first_over_time(network.cost)) BY cluster, time_bucket = bucket(@timestamp,1minute)" ], - "preview" : false, + "preview" : true, "snapshot_only" : false } 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 0c732d51ea66b..48f96880e0001 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 @@ -44,6 +44,6 @@ "examples" : [ "TS k8s\n| STATS max_cost=max(last_over_time(network.cost)) BY cluster, time_bucket = bucket(@timestamp,1minute)" ], - "preview" : false, + "preview" : true, "snapshot_only" : false } 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 340e6543a4e3f..b55684e8094e4 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 @@ -140,6 +140,6 @@ "examples" : [ "TS k8s\n| STATS cost=sum(max_over_time(network.cost)) BY cluster, time_bucket = bucket(@timestamp,1minute)" ], - "preview" : false, + "preview" : true, "snapshot_only" : false } 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 ab34295c27765..8bc00fd660299 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 @@ -140,6 +140,6 @@ "examples" : [ "TS k8s\n| STATS cost=sum(min_over_time(network.cost)) BY cluster, time_bucket = bucket(@timestamp,1minute)" ], - "preview" : false, + "preview" : true, "snapshot_only" : false } 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 87a66d4a49ef5..844663d378495 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 @@ -224,6 +224,6 @@ "examples" : [ "TS k8s\n| WHERE cluster == \"prod\" AND pod == \"two\"\n| STATS events_received = max(present_over_time(events_received)) BY pod, time_bucket = tbucket(2 minute)" ], - "preview" : false, + "preview" : true, "snapshot_only" : false } diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/rate.json b/docs/reference/query-languages/esql/kibana/definition/functions/rate.json index c8ed332ff0b05..10102a746f8cc 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/rate.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/rate.json @@ -44,6 +44,6 @@ "examples" : [ "TS k8s\n| STATS max(rate(network.total_bytes_in)) BY time_bucket = bucket(@timestamp,5minute)" ], - "preview" : false, + "preview" : true, "snapshot_only" : false } 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 2888b2caded55..85cec3677bc31 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 @@ -44,6 +44,6 @@ "examples" : [ "TS k8s\n| STATS sum_cost=sum(sum_over_time(network.cost)) BY cluster, time_bucket = bucket(@timestamp,1minute)" ], - "preview" : false, + "preview" : true, "snapshot_only" : false } diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AbsentOverTime.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AbsentOverTime.java index bc0e6eff72ec3..072d98a461855 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AbsentOverTime.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AbsentOverTime.java @@ -41,6 +41,7 @@ public class AbsentOverTime extends TimeSeriesAggregateFunction { returnType = { "boolean" }, description = "Calculates the absence of a field in the output result over time range.", appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, + preview = true, examples = { @Example(file = "k8s-timeseries", tag = "absent_over_time") } ) public AbsentOverTime( diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AvgOverTime.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AvgOverTime.java index b1c92c3f6dafd..bfe68696e5806 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AvgOverTime.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AvgOverTime.java @@ -43,6 +43,7 @@ public class AvgOverTime extends TimeSeriesAggregateFunction implements Surrogat description = "Calculates the average over time of a numeric field.", type = FunctionType.TIME_SERIES_AGGREGATE, appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, + preview = true, examples = { @Example(file = "k8s-timeseries", tag = "avg_over_time") } ) public AvgOverTime( diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/CountDistinctOverTime.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/CountDistinctOverTime.java index f1cce3c144f4f..2396e4e69bad8 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/CountDistinctOverTime.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/CountDistinctOverTime.java @@ -42,6 +42,7 @@ public class CountDistinctOverTime extends TimeSeriesAggregateFunction implement returnType = { "long" }, description = "Calculates the count of distinct values over time for a field.", appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, + preview = true, examples = { @Example(file = "k8s-timeseries", tag = "count_distinct_over_time") } ) public CountDistinctOverTime( diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/CountOverTime.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/CountOverTime.java index c392e7438620b..0d75c1f082f74 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/CountOverTime.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/CountOverTime.java @@ -41,6 +41,7 @@ public class CountOverTime extends TimeSeriesAggregateFunction { returnType = { "long" }, description = "Calculates the count over time value of a field.", appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, + preview = true, examples = { @Example(file = "k8s-timeseries", tag = "count_over_time") } ) public CountOverTime( diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Delta.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Delta.java index 4e1ae09f936e8..a38449b5ef18c 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Delta.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Delta.java @@ -45,7 +45,8 @@ public class Delta extends TimeSeriesAggregateFunction implements OptionalArgume type = FunctionType.TIME_SERIES_AGGREGATE, returnType = { "double" }, description = "Calculates the absolute change of a gauge field in a time window.", - appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.UNAVAILABLE) }, + appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0" ) }, + preview = true, note = "Available with the [TS](/reference/query-languages/esql/commands/source-commands.md#esql-ts) command" ) public Delta(Source source, @Param(name = "field", type = { "long", "integer", "double" }) Expression field) { diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/FirstOverTime.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/FirstOverTime.java index 908d4bd97cc32..ca76d521142c7 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/FirstOverTime.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/FirstOverTime.java @@ -53,6 +53,7 @@ public class FirstOverTime extends TimeSeriesAggregateFunction implements Option returnType = { "long", "integer", "double" }, description = "Calculates the earliest value of a field, where recency determined by the `@timestamp` field.", appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, + preview = true, examples = { @Example(file = "k8s-timeseries", tag = "first_over_time") } ) public FirstOverTime(Source source, @Param(name = "field", type = { "long", "integer", "double" }) Expression field) { diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Idelta.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Idelta.java index 0553a265b0572..bfd70f17df693 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Idelta.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Idelta.java @@ -47,7 +47,8 @@ public class Idelta extends TimeSeriesAggregateFunction implements OptionalArgum description = "Calculates the idelta of a gauge. idelta is the absolute change between the last two data points (" + "it ignores all but the last two data points in each time period). " + "This function is very similar to delta, but is more responsive to recent changes.", - appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") } + appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, + preview = true ) public Idelta(Source source, @Param(name = "field", type = { "long", "integer", "double" }) Expression field) { this(source, field, new UnresolvedAttribute(source, "@timestamp")); diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Increase.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Increase.java index e490ffad181ec..cfdb3123685b6 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Increase.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Increase.java @@ -50,7 +50,8 @@ public class Increase extends TimeSeriesAggregateFunction implements OptionalArg type = FunctionType.TIME_SERIES_AGGREGATE, returnType = { "double" }, description = "Calculates the absolute increase of a counter field in a time window.", - appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") } + appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, + preview = true ) public Increase( Source source, diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Irate.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Irate.java index 2195e814e9d4a..3705b3e0a496f 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Irate.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Irate.java @@ -48,6 +48,7 @@ public class Irate extends TimeSeriesAggregateFunction implements OptionalArgume + "it ignores all but the last two data points in each time period). " + "This function is very similar to rate, but is more responsive to recent changes in the rate of increase.", appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, + preview = true, examples = { @Example(file = "k8s-timeseries", tag = "irate") } ) public Irate(Source source, @Param(name = "field", type = { "counter_long", "counter_integer", "counter_double" }) Expression field) { diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/LastOverTime.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/LastOverTime.java index 07c7dc988dcba..ccb9695339891 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/LastOverTime.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/LastOverTime.java @@ -54,6 +54,7 @@ public class LastOverTime extends TimeSeriesAggregateFunction implements Optiona returnType = { "long", "integer", "double", "_tsid" }, description = "Calculates the latest value of a field, where recency determined by the `@timestamp` field.", appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, + preview = true, examples = { @Example(file = "k8s-timeseries", tag = "last_over_time") } ) public LastOverTime(Source source, @Param(name = "field", type = { "long", "integer", "double", "_tsid" }) Expression field) { diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/MaxOverTime.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/MaxOverTime.java index 5550d8709aaeb..2bc011eecfc36 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/MaxOverTime.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/MaxOverTime.java @@ -41,6 +41,7 @@ public class MaxOverTime extends TimeSeriesAggregateFunction { description = "Calculates the maximum over time value of a field.", type = FunctionType.TIME_SERIES_AGGREGATE, appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, + preview = true, examples = { @Example(file = "k8s-timeseries", tag = "max_over_time") } ) public MaxOverTime( diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/MinOverTime.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/MinOverTime.java index 56d3f66239c93..3258688cb1844 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/MinOverTime.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/MinOverTime.java @@ -41,6 +41,7 @@ public class MinOverTime extends TimeSeriesAggregateFunction { description = "Calculates the minimum over time value of a field.", type = FunctionType.TIME_SERIES_AGGREGATE, appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, + preview = true, examples = { @Example(file = "k8s-timeseries", tag = "min_over_time") } ) public MinOverTime( diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/PresentOverTime.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/PresentOverTime.java index d27d172ae6dfc..805a4b09d6da5 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/PresentOverTime.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/PresentOverTime.java @@ -41,6 +41,7 @@ public class PresentOverTime extends TimeSeriesAggregateFunction { returnType = { "boolean" }, description = "Calculates the presence of a field in the output result over time range.", appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, + preview = true, examples = { @Example(file = "k8s-timeseries", tag = "present_over_time") } ) public PresentOverTime( diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java index 3b9ea6400e6b9..adf3f84a11851 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java @@ -51,6 +51,7 @@ public class Rate extends TimeSeriesAggregateFunction implements OptionalArgumen + "in a [STATS](/reference/query-languages/esql/commands/stats-by.md) command under a " + "[`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series.", appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, + preview = true, examples = { @Example(file = "k8s-timeseries", tag = "rate") } ) diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/SumOverTime.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/SumOverTime.java index 14b125e6c7b87..c8968a63b38dd 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/SumOverTime.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/SumOverTime.java @@ -41,6 +41,7 @@ public class SumOverTime extends TimeSeriesAggregateFunction { description = "Calculates the sum over time value of a field.", type = FunctionType.TIME_SERIES_AGGREGATE, appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, + preview = true, examples = { @Example(file = "k8s-timeseries", tag = "sum_over_time") } ) public SumOverTime( From d43ffa33851afa4ed8afbfd8130eba54dbf32c59 Mon Sep 17 00:00:00 2001 From: elasticsearchmachine Date: Tue, 30 Sep 2025 07:35:10 +0000 Subject: [PATCH 15/19] [CI] Auto commit changes from spotless --- .../xpack/esql/expression/function/aggregate/Delta.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Delta.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Delta.java index a38449b5ef18c..d6455990299a4 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Delta.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Delta.java @@ -45,7 +45,7 @@ public class Delta extends TimeSeriesAggregateFunction implements OptionalArgume type = FunctionType.TIME_SERIES_AGGREGATE, returnType = { "double" }, description = "Calculates the absolute change of a gauge field in a time window.", - appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0" ) }, + appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") }, preview = true, note = "Available with the [TS](/reference/query-languages/esql/commands/source-commands.md#esql-ts) command" ) From 86a2bd5c13f658169853275c2900966cd8760616 Mon Sep 17 00:00:00 2001 From: Kostas Krikellas <131142368+kkrik-es@users.noreply.github.com> Date: Tue, 30 Sep 2025 10:48:27 +0300 Subject: [PATCH 16/19] Update stats-by.md --- .../query-languages/esql/_snippets/commands/layout/stats-by.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md index a0709ec4cee52..b85c919dcd6b3 100644 --- a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md +++ b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md @@ -52,7 +52,7 @@ The following [aggregation functions](/reference/query-languages/esql/functions- ::: When `STATS` is nested under the [`TS`](/reference/query-languages/esql/commands/ts.md) source command, -[time series aggregate functions](/reference/query-languages/esql/functions-operators/time-series-aggregation-functions.md) +[time series aggregation functions](/reference/query-languages/esql/functions-operators/time-series-aggregation-functions.md) are also supported. The following [grouping functions](/reference/query-languages/esql/functions-operators/grouping-functions.md) are supported: From 9e2175b998703cb99a3c0d9b9ed76c20808aa10f Mon Sep 17 00:00:00 2001 From: Kostas Krikellas <131142368+kkrik-es@users.noreply.github.com> Date: Tue, 30 Sep 2025 12:06:22 +0300 Subject: [PATCH 17/19] Update docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md Co-authored-by: Felix Barnsteiner --- .../query-languages/esql/_snippets/commands/layout/stats-by.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md index b85c919dcd6b3..89fcd89a4dff9 100644 --- a/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md +++ b/docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md @@ -51,7 +51,7 @@ The following [aggregation functions](/reference/query-languages/esql/functions- :::{include} ../../lists/aggregation-functions.md ::: -When `STATS` is nested under the [`TS`](/reference/query-languages/esql/commands/ts.md) source command, +When `STATS` is used under the [`TS`](/reference/query-languages/esql/commands/ts.md) source command, [time series aggregation functions](/reference/query-languages/esql/functions-operators/time-series-aggregation-functions.md) are also supported. From 5d0d00630bda66d2cb88d2538bb961799fe7fac2 Mon Sep 17 00:00:00 2001 From: Kostas Krikellas Date: Tue, 30 Sep 2025 12:09:46 +0300 Subject: [PATCH 18/19] fix from comment --- .../xpack/esql/expression/function/aggregate/Rate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java index adf3f84a11851..a3406959931be 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Rate.java @@ -46,7 +46,7 @@ public class Rate extends TimeSeriesAggregateFunction implements OptionalArgumen returnType = { "double" }, description = "Calculates the per-second average rate of increase of a" + " [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). " - + "Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and extrapolate " + + "Rate calculations account for breaks in monotonicity, such as counter resets when a service restarts, and extrapolate " + "values within each bucketed time interval. Rate is the most appropriate aggregate function for counters. It is only allowed " + "in a [STATS](/reference/query-languages/esql/commands/stats-by.md) command under a " + "[`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series.", From 001ca22e16830ea08d9147654690b7d82c7d1f06 Mon Sep 17 00:00:00 2001 From: Kostas Krikellas Date: Tue, 30 Sep 2025 13:03:56 +0300 Subject: [PATCH 19/19] gen files for rate --- .../esql/_snippets/functions/description/rate.md | 2 +- .../query-languages/esql/kibana/definition/functions/rate.json | 2 +- .../query-languages/esql/kibana/docs/functions/rate.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/reference/query-languages/esql/_snippets/functions/description/rate.md b/docs/reference/query-languages/esql/_snippets/functions/description/rate.md index 5ca874e1bd44c..25471c866493c 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/description/rate.md +++ b/docs/reference/query-languages/esql/_snippets/functions/description/rate.md @@ -2,5 +2,5 @@ **Description** -Calculates the per-second average rate of increase of a [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and extrapolate values within each bucketed time interval. Rate is the most appropriate aggregate function for counters. It is only allowed in a [STATS](/reference/query-languages/esql/commands/stats-by.md) command under a [`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series. +Calculates the per-second average rate of increase of a [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). Rate calculations account for breaks in monotonicity, such as counter resets when a service restarts, and extrapolate values within each bucketed time interval. Rate is the most appropriate aggregate function for counters. It is only allowed in a [STATS](/reference/query-languages/esql/commands/stats-by.md) command under a [`TS`](/reference/query-languages/esql/commands/ts.md) source command, to be properly applied per time series. diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/rate.json b/docs/reference/query-languages/esql/kibana/definition/functions/rate.json index 10102a746f8cc..9468b7f113ec4 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/rate.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/rate.json @@ -2,7 +2,7 @@ "comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.", "type" : "time_series_agg", "name" : "rate", - "description" : "Calculates the per-second average rate of increase of a counter. Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and extrapolate values within each bucketed time interval. Rate is the most appropriate aggregate function for counters. It is only allowed in a STATS command under a `TS` source command, to be properly applied per time series.", + "description" : "Calculates the per-second average rate of increase of a counter. Rate calculations account for breaks in monotonicity, such as counter resets when a service restarts, and extrapolate values within each bucketed time interval. Rate is the most appropriate aggregate function for counters. It is only allowed in a STATS command under a `TS` source command, to be properly applied per time series.", "signatures" : [ { "params" : [ diff --git a/docs/reference/query-languages/esql/kibana/docs/functions/rate.md b/docs/reference/query-languages/esql/kibana/docs/functions/rate.md index 85f85ad5a2af3..bf8504018d01b 100644 --- a/docs/reference/query-languages/esql/kibana/docs/functions/rate.md +++ b/docs/reference/query-languages/esql/kibana/docs/functions/rate.md @@ -1,7 +1,7 @@ % This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it. ### RATE -Calculates the per-second average rate of increase of a [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). Rate calculations account for changes in monotonicity, such as counter resets when a service restarts, and extrapolate values within each bucketed time interval. Rate is the most appropriate aggregate function for counters. It is only allowed in a [STATS](https://www.elastic.co/docs/reference/query-languages/esql/commands/stats-by) command under a [`TS`](https://www.elastic.co/docs/reference/query-languages/esql/commands/ts) source command, to be properly applied per time series. +Calculates the per-second average rate of increase of a [counter](docs-content://manage-data/data-store/data-streams/time-series-data-stream-tsds.md#time-series-metric). Rate calculations account for breaks in monotonicity, such as counter resets when a service restarts, and extrapolate values within each bucketed time interval. Rate is the most appropriate aggregate function for counters. It is only allowed in a [STATS](https://www.elastic.co/docs/reference/query-languages/esql/commands/stats-by) command under a [`TS`](https://www.elastic.co/docs/reference/query-languages/esql/commands/ts) source command, to be properly applied per time series. ```esql TS k8s