Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c4fd233
Extend rate documentation
kkrik-es Sep 29, 2025
fa6421e
[CI] Auto commit changes from spotless
Sep 29, 2025
a4b69ea
add link in stats
kkrik-es Sep 29, 2025
a102b96
add link in stats
kkrik-es Sep 29, 2025
0f4be12
Merge branch 'main' into tsdb/rate-doc
kkrik-es Sep 29, 2025
c2933c3
Merge remote-tracking branch 'origin/tsdb/rate-doc' into tsdb/rate-doc
kkrik-es Sep 29, 2025
a5ed506
Merge remote-tracking branch 'origin/tsdb/rate-doc' into tsdb/rate-doc
kkrik-es Sep 29, 2025
deb086a
Update stats-by.md
kkrik-es Sep 29, 2025
4c3ca1a
fix link
kkrik-es Sep 29, 2025
54e0aee
Merge remote-tracking branch 'origin/tsdb/rate-doc' into tsdb/rate-doc
kkrik-es Sep 29, 2025
b5e327e
fix preview
kkrik-es Sep 29, 2025
fb1c4c0
[CI] Auto commit changes from spotless
Sep 29, 2025
518c322
fix preview
kkrik-es Sep 29, 2025
e16dbbf
Merge remote-tracking branch 'origin/tsdb/rate-doc' into tsdb/rate-doc
kkrik-es Sep 29, 2025
1b150e7
fix preview
kkrik-es Sep 29, 2025
5fd2e7a
fix preview
kkrik-es Sep 29, 2025
e1609f0
Apply suggestions from code review
kkrik-es Sep 30, 2025
0ad8575
Merge branch 'main' into tsdb/rate-doc
kkrik-es Sep 30, 2025
b9ecfed
update from comments
kkrik-es Sep 30, 2025
d4eadf1
mark time series aggs as preview
kkrik-es Sep 30, 2025
d43ffa3
[CI] Auto commit changes from spotless
Sep 30, 2025
86a2bd5
Update stats-by.md
kkrik-es Sep 30, 2025
9e2175b
Update docs/reference/query-languages/esql/_snippets/commands/layout/…
kkrik-es Sep 30, 2025
5d0d006
fix from comment
kkrik-es Sep 30, 2025
001ca22
gen files for rate
kkrik-es Sep 30, 2025
0af51c9
Merge branch 'main' into tsdb/rate-doc
kkrik-es Sep 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ The following [aggregation functions](/reference/query-languages/esql/functions-
:::{include} ../../lists/aggregation-functions.md
:::

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.

The following [grouping functions](/reference/query-languages/esql/functions-operators/grouping-functions.md) are supported:

:::{include} ../../lists/grouping-functions.md
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -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)

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,17 @@ 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 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.",
appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.2.0") },
preview = true,
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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading