Browse Source

[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
Liam Thompson 2 months ago
parent
commit
5d565b5fbe

+ 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 - 1
docs/reference/query-languages/esql/_snippets/functions/parameters/categorize.md

@@ -6,5 +6,5 @@
 :   Expression to categorize
 
 `options`
-:   (Optional) Categorize additional options as [function named parameters](/reference/query-languages/esql/esql-syntax.md#esql-function-named-params).
+:   (Optional) Categorize additional options as [function named parameters](/reference/query-languages/esql/esql-syntax.md#esql-function-named-params). {applies_to}`stack: ga 9.2`}
 

+ 5 - 1
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Sample.java

@@ -25,6 +25,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.FunctionUtils;
@@ -63,7 +65,9 @@ public class Sample extends AggregateFunction implements ToAggregator, PostOptim
             "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,

+ 9 - 2
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/grouping/Categorize.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.MapParam;
@@ -93,14 +95,19 @@ 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,
         @Param(name = "field", type = { "text", "keyword" }, description = "Expression to categorize") Expression field,
         @MapParam(
             name = "options",
-            description = "(Optional) Categorize additional options as <<esql-function-named-params,function named parameters>>.",
+            description = "(Optional) Categorize additional options as "
+                + "<<esql-function-named-params,function named parameters>>. "
+                + "{applies_to}`stack: ga 9.2`}",
             params = {
                 @MapParam.MapParamEntry(
                     name = ANALYZER,

+ 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,