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 f9d782d304bfa..53b9e2f09ae49 100644
--- a/docs/reference/query-languages/esql/_snippets/functions/layout/categorize.md
+++ b/docs/reference/query-languages/esql/_snippets/functions/layout/categorize.md
@@ -7,6 +7,7 @@ may be changed or removed in a future release. Elastic will work to fix any issu
are not subject to the support SLA of official GA features.
:::
+
**Syntax**
:::{image} ../../../images/functions/categorize.svg
diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/kql.md b/docs/reference/query-languages/esql/_snippets/functions/layout/kql.md
index b9adaac7f3e50..04c50cfded194 100644
--- a/docs/reference/query-languages/esql/_snippets/functions/layout/kql.md
+++ b/docs/reference/query-languages/esql/_snippets/functions/layout/kql.md
@@ -7,6 +7,7 @@ may be changed or removed in a future release. Elastic will work to fix any issu
are not subject to the support SLA of official GA features.
:::
+
**Syntax**
:::{image} ../../../images/functions/kql.svg
diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/match.md b/docs/reference/query-languages/esql/_snippets/functions/layout/match.md
index 82d861909abfd..b5368c12e2b4a 100644
--- a/docs/reference/query-languages/esql/_snippets/functions/layout/match.md
+++ b/docs/reference/query-languages/esql/_snippets/functions/layout/match.md
@@ -2,13 +2,14 @@
## `MATCH` [esql-match]
:::{warning}
-###### COMING 9.1.0
-
Do not use on production environments. This functionality is in technical preview and
may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview
are not subject to the support SLA of official GA features.
+:::
-Support for optional named parameters is only available from 9.1.0
+:::{note}
+###### Serverless: GA, Elastic Stack: COMING
+Support for optional named parameters is only available in serverless, or in a future {{es}} release
:::
**Syntax**
diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/qstr.md b/docs/reference/query-languages/esql/_snippets/functions/layout/qstr.md
index 19f6dda64ef1d..9154ed5343624 100644
--- a/docs/reference/query-languages/esql/_snippets/functions/layout/qstr.md
+++ b/docs/reference/query-languages/esql/_snippets/functions/layout/qstr.md
@@ -2,13 +2,14 @@
## `QSTR` [esql-qstr]
:::{warning}
-###### COMING 9.1.0
-
Do not use on production environments. This functionality is in technical preview and
may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview
are not subject to the support SLA of official GA features.
+:::
-Support for optional named parameters is only available from 9.1.0
+:::{note}
+###### Serverless: GA, Elastic Stack: COMING
+Support for optional named parameters is only available in serverless, or in a future {{es}} release
:::
**Syntax**
diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/term.md b/docs/reference/query-languages/esql/_snippets/functions/layout/term.md
index 64967e792a59c..85499b3bffdc3 100644
--- a/docs/reference/query-languages/esql/_snippets/functions/layout/term.md
+++ b/docs/reference/query-languages/esql/_snippets/functions/layout/term.md
@@ -7,6 +7,7 @@ may be changed or removed in a future release. Elastic will work to fix any issu
are not subject to the support SLA of official GA features.
:::
+
**Syntax**
:::{image} ../../../images/functions/term.svg
diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/to_aggregate_metric_double.md b/docs/reference/query-languages/esql/_snippets/functions/layout/to_aggregate_metric_double.md
index 19e9867c5e5b2..9c62b3d63ded8 100644
--- a/docs/reference/query-languages/esql/_snippets/functions/layout/to_aggregate_metric_double.md
+++ b/docs/reference/query-languages/esql/_snippets/functions/layout/to_aggregate_metric_double.md
@@ -2,7 +2,8 @@
## `TO_AGGREGATE_METRIC_DOUBLE` [esql-to_aggregate_metric_double]
```{applies_to}
-product: COMING 9.1
+product: COMING
+serverless: GA
```
**Syntax**
diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/to_lower.md b/docs/reference/query-languages/esql/_snippets/functions/layout/to_lower.md
index 0327f8a7579e1..e567ccf6fd1c4 100644
--- a/docs/reference/query-languages/esql/_snippets/functions/layout/to_lower.md
+++ b/docs/reference/query-languages/esql/_snippets/functions/layout/to_lower.md
@@ -2,8 +2,7 @@
## `TO_LOWER` [esql-to_lower]
:::{note}
-###### COMING 9.1.0
-
+###### Serverless: GA, Elastic Stack: COMING 9.1.0
Support for multivalued parameters is only available from 9.1.0
:::
diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/to_upper.md b/docs/reference/query-languages/esql/_snippets/functions/layout/to_upper.md
index bafcb218a54c9..1ab785c4b4cdf 100644
--- a/docs/reference/query-languages/esql/_snippets/functions/layout/to_upper.md
+++ b/docs/reference/query-languages/esql/_snippets/functions/layout/to_upper.md
@@ -2,8 +2,7 @@
## `TO_UPPER` [esql-to_upper]
:::{note}
-###### COMING 9.1.0
-
+###### Serverless: GA, Elastic Stack: COMING 9.1.0
Support for multivalued parameters is only available from 9.1.0
:::
diff --git a/docs/reference/query-languages/esql/_snippets/functions/layout/values.md b/docs/reference/query-languages/esql/_snippets/functions/layout/values.md
index 9cc069b0c4f58..0a2e9c2d5adc4 100644
--- a/docs/reference/query-languages/esql/_snippets/functions/layout/values.md
+++ b/docs/reference/query-languages/esql/_snippets/functions/layout/values.md
@@ -2,13 +2,12 @@
## `VALUES` [esql-values]
:::{warning}
-###### PREVIEW
-
Do not use on production environments. This functionality is in technical preview and
may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview
are not subject to the support SLA of official GA features.
:::
+
**Syntax**
:::{image} ../../../images/functions/values.svg
diff --git a/docs/reference/query-languages/esql/esql-commands.md b/docs/reference/query-languages/esql/esql-commands.md
index 386edc4e726f6..0da0d1c5c9a88 100644
--- a/docs/reference/query-languages/esql/esql-commands.md
+++ b/docs/reference/query-languages/esql/esql-commands.md
@@ -666,10 +666,6 @@ FROM employees
## `LOOKUP JOIN` [esql-lookup-join]
::::{warning}
-```{applies_to}
-stack: preview 9.0, coming 9.1
-serverless: preview
-```
This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
::::
@@ -753,10 +749,6 @@ FROM Left
## `MV_EXPAND` [esql-mv_expand]
::::{warning}
-```{applies_to}
-stack: preview 9.0, coming 9.1
-serverless: preview
-```
This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
::::
diff --git a/docs/reference/query-languages/esql/kibana/docs/functions/to_aggregate_metric_double.md b/docs/reference/query-languages/esql/kibana/docs/functions/to_aggregate_metric_double.md
index 569059d790b0e..d461121e036b2 100644
--- a/docs/reference/query-languages/esql/kibana/docs/functions/to_aggregate_metric_double.md
+++ b/docs/reference/query-languages/esql/kibana/docs/functions/to_aggregate_metric_double.md
@@ -5,7 +5,7 @@ This is generated by ESQL’s AbstractFunctionTestCase. Do no edit it. See ../RE
### TO_AGGREGATE_METRIC_DOUBLE
Encode a numeric to an aggregate_metric_double.
-```
+```esql
ROW x = 3892095203
| EVAL agg_metric = TO_AGGREGATE_METRIC_DOUBLE(x)
```
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/FunctionAppliesTo.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/FunctionAppliesTo.java
index 8d9fae9761935..f8d5917314632 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/FunctionAppliesTo.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/FunctionAppliesTo.java
@@ -17,4 +17,6 @@
String version() default "";
String description() default "";
+
+ boolean serverless() default true;
}
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/FunctionAppliesToLifecycle.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/FunctionAppliesToLifecycle.java
index 351c6d5b19fd7..5ad512e69c089 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/FunctionAppliesToLifecycle.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/FunctionAppliesToLifecycle.java
@@ -8,12 +8,22 @@
package org.elasticsearch.xpack.esql.expression.function;
public enum FunctionAppliesToLifecycle {
- PREVIEW,
- BETA,
- DEVELOPMENT,
- DEPRECATED,
- COMING,
- DISCONTINUED,
- UNAVAILABLE,
- GA
+ PREVIEW(true),
+ BETA(false),
+ DEVELOPMENT(false),
+ DEPRECATED(true),
+ COMING(true),
+ DISCONTINUED(false),
+ UNAVAILABLE(false),
+ GA(true);
+
+ private final boolean serverless;
+
+ FunctionAppliesToLifecycle(boolean serverless) {
+ this.serverless = serverless;
+ }
+
+ public FunctionAppliesToLifecycle serverlessLifecycle() {
+ return serverless ? GA : this;
+ }
}
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Values.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Values.java
index 7cda030d86039..5e05c3a448295 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Values.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Values.java
@@ -23,8 +23,6 @@
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;
@@ -86,8 +84,7 @@ public class Values extends AggregateFunction implements ToAggregator {
a [Circuit Breaker Error](docs-content://troubleshoot/elasticsearch/circuit-breaker-errors.md).
::::""",
type = FunctionType.AGGREGATE,
- examples = @Example(file = "string", tag = "values-grouped"),
- appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW) }
+ examples = @Example(file = "string", tag = "values-grouped")
)
public Values(
Source source,
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/Match.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/Match.java
index 6e74ca7084d4a..901521f928c0e 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/Match.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/Match.java
@@ -165,8 +165,7 @@ public class Match extends FullTextFunction implements OptionalArgument, PostAna
appliesTo = {
@FunctionAppliesTo(
lifeCycle = FunctionAppliesToLifecycle.COMING,
- version = "9.1.0",
- description = "Support for optional named parameters is only available from 9.1.0"
+ description = "Support for optional named parameters is only available in serverless, or in a future {{es}} release"
) }
)
public Match(
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/QueryString.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/QueryString.java
index d426308eff775..662cd69e220a1 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/QueryString.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/QueryString.java
@@ -122,8 +122,7 @@ public class QueryString extends FullTextFunction implements OptionalArgument {
appliesTo = {
@FunctionAppliesTo(
lifeCycle = FunctionAppliesToLifecycle.COMING,
- version = "9.1.0",
- description = "Support for optional named parameters is only available from 9.1.0"
+ description = "Support for optional named parameters is only available in serverless, or in a future {{es}} release"
) }
)
public QueryString(
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToAggregateMetricDouble.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToAggregateMetricDouble.java
index e6e2aa053ce22..23d4d895bb0fc 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToAggregateMetricDouble.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToAggregateMetricDouble.java
@@ -71,7 +71,7 @@ public class ToAggregateMetricDouble extends AbstractConvertFunction {
examples = {
@Example(file = "convert", tag = "toAggregateMetricDouble"),
@Example(description = "The expression also accepts multi-values", file = "convert", tag = "toAggregateMetricDoubleMv") },
- appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.COMING, version = "9.1") }
+ appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.COMING) }
)
public ToAggregateMetricDouble(
Source source,
diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/DocsV3Support.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/DocsV3Support.java
index 8181281d04f2f..0d20d90a95c83 100644
--- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/DocsV3Support.java
+++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/DocsV3Support.java
@@ -71,7 +71,23 @@
import static org.elasticsearch.xpack.esql.expression.function.EsqlFunctionRegistry.mapParam;
import static org.elasticsearch.xpack.esql.expression.function.EsqlFunctionRegistry.param;
import static org.elasticsearch.xpack.esql.expression.function.EsqlFunctionRegistry.paramWithoutAnnotation;
-
+import static org.elasticsearch.xpack.esql.expression.function.FunctionAppliesToLifecycle.GA;
+
+/**
+ * This class exists to support the new Docs V3 system.
+ * Between Elasticsearch 8.x and 9.0 the reference documents were completely re-written, with several key changes:
+ *
+ * - Port from ASCIIDOC to MD (markdown)
+ * - Restructures all Elastic docs with clearer separate between reference docs and other docs
+ * - All versions published from the main branch,
+ * requiring version specific information to be included in the docs as appropriate
+ * - Including sub-docs inside bigger docs works differently, requiring a new directory structure
+ * - Images and Kibana docs cannot be in the same location as snippets
+ *
+ *
+ * For these reasons the docs generating code that used to live inside AbstractFunctionTestCase has been pulled out
+ * and partially re-written to satisfy the above requirements.
+ */
public abstract class DocsV3Support {
static final String DOCS_WARNING =
@@ -190,6 +206,7 @@ public static void renderNegatedOperator(
operatorEntry("match_operator", ":", MatchOperator.class, OperatorCategory.SEARCH)
);
+ /** Each grouping represents a subsection in the docs. Currently, this is manually maintained, but could be partially automated */
public enum OperatorCategory {
BINARY,
UNARY,
@@ -200,6 +217,7 @@ public enum OperatorCategory {
SEARCH
}
+ /** Since operators do not exist in the function registry, we need an equivalent registry here in the docs generating code */
public record OperatorConfig(String name, String symbol, Class> clazz, OperatorCategory category, boolean variadic) {}
private static Map.Entry operatorEntry(
@@ -213,19 +231,53 @@ private static Map.Entry operatorEntry(
}
private static Map.Entry operatorEntry(String name, String symbol, Class> clazz, OperatorCategory category) {
- return entry(name, new OperatorConfig(name, symbol, clazz, category, false));
+ return operatorEntry(name, symbol, clazz, category, false);
+ }
+
+ @FunctionalInterface
+ interface TempFileWriter {
+ void writeToTempDir(Path dir, String extension, String str) throws IOException;
+ }
+
+ private class DocsFileWriter implements TempFileWriter {
+ @Override
+ public void writeToTempDir(Path dir, String extension, String str) throws IOException {
+ Files.createDirectories(dir);
+ Path file = dir.resolve(name + "." + extension);
+ Files.writeString(file, str);
+ logger.info("Wrote to file: {}", file);
+ }
}
protected final String category;
protected final String name;
+ protected final FunctionDefinition definition;
protected final Logger logger;
private final Supplier