Browse Source

[DOCS] Update ES|QL applies to's (#131805) (#131989)

* 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
Liam Thompson 2 months ago
parent
commit
febd41cc76

+ 3 - 0
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**
 

+ 3 - 0
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**
 

+ 3 - 0
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**
 

+ 1 - 2
docs/reference/query-languages/esql/_snippets/functions/parameters/categorize.md

@@ -3,5 +3,4 @@
 **Parameters**
 
 `field`
-:   Expression to categorize
-
+:   Expression to categorize

+ 5 - 1
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.NodeInfo;
 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,

+ 6 - 1
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.NodeInfo;
 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,

+ 12 - 5
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.tree.Source;
 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,