From cc30c5ba6df032539248be646df50fc7dda9994a Mon Sep 17 00:00:00 2001 From: Liam Thompson Date: Mon, 28 Jul 2025 09:31:55 +0200 Subject: [PATCH] [DOCS] Update ES|QL applies to's (#131805) * Add applies to to ScalB function in https://github.com/elastic/elasticsearch/pull/127696 * Add applies_to to categorize, follow up to https://github.com/elastic/elasticsearch/pull/129398/ * Add version info, following https://github.com/elastic/elasticsearch/pull/127629 * SAMPLE is new + GA in 9.1 https://github.com/elastic/elasticsearch/pull/127629 * add applies to for 9.2 option (cherry picked from commit 5d565b5fbeff5356f3d36ebc351be2ec9e58a869) # Conflicts: # docs/reference/query-languages/esql/_snippets/functions/parameters/categorize.md # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/grouping/Categorize.java --- .../_snippets/functions/layout/categorize.md | 3 +++ .../esql/_snippets/functions/layout/sample.md | 3 +++ .../esql/_snippets/functions/layout/scalb.md | 3 +++ .../functions/parameters/categorize.md | 3 +-- .../expression/function/aggregate/Sample.java | 6 +++++- .../function/grouping/Categorize.java | 7 ++++++- .../expression/function/scalar/math/Scalb.java | 17 ++++++++++++----- 7 files changed, 33 insertions(+), 9 deletions(-) diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/categorize.md b/docs/reference/query-languages/esql/_snippets/functions/layout/categorize.md index ca23c1e2efc23..6667980ef84eb 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/layout/categorize.md +++ b/docs/reference/query-languages/esql/_snippets/functions/layout/categorize.md @@ -1,6 +1,9 @@ % This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it. ## `CATEGORIZE` [esql-categorize] +```{applies_to} +stack: preview 9.0, ga 9.1 +``` **Syntax** diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/sample.md b/docs/reference/query-languages/esql/_snippets/functions/layout/sample.md index 05d8cef498116..9fd348abe8cd9 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/layout/sample.md +++ b/docs/reference/query-languages/esql/_snippets/functions/layout/sample.md @@ -1,6 +1,9 @@ % This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it. ## `SAMPLE` [esql-sample] +```{applies_to} +stack: ga 9.1.0 +``` **Syntax** diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/scalb.md b/docs/reference/query-languages/esql/_snippets/functions/layout/scalb.md index 19ff3246f4ca1..bae02950efa6c 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/layout/scalb.md +++ b/docs/reference/query-languages/esql/_snippets/functions/layout/scalb.md @@ -1,6 +1,9 @@ % This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it. ## `SCALB` [esql-scalb] +```{applies_to} +stack: ga 9.1.0 +``` **Syntax** diff --git a/docs/reference/query-languages/esql/_snippets/functions/parameters/categorize.md b/docs/reference/query-languages/esql/_snippets/functions/parameters/categorize.md index 8733908754570..455abff36ba63 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/parameters/categorize.md +++ b/docs/reference/query-languages/esql/_snippets/functions/parameters/categorize.md @@ -3,5 +3,4 @@ **Parameters** `field` -: Expression to categorize - +: Expression to categorize \ No newline at end of file diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Sample.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Sample.java index 781f9ad67c05c..030b4c08f8c15 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Sample.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Sample.java @@ -24,6 +24,8 @@ import org.elasticsearch.xpack.esql.core.tree.Source; import org.elasticsearch.xpack.esql.core.type.DataType; import org.elasticsearch.xpack.esql.expression.function.Example; +import org.elasticsearch.xpack.esql.expression.function.FunctionAppliesTo; +import org.elasticsearch.xpack.esql.expression.function.FunctionAppliesToLifecycle; import org.elasticsearch.xpack.esql.expression.function.FunctionInfo; import org.elasticsearch.xpack.esql.expression.function.FunctionType; import org.elasticsearch.xpack.esql.expression.function.Param; @@ -59,7 +61,9 @@ public class Sample extends AggregateFunction implements ToAggregator { "version" }, description = "Collects sample values for a field.", type = FunctionType.AGGREGATE, - examples = @Example(file = "stats_sample", tag = "doc") + examples = @Example(file = "stats_sample", tag = "doc"), + appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.GA, version = "9.1.0") } + ) public Sample( Source source, diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/grouping/Categorize.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/grouping/Categorize.java index 81ac52cad151d..570410c7a11c2 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/grouping/Categorize.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/grouping/Categorize.java @@ -18,6 +18,8 @@ import org.elasticsearch.xpack.esql.core.tree.Source; import org.elasticsearch.xpack.esql.core.type.DataType; import org.elasticsearch.xpack.esql.expression.function.Example; +import org.elasticsearch.xpack.esql.expression.function.FunctionAppliesTo; +import org.elasticsearch.xpack.esql.expression.function.FunctionAppliesToLifecycle; import org.elasticsearch.xpack.esql.expression.function.FunctionInfo; import org.elasticsearch.xpack.esql.expression.function.FunctionType; import org.elasticsearch.xpack.esql.expression.function.Param; @@ -63,7 +65,10 @@ public class Categorize extends GroupingFunction.NonEvaluatableGroupingFunction tag = "docsCategorize", description = "This example categorizes server logs messages into categories and aggregates their counts. " ) }, - type = FunctionType.GROUPING + type = FunctionType.GROUPING, + appliesTo = { + @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.0"), + @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.GA, version = "9.1") } ) public Categorize( Source source, diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/Scalb.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/Scalb.java index b23b2323d0498..ff07e1c71a4c6 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/Scalb.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/Scalb.java @@ -20,6 +20,8 @@ import org.elasticsearch.xpack.esql.core.type.DataType; import org.elasticsearch.xpack.esql.core.util.NumericUtils; import org.elasticsearch.xpack.esql.expression.function.Example; +import org.elasticsearch.xpack.esql.expression.function.FunctionAppliesTo; +import org.elasticsearch.xpack.esql.expression.function.FunctionAppliesToLifecycle; import org.elasticsearch.xpack.esql.expression.function.FunctionInfo; import org.elasticsearch.xpack.esql.expression.function.Param; import org.elasticsearch.xpack.esql.expression.function.scalar.EsqlScalarFunction; @@ -40,11 +42,16 @@ public class Scalb extends EsqlScalarFunction { private final Expression d; private final Expression scaleFactor; - @FunctionInfo(returnType = "double", description = """ - Returns the result of `d * 2 ^ scaleFactor`, - Similar to Java's `scalb` function. Result is rounded as if - performed by a single correctly rounded floating-point multiply - to a member of the double value set.""", examples = @Example(file = "floats", tag = "scalb")) + @FunctionInfo( + returnType = "double", + description = """ + Returns the result of `d * 2 ^ scaleFactor`, + Similar to Java's `scalb` function. Result is rounded as if + performed by a single correctly rounded floating-point multiply + to a member of the double value set.""", + examples = @Example(file = "floats", tag = "scalb"), + appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.GA, version = "9.1.0") } + ) public Scalb( Source source,