From d8d58c971f28bbbe1a83a9d853aa3db55c1445a8 Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Fri, 5 Sep 2025 16:59:33 +0200 Subject: [PATCH 01/15] Move geo-grid functions out of SNAPSHOT and into tech-preview --- .../esql/_snippets/lists/spatial-functions.md | 3 +++ .../_snippets/lists/type-conversion-functions.md | 3 +++ .../esql/functions-operators/spatial-functions.md | 9 +++++++++ .../functions-operators/type-conversion-functions.md | 9 +++++++++ .../xpack/esql/action/EsqlCapabilities.java | 6 +++--- .../expression/function/EsqlFunctionRegistry.java | 12 ++++++------ 6 files changed, 33 insertions(+), 9 deletions(-) diff --git a/docs/reference/query-languages/esql/_snippets/lists/spatial-functions.md b/docs/reference/query-languages/esql/_snippets/lists/spatial-functions.md index 83cfdd4c60867..9a0718b44a1b3 100644 --- a/docs/reference/query-languages/esql/_snippets/lists/spatial-functions.md +++ b/docs/reference/query-languages/esql/_snippets/lists/spatial-functions.md @@ -10,3 +10,6 @@ * [preview] [`ST_XMIN`](../../functions-operators/spatial-functions.md#esql-st_xmin) * [preview] [`ST_YMAX`](../../functions-operators/spatial-functions.md#esql-st_ymax) * [preview] [`ST_YMIN`](../../functions-operators/spatial-functions.md#esql-st_ymin) +* [preview] [`ST_GEOTILE`](../../functions-operators/spatial-functions.md#esql-st_geotile) +* [preview] [`ST_GEOHEX`](../../functions-operators/spatial-functions.md#esql-st_geohex) +* [preview] [`ST_GEOHASH`](../../functions-operators/spatial-functions.md#esql-st_geohash) diff --git a/docs/reference/query-languages/esql/_snippets/lists/type-conversion-functions.md b/docs/reference/query-languages/esql/_snippets/lists/type-conversion-functions.md index 8867386f00a2d..5b26037a59d0d 100644 --- a/docs/reference/query-languages/esql/_snippets/lists/type-conversion-functions.md +++ b/docs/reference/query-languages/esql/_snippets/lists/type-conversion-functions.md @@ -6,8 +6,11 @@ * [`TO_DATE_NANOS`](../../functions-operators/type-conversion-functions.md#esql-to_date_nanos) * [`TO_DEGREES`](../../functions-operators/type-conversion-functions.md#esql-to_degrees) * [`TO_DOUBLE`](../../functions-operators/type-conversion-functions.md#esql-to_double) +* [preview] [`TO_GEOHASH`](../../functions-operators/type-conversion-functions.md#esql-to_geohash) +* [preview] [`TO_GEOHEX`](../../functions-operators/type-conversion-functions.md#esql-to_geohex) * [`TO_GEOPOINT`](../../functions-operators/type-conversion-functions.md#esql-to_geopoint) * [`TO_GEOSHAPE`](../../functions-operators/type-conversion-functions.md#esql-to_geoshape) +* [preview] [`TO_GEOTILE`](../../functions-operators/type-conversion-functions.md#esql-to_geotile) * [`TO_INTEGER`](../../functions-operators/type-conversion-functions.md#esql-to_integer) * [`TO_IP`](../../functions-operators/type-conversion-functions.md#esql-to_ip) * [`TO_LONG`](../../functions-operators/type-conversion-functions.md#esql-to_long) diff --git a/docs/reference/query-languages/esql/functions-operators/spatial-functions.md b/docs/reference/query-languages/esql/functions-operators/spatial-functions.md index 60746205e60e4..6f180b4f02b47 100644 --- a/docs/reference/query-languages/esql/functions-operators/spatial-functions.md +++ b/docs/reference/query-languages/esql/functions-operators/spatial-functions.md @@ -47,3 +47,12 @@ mapped_pages: :::{include} ../_snippets/functions/layout/st_ymin.md ::: + +:::{include} ../_snippets/functions/layout/st_geotile.md +::: + +:::{include} ../_snippets/functions/layout/st_geohex.md +::: + +:::{include} ../_snippets/functions/layout/st_geohash.md +::: diff --git a/docs/reference/query-languages/esql/functions-operators/type-conversion-functions.md b/docs/reference/query-languages/esql/functions-operators/type-conversion-functions.md index 246bb4b5fa30f..653f1a9373848 100644 --- a/docs/reference/query-languages/esql/functions-operators/type-conversion-functions.md +++ b/docs/reference/query-languages/esql/functions-operators/type-conversion-functions.md @@ -43,12 +43,21 @@ mapped_pages: :::{include} ../_snippets/functions/layout/to_double.md ::: +:::{include} ../_snippets/functions/layout/to_geohash.md +::: + +:::{include} ../_snippets/functions/layout/to_geohex.md +::: + :::{include} ../_snippets/functions/layout/to_geopoint.md ::: :::{include} ../_snippets/functions/layout/to_geoshape.md ::: +:::{include} ../_snippets/functions/layout/to_geotile.md +::: + :::{include} ../_snippets/functions/layout/to_integer.md ::: diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java index b0156204b1c72..965b0fd036505 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java @@ -414,17 +414,17 @@ public enum Cap { /** * Support ST_GEOHASH, ST_GEOTILE and ST_GEOHEX functions */ - SPATIAL_GRID(Build.current().isSnapshot()), + SPATIAL_GRID, /** * Support geohash, geotile and geohex data types. Done in #129581 */ - SPATIAL_GRID_TYPES(Build.current().isSnapshot()), + SPATIAL_GRID_TYPES, /** * Support geohash, geotile and geohex in ST_INTERSECTS and ST_DISJOINT. Done in #133546 */ - SPATIAL_GRID_INTERSECTS(Build.current().isSnapshot()), + SPATIAL_GRID_INTERSECTS, /** * Fix to GROK and DISSECT that allows extracting attributes with the same name as the input diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java index f4d20dcafd1a0..d1d4bebe31784 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java @@ -419,6 +419,9 @@ private static FunctionDefinition[][] functions() { def(SpatialWithin.class, SpatialWithin::new, "st_within"), def(StDistance.class, StDistance::new, "st_distance"), def(StEnvelope.class, StEnvelope::new, "st_envelope"), + def(StGeohash.class, StGeohash::new, "st_geohash"), + def(StGeotile.class, StGeotile::new, "st_geotile"), + def(StGeohex.class, StGeohex::new, "st_geohex"), def(StXMax.class, StXMax::new, "st_xmax"), def(StXMin.class, StXMin::new, "st_xmin"), def(StYMax.class, StYMax::new, "st_ymax"), @@ -445,6 +448,9 @@ private static FunctionDefinition[][] functions() { def(ToDateNanos.class, ToDateNanos::new, "to_date_nanos", "to_datenanos"), def(ToDegrees.class, ToDegrees::new, "to_degrees"), def(ToDouble.class, ToDouble::new, "to_double", "to_dbl"), + def(ToGeohash.class, ToGeohash::new, "to_geohash"), + def(ToGeotile.class, ToGeotile::new, "to_geotile"), + def(ToGeohex.class, ToGeohex::new, "to_geohex"), def(ToGeoPoint.class, ToGeoPoint::new, "to_geopoint"), def(ToGeoShape.class, ToGeoShape::new, "to_geoshape"), def(ToIp.class, ToIp::new, "to_ip"), @@ -506,12 +512,6 @@ private static FunctionDefinition[][] snapshotFunctions() { def(Score.class, uni(Score::new), Score.NAME), def(Term.class, bi(Term::new), "term"), def(Knn.class, tri(Knn::new), "knn"), - def(ToGeohash.class, ToGeohash::new, "to_geohash"), - def(ToGeotile.class, ToGeotile::new, "to_geotile"), - def(ToGeohex.class, ToGeohex::new, "to_geohex"), - def(StGeohash.class, StGeohash::new, "st_geohash"), - def(StGeotile.class, StGeotile::new, "st_geotile"), - def(StGeohex.class, StGeohex::new, "st_geohex"), def(CosineSimilarity.class, CosineSimilarity::new, "v_cosine"), def(DotProduct.class, DotProduct::new, "v_dot_product"), def(L1Norm.class, L1Norm::new, "v_l1_norm"), From fd1ef721287d738a6cf2f64c4d7da01cbc0c0d15 Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Fri, 5 Sep 2025 17:46:15 +0200 Subject: [PATCH 02/15] Update license tests to assert functions now work in release build --- .../spatial/SpatialGridLicenseTestCase.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/spatial/SpatialGridLicenseTestCase.java b/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/spatial/SpatialGridLicenseTestCase.java index e7297f49f0cea..e2d9840f107d9 100644 --- a/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/spatial/SpatialGridLicenseTestCase.java +++ b/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/spatial/SpatialGridLicenseTestCase.java @@ -63,8 +63,8 @@ protected int precision() { /** * Test that the geo_grid functions are disabled outside of SNAPSHOT. */ - public void testGeoGridDisabled() { - assertGeoGridDisabledWith("index_geo_point"); + public void testGeoGridEnabled() { + assertGeoGridEnabled(); } /** @@ -120,16 +120,10 @@ protected void assertGeoGridFailsWith(String index) { assertThat(e.getMessage(), containsString(expectedError)); } - protected void assertGeoGridDisabledWith(String index) { - assumeFalse("testing feature is disabled in non-snapshot builds", Build.current().isSnapshot()); - var query = String.format(Locale.ROOT, """ - FROM %s - | EVAL gridId = %s(location, %d) - | STATS count=COUNT() BY gridId - """, index, gridFunction(), precision()); - var expectedError = String.format(Locale.ROOT, "Unknown function [%s]", gridFunction()); - ElasticsearchException e = expectThrows(VerificationException.class, () -> run(query)); - assertThat(e.getMessage(), containsString(expectedError)); + protected void assertGeoGridEnabled() { + assumeFalse("testing feature is enabled in non-snapshot builds", Build.current().isSnapshot()); + assertThat("Capability SPATIAL_GRID_TYPES should be enabled", EsqlCapabilities.Cap.SPATIAL_GRID_TYPES.isEnabled(), equalTo(true)); + testGeoGridWithPoints(); } public static Map getValuesMap(Iterator> values) { From 8584eb5128b18192b23dfa70ff623a99ae295bad Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Fri, 5 Sep 2025 17:55:45 +0200 Subject: [PATCH 03/15] Regenerated docs to get kibana JSON snapshot flags fixed --- .../esql/kibana/definition/functions/st_geohash.json | 2 +- .../esql/kibana/definition/functions/st_geohex.json | 2 +- .../esql/kibana/definition/functions/st_geotile.json | 2 +- .../esql/kibana/definition/functions/to_geohash.json | 2 +- .../esql/kibana/definition/functions/to_geohex.json | 2 +- .../esql/kibana/definition/functions/to_geotile.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash.json b/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash.json index fced160121589..e1dcd59c7e241 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash.json @@ -51,5 +51,5 @@ "FROM airports\n| EVAL geohash = ST_GEOHASH(location, 1)\n| STATS\n count = COUNT(geohash),\n centroid = ST_CENTROID_AGG(location)\n BY geohash\n| WHERE count >= 10\n| EVAL geohashString = TO_STRING(geohash)\n| KEEP count, centroid, geohashString\n| SORT count DESC, geohashString ASC" ], "preview" : true, - "snapshot_only" : true + "snapshot_only" : false } diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/st_geohex.json b/docs/reference/query-languages/esql/kibana/definition/functions/st_geohex.json index 019fe27405f51..edf1d966685e6 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/st_geohex.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/st_geohex.json @@ -54,5 +54,5 @@ "FROM airports\n| EVAL geohex = ST_GEOHEX(location, 1)\n| STATS\n count = COUNT(geohex),\n centroid = ST_CENTROID_AGG(location)\n BY geohex\n| WHERE count >= 10\n| EVAL geohexString = TO_STRING(geohex)\n| KEEP count, centroid, geohexString\n| SORT count DESC, geohexString ASC" ], "preview" : true, - "snapshot_only" : true + "snapshot_only" : false } diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/st_geotile.json b/docs/reference/query-languages/esql/kibana/definition/functions/st_geotile.json index bd5fb4ede8cc4..f3a1f0abf95ee 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/st_geotile.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/st_geotile.json @@ -51,5 +51,5 @@ "FROM airports\n| EVAL geotile = ST_GEOTILE(location, 2)\n| STATS\n count = COUNT(geotile),\n centroid = ST_CENTROID_AGG(location)\n BY geotile\n| EVAL geotileString = TO_STRING(geotile)\n| SORT count DESC, geotileString ASC\n| KEEP count, centroid, geotileString" ], "preview" : true, - "snapshot_only" : true + "snapshot_only" : false } diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/to_geohash.json b/docs/reference/query-languages/esql/kibana/definition/functions/to_geohash.json index 9c6645f19f2eb..c9799d7d47a73 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/to_geohash.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/to_geohash.json @@ -57,5 +57,5 @@ "ROW string = \"u3bu\"\n| EVAL geohash = TO_GEOHASH(string)" ], "preview" : true, - "snapshot_only" : true + "snapshot_only" : false } diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/to_geohex.json b/docs/reference/query-languages/esql/kibana/definition/functions/to_geohex.json index 9d75a0d5db755..e05c26d7a569e 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/to_geohex.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/to_geohex.json @@ -57,5 +57,5 @@ "ROW string = \"841f059ffffffff\"\n| EVAL geohex = TO_GEOHEX(string)" ], "preview" : true, - "snapshot_only" : true + "snapshot_only" : false } diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/to_geotile.json b/docs/reference/query-languages/esql/kibana/definition/functions/to_geotile.json index 85879c996dad7..fcfc7439fcbba 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/to_geotile.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/to_geotile.json @@ -57,5 +57,5 @@ "ROW string = \"4/8/5\"\n| EVAL geotile = TO_GEOTILE(string)" ], "preview" : true, - "snapshot_only" : true + "snapshot_only" : false } From 8c3b1b676dc3a7e34595612ec11f6bef17758faf Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Sat, 6 Sep 2025 11:30:11 +0200 Subject: [PATCH 04/15] Fix docs links --- .../esql/expression/function/scalar/spatial/StGeohash.java | 2 +- .../xpack/esql/expression/function/scalar/spatial/StGeohex.java | 2 +- .../esql/expression/function/scalar/spatial/StGeotile.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohash.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohash.java index 594327f083423..42098588c5530 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohash.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohash.java @@ -118,7 +118,7 @@ private static int checkPrecisionRange(int precision) { description = """ Calculates the `geohash` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, - [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape.md) to calculate + [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohex.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohex.java index b595d92007ef1..812f52df352be 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohex.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohex.java @@ -119,7 +119,7 @@ private static int checkPrecisionRange(int precision) { description = """ Calculates the `geohex`, the H3 cell-id, of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, - [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape.md) to calculate + [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeotile.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeotile.java index b86d121c0c961..67aeea4299efa 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeotile.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeotile.java @@ -115,7 +115,7 @@ public GeoTileBoundedGrid get(DriverContext context) { description = """ Calculates the `geotile` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, - [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape.md) to calculate + [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) From 6429eec10211cd632cdab8810fe703dbaa563aa8 Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Sat, 6 Sep 2025 11:31:17 +0200 Subject: [PATCH 05/15] Fixed release function count --- .../yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml index f670b7e639764..133e2a539388d 100644 --- a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml @@ -225,7 +225,7 @@ setup: - gt: {esql.functions.to_long: $functions_to_long} - match: {esql.functions.coalesce: $functions_coalesce} - gt: {esql.functions.categorize: $functions_categorize} - - length: {esql.functions: 142} # check the "sister" test above for a likely update to the same esql.functions length check + - length: {esql.functions: 148} # check the "sister" test above for a likely update to the same esql.functions length check --- took: From bd7508b928dd0440ac62ba6d13299f02a4e0167b Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Sat, 6 Sep 2025 12:37:18 +0200 Subject: [PATCH 06/15] Update kibana docs after tiny geo-grid docs change --- .../esql/_snippets/functions/description/st_geohash.md | 2 +- .../esql/_snippets/functions/description/st_geohex.md | 2 +- .../esql/_snippets/functions/description/st_geotile.md | 2 +- .../query-languages/esql/kibana/docs/functions/st_geohash.md | 2 +- .../query-languages/esql/kibana/docs/functions/st_geohex.md | 2 +- .../query-languages/esql/kibana/docs/functions/st_geotile.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/reference/query-languages/esql/_snippets/functions/description/st_geohash.md b/docs/reference/query-languages/esql/_snippets/functions/description/st_geohash.md index 9531779bca629..5633d33e59ec0 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/description/st_geohash.md +++ b/docs/reference/query-languages/esql/_snippets/functions/description/st_geohash.md @@ -2,5 +2,5 @@ **Description** -Calculates the `geohash` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape.md) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) and the [`geohash_grid` aggregation](/reference/aggregations/search-aggregations-bucket-geohashgrid-aggregation.md). +Calculates the `geohash` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) and the [`geohash_grid` aggregation](/reference/aggregations/search-aggregations-bucket-geohashgrid-aggregation.md). diff --git a/docs/reference/query-languages/esql/_snippets/functions/description/st_geohex.md b/docs/reference/query-languages/esql/_snippets/functions/description/st_geohex.md index e240d28f6d0b0..1e48883b93567 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/description/st_geohex.md +++ b/docs/reference/query-languages/esql/_snippets/functions/description/st_geohex.md @@ -2,5 +2,5 @@ **Description** -Calculates the `geohex`, the H3 cell-id, of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape.md) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) and the [`geohex_grid` aggregation](/reference/aggregations/search-aggregations-bucket-geohexgrid-aggregation.md). +Calculates the `geohex`, the H3 cell-id, of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) and the [`geohex_grid` aggregation](/reference/aggregations/search-aggregations-bucket-geohexgrid-aggregation.md). diff --git a/docs/reference/query-languages/esql/_snippets/functions/description/st_geotile.md b/docs/reference/query-languages/esql/_snippets/functions/description/st_geotile.md index 36c1875196b2f..3ee4256d8e98b 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/description/st_geotile.md +++ b/docs/reference/query-languages/esql/_snippets/functions/description/st_geotile.md @@ -2,5 +2,5 @@ **Description** -Calculates the `geotile` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape.md) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) and the [`geotile_grid` aggregation](/reference/aggregations/search-aggregations-bucket-geotilegrid-aggregation.md). +Calculates the `geotile` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) and the [`geotile_grid` aggregation](/reference/aggregations/search-aggregations-bucket-geotilegrid-aggregation.md). diff --git a/docs/reference/query-languages/esql/kibana/docs/functions/st_geohash.md b/docs/reference/query-languages/esql/kibana/docs/functions/st_geohash.md index 17d0c71f274b2..7205a81063444 100644 --- a/docs/reference/query-languages/esql/kibana/docs/functions/st_geohash.md +++ b/docs/reference/query-languages/esql/kibana/docs/functions/st_geohash.md @@ -3,7 +3,7 @@ ### ST GEOHASH Calculates the `geohash` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, -[TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape.md) to calculate +[TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-geo-grid-query) diff --git a/docs/reference/query-languages/esql/kibana/docs/functions/st_geohex.md b/docs/reference/query-languages/esql/kibana/docs/functions/st_geohex.md index 02143698b7b6c..42106fc9c02f1 100644 --- a/docs/reference/query-languages/esql/kibana/docs/functions/st_geohex.md +++ b/docs/reference/query-languages/esql/kibana/docs/functions/st_geohex.md @@ -3,7 +3,7 @@ ### ST GEOHEX Calculates the `geohex`, the H3 cell-id, of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, -[TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape.md) to calculate +[TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-geo-grid-query) diff --git a/docs/reference/query-languages/esql/kibana/docs/functions/st_geotile.md b/docs/reference/query-languages/esql/kibana/docs/functions/st_geotile.md index 236a68e66d374..0fd8ba6210de6 100644 --- a/docs/reference/query-languages/esql/kibana/docs/functions/st_geotile.md +++ b/docs/reference/query-languages/esql/kibana/docs/functions/st_geotile.md @@ -3,7 +3,7 @@ ### ST GEOTILE Calculates the `geotile` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, -[TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape.md) to calculate +[TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-geo-grid-query) From 2fff33a149fe4b81c4cff82d7ec752a55fcd2d0b Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Sat, 6 Sep 2025 12:37:47 +0200 Subject: [PATCH 07/15] Fix a number of release tests after KNN PRs merged --- .../search/vectors/KnnSearchBuilder.java | 2 +- .../builder/SearchSourceBuilderTests.java | 4 +- .../vectors/KnnSearchRequestParserTests.java | 41 ++++++++++--------- .../xpack/esql/analysis/VerifierTests.java | 3 +- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/search/vectors/KnnSearchBuilder.java b/server/src/main/java/org/elasticsearch/search/vectors/KnnSearchBuilder.java index f455797e68d12..92256460f2c71 100644 --- a/server/src/main/java/org/elasticsearch/search/vectors/KnnSearchBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/vectors/KnnSearchBuilder.java @@ -562,7 +562,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws builder.field(K_FIELD.getPreferredName(), k); builder.field(NUM_CANDS_FIELD.getPreferredName(), numCands); - if (visitPercentage != null) { + if (IVF_FORMAT.isEnabled() && visitPercentage != null) { builder.field(VISIT_PERCENTAGE_FIELD.getPreferredName(), visitPercentage); } diff --git a/server/src/test/java/org/elasticsearch/search/builder/SearchSourceBuilderTests.java b/server/src/test/java/org/elasticsearch/search/builder/SearchSourceBuilderTests.java index dc6328862254a..77432163e2c0b 100644 --- a/server/src/test/java/org/elasticsearch/search/builder/SearchSourceBuilderTests.java +++ b/server/src/test/java/org/elasticsearch/search/builder/SearchSourceBuilderTests.java @@ -77,6 +77,7 @@ import java.util.function.ToLongFunction; import static java.util.Collections.emptyMap; +import static org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapper.IVF_FORMAT; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.Matchers.equalTo; @@ -826,7 +827,8 @@ public void testSearchSectionsUsageCollection() throws IOException { searchSourceBuilder.fetchField("field"); // these are not correct runtime mappings but they are counted compared to empty object searchSourceBuilder.runtimeMappings(Collections.singletonMap("field", "keyword")); - searchSourceBuilder.knnSearch(List.of(new KnnSearchBuilder("field", new float[] {}, 2, 5, 10f, null, null))); + Float percentage = IVF_FORMAT.isEnabled() ? 10f : null; + searchSourceBuilder.knnSearch(List.of(new KnnSearchBuilder("field", new float[] {}, 2, 5, percentage, null, null))); searchSourceBuilder.pointInTimeBuilder(new PointInTimeBuilder(new BytesArray("pitid"))); searchSourceBuilder.docValueField("field"); searchSourceBuilder.storedField("field"); diff --git a/server/src/test/java/org/elasticsearch/search/vectors/KnnSearchRequestParserTests.java b/server/src/test/java/org/elasticsearch/search/vectors/KnnSearchRequestParserTests.java index 38b5bd8b4b475..a9cc170ded8e2 100644 --- a/server/src/test/java/org/elasticsearch/search/vectors/KnnSearchRequestParserTests.java +++ b/server/src/test/java/org/elasticsearch/search/vectors/KnnSearchRequestParserTests.java @@ -37,6 +37,7 @@ import java.util.Map; import static java.util.Collections.emptyList; +import static org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapper.IVF_FORMAT; import static org.elasticsearch.search.RandomSearchRequestGenerator.randomSearchSourceBuilder; import static org.hamcrest.Matchers.containsString; @@ -111,7 +112,7 @@ public void testParseSourceString() throws IOException { .field(KnnSearch.FIELD_FIELD.getPreferredName(), knnSearch.field) .field(KnnSearch.K_FIELD.getPreferredName(), knnSearch.k) .field(KnnSearch.NUM_CANDS_FIELD.getPreferredName(), knnSearch.numCands); - if (knnSearch.visitPercentage != null) { + if (IVF_FORMAT.isEnabled() && knnSearch.visitPercentage != null) { builder.field(KnnSearch.VISIT_PERCENTAGE_FIELD.getPreferredName(), knnSearch.visitPercentage); } builder.field(KnnSearch.QUERY_VECTOR_FIELD.getPreferredName(), knnSearch.queryVector); @@ -140,7 +141,7 @@ public void testParseSourceArray() throws IOException { .field(KnnSearch.FIELD_FIELD.getPreferredName(), knnSearch.field) .field(KnnSearch.K_FIELD.getPreferredName(), knnSearch.k) .field(KnnSearch.NUM_CANDS_FIELD.getPreferredName(), knnSearch.numCands); - if (knnSearch.visitPercentage != null) { + if (IVF_FORMAT.isEnabled() && knnSearch.visitPercentage != null) { builder.field(KnnSearch.VISIT_PERCENTAGE_FIELD.getPreferredName(), knnSearch.visitPercentage); } builder.field(KnnSearch.QUERY_VECTOR_FIELD.getPreferredName(), knnSearch.queryVector); @@ -176,11 +177,11 @@ public void testNumCandsLessThanK() throws IOException { .startObject(KnnSearchRequestParser.KNN_SECTION_FIELD.getPreferredName()) .field(KnnSearch.FIELD_FIELD.getPreferredName(), "field") .field(KnnSearch.K_FIELD.getPreferredName(), 100) - .field(KnnSearch.NUM_CANDS_FIELD.getPreferredName(), 80) - .field(KnnSearch.VISIT_PERCENTAGE_FIELD.getPreferredName(), 100.0f) - .field(KnnSearch.QUERY_VECTOR_FIELD.getPreferredName(), new float[] { 1.0f, 2.0f, 3.0f }) - .endObject() - .endObject(); + .field(KnnSearch.NUM_CANDS_FIELD.getPreferredName(), 80); + if (IVF_FORMAT.isEnabled()) { + builder.field(KnnSearch.VISIT_PERCENTAGE_FIELD.getPreferredName(), 100.0f); + } + builder.field(KnnSearch.QUERY_VECTOR_FIELD.getPreferredName(), new float[] { 1.0f, 2.0f, 3.0f }).endObject().endObject(); IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> parseSearchRequest(builder)); assertThat(e.getMessage(), containsString("[num_candidates] cannot be less than [k]")); @@ -193,17 +194,18 @@ public void testNumCandsExceedsLimit() throws IOException { .startObject(KnnSearchRequestParser.KNN_SECTION_FIELD.getPreferredName()) .field(KnnSearch.FIELD_FIELD.getPreferredName(), "field") .field(KnnSearch.K_FIELD.getPreferredName(), 100) - .field(KnnSearch.NUM_CANDS_FIELD.getPreferredName(), 10002) - .field(KnnSearch.VISIT_PERCENTAGE_FIELD.getPreferredName(), 100.0f) - .field(KnnSearch.QUERY_VECTOR_FIELD.getPreferredName(), new float[] { 1.0f, 2.0f, 3.0f }) - .endObject() - .endObject(); + .field(KnnSearch.NUM_CANDS_FIELD.getPreferredName(), 10002); + if (IVF_FORMAT.isEnabled()) { + builder.field(KnnSearch.VISIT_PERCENTAGE_FIELD.getPreferredName(), 100.0f); + } + builder.field(KnnSearch.QUERY_VECTOR_FIELD.getPreferredName(), new float[] { 1.0f, 2.0f, 3.0f }).endObject().endObject(); IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> parseSearchRequest(builder)); assertThat(e.getMessage(), containsString("[num_candidates] cannot exceed [10000]")); } public void testVisitPercnetageLessThan0() throws IOException { + assumeTrue("visit_percentage is only supported if IVF format is enabled", IVF_FORMAT.isEnabled()); XContentType xContentType = randomFrom(XContentType.values()); XContentBuilder builder = XContentBuilder.builder(xContentType.xContent()) .startObject() @@ -220,7 +222,8 @@ public void testVisitPercnetageLessThan0() throws IOException { assertThat(e.getMessage(), containsString("[visit_percentage] must be between 0 and 100")); } - public void testVisitPercnetageGreaterThan100() throws IOException { + public void testVisitPercentageGreaterThan100() throws IOException { + assumeTrue("visit_percentage is only supported if IVF format is enabled", IVF_FORMAT.isEnabled()); XContentType xContentType = randomFrom(XContentType.values()); XContentBuilder builder = XContentBuilder.builder(xContentType.xContent()) .startObject() @@ -244,11 +247,11 @@ public void testInvalidK() throws IOException { .startObject(KnnSearchRequestParser.KNN_SECTION_FIELD.getPreferredName()) .field(KnnSearch.FIELD_FIELD.getPreferredName(), "field") .field(KnnSearch.K_FIELD.getPreferredName(), 0) - .field(KnnSearch.NUM_CANDS_FIELD.getPreferredName(), 10) - .field(KnnSearch.VISIT_PERCENTAGE_FIELD.getPreferredName(), 100.0f) - .field(KnnSearch.QUERY_VECTOR_FIELD.getPreferredName(), new float[] { 1.0f, 2.0f, 3.0f }) - .endObject() - .endObject(); + .field(KnnSearch.NUM_CANDS_FIELD.getPreferredName(), 10); + if (IVF_FORMAT.isEnabled()) { + builder.field(KnnSearch.VISIT_PERCENTAGE_FIELD.getPreferredName(), 100.0f); + } + builder.field(KnnSearch.QUERY_VECTOR_FIELD.getPreferredName(), new float[] { 1.0f, 2.0f, 3.0f }).endObject().endObject(); IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> parseSearchRequest(builder)); assertThat(e.getMessage(), containsString("[k] must be greater than 0")); @@ -281,7 +284,7 @@ private KnnSearch randomKnnSearch() { int k = randomIntBetween(1, 100); int numCands = randomIntBetween(k, 1000); - Float visitPercentage = randomBoolean() ? null : randomFloatBetween(0.0f, 100.0f, true); + Float visitPercentage = (IVF_FORMAT.isEnabled() == false && randomBoolean()) ? null : randomFloatBetween(0.0f, 100.0f, true); return new KnnSearch(field, vector, k, numCands, visitPercentage); } diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java index a83dae458934e..d5d3507928e84 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java @@ -2376,12 +2376,13 @@ public void testVectorSimilarityFunctionsNullArgs() throws Exception { } public void testFullTextFunctionsWithSemanticText() { + assumeTrue("requires knn function", EsqlCapabilities.Cap.KNN_FUNCTION_V5.isEnabled()); checkFullTextFunctionsWithSemanticText("knn(semantic, [0, 1, 2])"); checkFullTextFunctionsWithSemanticText("match(semantic, \"hello world\")"); checkFullTextFunctionsWithSemanticText("semantic:\"hello world\""); } - public void checkFullTextFunctionsWithSemanticText(String functionInvocation) { + private void checkFullTextFunctionsWithSemanticText(String functionInvocation) { query("from test | where " + functionInvocation, fullTextAnalyzer); } From c63d85493abce8ce1e9a5934bb4c627683759159 Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Mon, 8 Sep 2025 10:27:37 +0200 Subject: [PATCH 08/15] Fix docs links --- .../esql/_snippets/functions/description/st_geohash.md | 2 +- .../esql/_snippets/functions/description/st_geohex.md | 2 +- .../esql/_snippets/functions/description/st_geotile.md | 2 +- .../query-languages/esql/kibana/docs/functions/st_geohash.md | 2 +- .../query-languages/esql/kibana/docs/functions/st_geohex.md | 2 +- .../query-languages/esql/kibana/docs/functions/st_geotile.md | 2 +- .../esql/expression/function/scalar/spatial/StGeohash.java | 2 +- .../xpack/esql/expression/function/scalar/spatial/StGeohex.java | 2 +- .../esql/expression/function/scalar/spatial/StGeotile.java | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/reference/query-languages/esql/_snippets/functions/description/st_geohash.md b/docs/reference/query-languages/esql/_snippets/functions/description/st_geohash.md index 5633d33e59ec0..877a49d6a86b7 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/description/st_geohash.md +++ b/docs/reference/query-languages/esql/_snippets/functions/description/st_geohash.md @@ -2,5 +2,5 @@ **Description** -Calculates the `geohash` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) and the [`geohash_grid` aggregation](/reference/aggregations/search-aggregations-bucket-geohashgrid-aggregation.md). +Calculates the `geohash` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](#esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) and the [`geohash_grid` aggregation](/reference/aggregations/search-aggregations-bucket-geohashgrid-aggregation.md). diff --git a/docs/reference/query-languages/esql/_snippets/functions/description/st_geohex.md b/docs/reference/query-languages/esql/_snippets/functions/description/st_geohex.md index 1e48883b93567..73f87ee573eb1 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/description/st_geohex.md +++ b/docs/reference/query-languages/esql/_snippets/functions/description/st_geohex.md @@ -2,5 +2,5 @@ **Description** -Calculates the `geohex`, the H3 cell-id, of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) and the [`geohex_grid` aggregation](/reference/aggregations/search-aggregations-bucket-geohexgrid-aggregation.md). +Calculates the `geohex`, the H3 cell-id, of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](#esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) and the [`geohex_grid` aggregation](/reference/aggregations/search-aggregations-bucket-geohexgrid-aggregation.md). diff --git a/docs/reference/query-languages/esql/_snippets/functions/description/st_geotile.md b/docs/reference/query-languages/esql/_snippets/functions/description/st_geotile.md index 3ee4256d8e98b..2b417b682c6a8 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/description/st_geotile.md +++ b/docs/reference/query-languages/esql/_snippets/functions/description/st_geotile.md @@ -2,5 +2,5 @@ **Description** -Calculates the `geotile` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) and the [`geotile_grid` aggregation](/reference/aggregations/search-aggregations-bucket-geotilegrid-aggregation.md). +Calculates the `geotile` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](#esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) and the [`geotile_grid` aggregation](/reference/aggregations/search-aggregations-bucket-geotilegrid-aggregation.md). diff --git a/docs/reference/query-languages/esql/kibana/docs/functions/st_geohash.md b/docs/reference/query-languages/esql/kibana/docs/functions/st_geohash.md index 7205a81063444..0db9ab65bf325 100644 --- a/docs/reference/query-languages/esql/kibana/docs/functions/st_geohash.md +++ b/docs/reference/query-languages/esql/kibana/docs/functions/st_geohash.md @@ -3,7 +3,7 @@ ### ST GEOHASH Calculates the `geohash` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, -[TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate +[TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](#esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-geo-grid-query) diff --git a/docs/reference/query-languages/esql/kibana/docs/functions/st_geohex.md b/docs/reference/query-languages/esql/kibana/docs/functions/st_geohex.md index 42106fc9c02f1..c2d071daa9241 100644 --- a/docs/reference/query-languages/esql/kibana/docs/functions/st_geohex.md +++ b/docs/reference/query-languages/esql/kibana/docs/functions/st_geohex.md @@ -3,7 +3,7 @@ ### ST GEOHEX Calculates the `geohex`, the H3 cell-id, of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, -[TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate +[TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](#esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-geo-grid-query) diff --git a/docs/reference/query-languages/esql/kibana/docs/functions/st_geotile.md b/docs/reference/query-languages/esql/kibana/docs/functions/st_geotile.md index 0fd8ba6210de6..4195a044e2d12 100644 --- a/docs/reference/query-languages/esql/kibana/docs/functions/st_geotile.md +++ b/docs/reference/query-languages/esql/kibana/docs/functions/st_geotile.md @@ -3,7 +3,7 @@ ### ST GEOTILE Calculates the `geotile` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, -[TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate +[TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](#esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-geo-grid-query) diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohash.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohash.java index 42098588c5530..b34d0ef8d935e 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohash.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohash.java @@ -118,7 +118,7 @@ private static int checkPrecisionRange(int precision) { description = """ Calculates the `geohash` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, - [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate + [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](#esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohex.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohex.java index 812f52df352be..2315af2e2cbe9 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohex.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohex.java @@ -119,7 +119,7 @@ private static int checkPrecisionRange(int precision) { description = """ Calculates the `geohex`, the H3 cell-id, of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, - [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate + [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](#esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeotile.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeotile.java index 67aeea4299efa..25264d696f731 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeotile.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeotile.java @@ -115,7 +115,7 @@ public GeoTileBoundedGrid get(DriverContext context) { description = """ Calculates the `geotile` of the supplied geo_point at the specified precision. The result is long encoded. Use [TO_STRING](#esql-to_string) to convert the result to a string, - [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](esql-to_geoshape) to calculate + [TO_LONG](#esql-to_long) to convert it to a `long`, or [TO_GEOSHAPE](#esql-to_geoshape) to calculate the `geo_shape` bounding geometry. These functions are related to the [`geo_grid` query](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) From 0996733fe193ce2fb0523af2602b89d86d2efac8 Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Mon, 8 Sep 2025 16:01:20 +0200 Subject: [PATCH 09/15] Remove incorrect optional flag from StGeohash --- .../query-languages/esql/images/functions/st_geohash.svg | 2 +- .../esql/kibana/definition/functions/st_geohash.json | 4 ++-- .../esql/expression/function/scalar/spatial/StGeohash.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/reference/query-languages/esql/images/functions/st_geohash.svg b/docs/reference/query-languages/esql/images/functions/st_geohash.svg index 2867f072e1a8e..231866d25d521 100644 --- a/docs/reference/query-languages/esql/images/functions/st_geohash.svg +++ b/docs/reference/query-languages/esql/images/functions/st_geohash.svg @@ -1 +1 @@ -ST_GEOHASH(geometry,precision,bounds) \ No newline at end of file +ST_GEOHASH(geometry,precision,bounds) \ No newline at end of file diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash.json b/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash.json index e1dcd59c7e241..369e20eedf5f8 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash.json @@ -15,7 +15,7 @@ { "name" : "precision", "type" : "integer", - "optional" : true, + "optional" : false, "description" : "Expression of type `integer`. If `null`, the function returns `null`. Valid values are between [1 and 12](https://en.wikipedia.org/wiki/Geohash)." } ], @@ -33,7 +33,7 @@ { "name" : "precision", "type" : "integer", - "optional" : true, + "optional" : false, "description" : "Expression of type `integer`. If `null`, the function returns `null`. Valid values are between [1 and 12](https://en.wikipedia.org/wiki/Geohash)." }, { diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohash.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohash.java index b34d0ef8d935e..b1fffe95b9b23 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohash.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohash.java @@ -134,7 +134,7 @@ public StGeohash( ) Expression field, @Param(name = "precision", type = { "integer" }, description = """ Expression of type `integer`. If `null`, the function returns `null`. - Valid values are between [1 and 12](https://en.wikipedia.org/wiki/Geohash).""", optional = true) Expression precision, + Valid values are between [1 and 12](https://en.wikipedia.org/wiki/Geohash).""") Expression precision, @Param(name = "bounds", type = { "geo_shape" }, description = """ Optional bounds to filter the grid tiles, a `geo_shape` of type `BBOX`. Use [`ST_ENVELOPE`](#esql-st_envelope) if the `geo_shape` is of any other type.""", optional = true) Expression bounds From b7e07d2e8d9649267966ab8afc9e9b6fbbfe8c7e Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Mon, 8 Sep 2025 16:29:02 +0200 Subject: [PATCH 10/15] Link to original aggs docs for more detail on the tile key format --- .../esql/_snippets/functions/description/to_geohash.md | 2 +- .../esql/_snippets/functions/description/to_geohex.md | 2 +- .../esql/_snippets/functions/description/to_geotile.md | 2 +- .../esql/kibana/definition/functions/to_geohash.json | 2 +- .../esql/kibana/definition/functions/to_geohex.json | 2 +- .../esql/kibana/definition/functions/to_geotile.json | 2 +- .../query-languages/esql/kibana/docs/functions/to_geohash.md | 3 ++- .../query-languages/esql/kibana/docs/functions/to_geohex.md | 3 ++- .../query-languages/esql/kibana/docs/functions/to_geotile.md | 3 ++- .../esql/expression/function/scalar/convert/ToGeohash.java | 3 ++- .../esql/expression/function/scalar/convert/ToGeohex.java | 3 ++- .../esql/expression/function/scalar/convert/ToGeotile.java | 3 ++- 12 files changed, 18 insertions(+), 12 deletions(-) diff --git a/docs/reference/query-languages/esql/_snippets/functions/description/to_geohash.md b/docs/reference/query-languages/esql/_snippets/functions/description/to_geohash.md index 0c588cfc2a876..2648dcdc5fecd 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/description/to_geohash.md +++ b/docs/reference/query-languages/esql/_snippets/functions/description/to_geohash.md @@ -2,5 +2,5 @@ **Description** -Converts an input value to a `geohash` value. A string will only be successfully converted if it respects the `geohash` format. +Converts an input value to a `geohash` value. A string will only be successfully converted if it respects the `geohash` format, as described for the [geohash grid aggregation](/reference/aggregations/search-aggregations-bucket-geohashgrid-aggregation.md). diff --git a/docs/reference/query-languages/esql/_snippets/functions/description/to_geohex.md b/docs/reference/query-languages/esql/_snippets/functions/description/to_geohex.md index 78eaa369454ca..7d458146281b6 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/description/to_geohex.md +++ b/docs/reference/query-languages/esql/_snippets/functions/description/to_geohex.md @@ -2,5 +2,5 @@ **Description** -Converts an input value to a `geohex` value. A string will only be successfully converted if it respects the `geohex` format. +Converts an input value to a `geohex` value. A string will only be successfully converted if it respects the `geohex` format, as described for the [geohex grid aggregation](/reference/aggregations/search-aggregations-bucket-geohexgrid-aggregation.md). diff --git a/docs/reference/query-languages/esql/_snippets/functions/description/to_geotile.md b/docs/reference/query-languages/esql/_snippets/functions/description/to_geotile.md index b5a2c3812e254..7137969e55c83 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/description/to_geotile.md +++ b/docs/reference/query-languages/esql/_snippets/functions/description/to_geotile.md @@ -2,5 +2,5 @@ **Description** -Converts an input value to a `geotile` value. A string will only be successfully converted if it respects the `geotile` format. +Converts an input value to a `geotile` value. A string will only be successfully converted if it respects the `geotile` format, as described for the [geotile grid aggregation](/reference/aggregations/search-aggregations-bucket-geotilegrid-aggregation.md). diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/to_geohash.json b/docs/reference/query-languages/esql/kibana/definition/functions/to_geohash.json index c9799d7d47a73..317716ece4db3 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/to_geohash.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/to_geohash.json @@ -2,7 +2,7 @@ "comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.", "type" : "scalar", "name" : "to_geohash", - "description" : "Converts an input value to a `geohash` value.\nA string will only be successfully converted if it respects the\n`geohash` format.", + "description" : "Converts an input value to a `geohash` value.\nA string will only be successfully converted if it respects the\n`geohash` format, as described for the\ngeohash grid aggregation.", "signatures" : [ { "params" : [ diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/to_geohex.json b/docs/reference/query-languages/esql/kibana/definition/functions/to_geohex.json index e05c26d7a569e..0949e9d929882 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/to_geohex.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/to_geohex.json @@ -2,7 +2,7 @@ "comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.", "type" : "scalar", "name" : "to_geohex", - "description" : "Converts an input value to a `geohex` value.\nA string will only be successfully converted if it respects the\n`geohex` format.", + "description" : "Converts an input value to a `geohex` value.\nA string will only be successfully converted if it respects the\n`geohex` format, as described for the\ngeohex grid aggregation.", "signatures" : [ { "params" : [ diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/to_geotile.json b/docs/reference/query-languages/esql/kibana/definition/functions/to_geotile.json index fcfc7439fcbba..a5b7150326b40 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/to_geotile.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/to_geotile.json @@ -2,7 +2,7 @@ "comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.", "type" : "scalar", "name" : "to_geotile", - "description" : "Converts an input value to a `geotile` value.\nA string will only be successfully converted if it respects the\n`geotile` format.", + "description" : "Converts an input value to a `geotile` value.\nA string will only be successfully converted if it respects the\n`geotile` format, as described for the\ngeotile grid aggregation.", "signatures" : [ { "params" : [ diff --git a/docs/reference/query-languages/esql/kibana/docs/functions/to_geohash.md b/docs/reference/query-languages/esql/kibana/docs/functions/to_geohash.md index 59277639cf6f3..2c57afc95e317 100644 --- a/docs/reference/query-languages/esql/kibana/docs/functions/to_geohash.md +++ b/docs/reference/query-languages/esql/kibana/docs/functions/to_geohash.md @@ -3,7 +3,8 @@ ### TO GEOHASH Converts an input value to a `geohash` value. A string will only be successfully converted if it respects the -`geohash` format. +`geohash` format, as described for the +[geohash grid aggregation](https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-geohashgrid-aggregation). ```esql ROW string = "u3bu" diff --git a/docs/reference/query-languages/esql/kibana/docs/functions/to_geohex.md b/docs/reference/query-languages/esql/kibana/docs/functions/to_geohex.md index 1d6e3b968995e..bf53d13e7c8f9 100644 --- a/docs/reference/query-languages/esql/kibana/docs/functions/to_geohex.md +++ b/docs/reference/query-languages/esql/kibana/docs/functions/to_geohex.md @@ -3,7 +3,8 @@ ### TO GEOHEX Converts an input value to a `geohex` value. A string will only be successfully converted if it respects the -`geohex` format. +`geohex` format, as described for the +[geohex grid aggregation](https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-geohexgrid-aggregation). ```esql ROW string = "841f059ffffffff" diff --git a/docs/reference/query-languages/esql/kibana/docs/functions/to_geotile.md b/docs/reference/query-languages/esql/kibana/docs/functions/to_geotile.md index a123797d01d7b..9730dc8c7a3ad 100644 --- a/docs/reference/query-languages/esql/kibana/docs/functions/to_geotile.md +++ b/docs/reference/query-languages/esql/kibana/docs/functions/to_geotile.md @@ -3,7 +3,8 @@ ### TO GEOTILE Converts an input value to a `geotile` value. A string will only be successfully converted if it respects the -`geotile` format. +`geotile` format, as described for the +[geotile grid aggregation](https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-geotilegrid-aggregation). ```esql ROW string = "4/8/5" diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToGeohash.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToGeohash.java index 0ea490098ca6f..fef2a691c6e1a 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToGeohash.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToGeohash.java @@ -52,7 +52,8 @@ public class ToGeohash extends AbstractConvertFunction { description = """ Converts an input value to a `geohash` value. A string will only be successfully converted if it respects the - `geohash` format.""", + `geohash` format, as described for the + [geohash grid aggregation](/reference/aggregations/search-aggregations-bucket-geohashgrid-aggregation.md).""", examples = @Example(file = "spatial-grid", tag = "to_geohash") ) public ToGeohash( diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToGeohex.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToGeohex.java index 4ccda5cea66f8..77becb1f96f9d 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToGeohex.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToGeohex.java @@ -48,7 +48,8 @@ public class ToGeohex extends AbstractConvertFunction { description = """ Converts an input value to a `geohex` value. A string will only be successfully converted if it respects the - `geohex` format.""", + `geohex` format, as described for the + [geohex grid aggregation](/reference/aggregations/search-aggregations-bucket-geohexgrid-aggregation.md).""", examples = @Example(file = "spatial-grid", tag = "to_geohex") ) public ToGeohex( diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToGeotile.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToGeotile.java index ea2c3075a9303..fc31b574ab03f 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToGeotile.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToGeotile.java @@ -52,7 +52,8 @@ public class ToGeotile extends AbstractConvertFunction { description = """ Converts an input value to a `geotile` value. A string will only be successfully converted if it respects the - `geotile` format.""", + `geotile` format, as described for the + [geotile grid aggregation](/reference/aggregations/search-aggregations-bucket-geotilegrid-aggregation.md).""", examples = @Example(file = "spatial-grid", tag = "to_geotile") ) public ToGeotile( From 2a35c50aacae59023d8abfbb7641aa3a87dda7f5 Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Mon, 8 Sep 2025 16:34:28 +0200 Subject: [PATCH 11/15] Fix stale comment --- .../xpack/esql/spatial/SpatialGridLicenseTestCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/spatial/SpatialGridLicenseTestCase.java b/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/spatial/SpatialGridLicenseTestCase.java index e2d9840f107d9..d1db4de058411 100644 --- a/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/spatial/SpatialGridLicenseTestCase.java +++ b/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/spatial/SpatialGridLicenseTestCase.java @@ -61,7 +61,7 @@ protected int precision() { } /** - * Test that the geo_grid functions are disabled outside of SNAPSHOT. + * Test that the geo_grid functions are enabled outside of SNAPSHOT. */ public void testGeoGridEnabled() { assertGeoGridEnabled(); From 74dffdf7971ad7750af29afdd81345a2fd5164a9 Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Tue, 9 Sep 2025 12:11:37 +0200 Subject: [PATCH 12/15] Require capability for DECAY function --- .../esql/expression/function/scalar/score/DecayTests.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/score/DecayTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/score/DecayTests.java index fda42d74a0e30..c68896b13884d 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/score/DecayTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/score/DecayTests.java @@ -13,6 +13,7 @@ import org.elasticsearch.common.geo.GeoPoint; import org.elasticsearch.common.unit.DistanceUnit; import org.elasticsearch.script.ScoreScriptUtils; +import org.elasticsearch.xpack.esql.action.EsqlCapabilities; import org.elasticsearch.xpack.esql.core.expression.Expression; import org.elasticsearch.xpack.esql.core.expression.Literal; import org.elasticsearch.xpack.esql.core.expression.MapExpression; @@ -20,6 +21,7 @@ import org.elasticsearch.xpack.esql.core.type.DataType; import org.elasticsearch.xpack.esql.expression.function.AbstractScalarFunctionTestCase; import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier; +import org.junit.BeforeClass; import java.time.Duration; import java.time.Instant; @@ -44,6 +46,11 @@ public DecayTests(@Name("TestCase") Supplier testCase this.testCase = testCaseSupplier.get(); } + @BeforeClass + public static void checkCapability() { + assumeTrue("Decay function tests require the DECAY_FUNCTION capability", EsqlCapabilities.Cap.DECAY_FUNCTION.isEnabled()); + } + @ParametersFactory public static Iterable parameters() { List testCaseSuppliers = new ArrayList<>(); From a98d94f88123182a5c9a2ae4974b0118caac3027 Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Tue, 9 Sep 2025 12:17:26 +0200 Subject: [PATCH 13/15] Regenerate SVG after merging main --- .../query-languages/esql/images/functions/st_geohash.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/query-languages/esql/images/functions/st_geohash.svg b/docs/reference/query-languages/esql/images/functions/st_geohash.svg index 750c39b45b090..349e872d34599 100644 --- a/docs/reference/query-languages/esql/images/functions/st_geohash.svg +++ b/docs/reference/query-languages/esql/images/functions/st_geohash.svg @@ -1 +1 @@ -ST_GEOHASH(geometry,precision,bounds) +ST_GEOHASH(geometry,precision,bounds) \ No newline at end of file From 829fb01fa957d8ce4e2342e1d22b814ec9b1a34d Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Tue, 9 Sep 2025 12:29:50 +0200 Subject: [PATCH 14/15] Regenerate SVG after merging main --- docs/reference/query-languages/esql/images/functions/decay.svg | 2 +- docs/reference/query-languages/esql/images/functions/knn.svg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/query-languages/esql/images/functions/decay.svg b/docs/reference/query-languages/esql/images/functions/decay.svg index 176ef68b5b730..03973b34d2767 100644 --- a/docs/reference/query-languages/esql/images/functions/decay.svg +++ b/docs/reference/query-languages/esql/images/functions/decay.svg @@ -1 +1 @@ -DECAY(value,origin,scale,options) \ No newline at end of file +DECAY(value,origin,scale,options) \ No newline at end of file diff --git a/docs/reference/query-languages/esql/images/functions/knn.svg b/docs/reference/query-languages/esql/images/functions/knn.svg index aefae3476031f..326dd00a40976 100644 --- a/docs/reference/query-languages/esql/images/functions/knn.svg +++ b/docs/reference/query-languages/esql/images/functions/knn.svg @@ -1 +1 @@ -KNN(field,query,options) +KNN(field,query,options) \ No newline at end of file From 5e966f3938cefe5ce789dbb80bd560cefa3b8215 Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Tue, 9 Sep 2025 20:26:05 +0200 Subject: [PATCH 15/15] Update usage count after merging main --- .../yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml index 5ad4954c9b0a4..90eb44b36c17d 100644 --- a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml @@ -225,7 +225,7 @@ setup: - gt: {esql.functions.to_long: $functions_to_long} - match: {esql.functions.coalesce: $functions_coalesce} - gt: {esql.functions.categorize: $functions_categorize} - - length: {esql.functions: 148} # check the "sister" test above for a likely update to the same esql.functions length check + - length: {esql.functions: 150} # check the "sister" test above for a likely update to the same esql.functions length check --- took: