Browse Source

Move geo-grid functions out of SNAPSHOT and into tech-preview (#134228)

The PR at https://github.com/elastic/elasticsearch/pull/129581 added
three new types: `geohash`, `geotile` and `geohex`, and support
functions for creating these from strings, longs and geo_point fields.
However all this was done under SNAPSHOT. Now it's time to move it into
`tech-preview`.
Craig Taverner 1 month ago
parent
commit
0d92bb2a24
32 changed files with 74 additions and 50 deletions
  1. 1 1
      docs/reference/query-languages/esql/_snippets/functions/description/st_geohash.md
  2. 1 1
      docs/reference/query-languages/esql/_snippets/functions/description/st_geohex.md
  3. 1 1
      docs/reference/query-languages/esql/_snippets/functions/description/st_geotile.md
  4. 1 1
      docs/reference/query-languages/esql/_snippets/functions/description/to_geohash.md
  5. 1 1
      docs/reference/query-languages/esql/_snippets/functions/description/to_geohex.md
  6. 1 1
      docs/reference/query-languages/esql/_snippets/functions/description/to_geotile.md
  7. 3 0
      docs/reference/query-languages/esql/_snippets/lists/spatial-functions.md
  8. 3 0
      docs/reference/query-languages/esql/_snippets/lists/type-conversion-functions.md
  9. 9 0
      docs/reference/query-languages/esql/functions-operators/spatial-functions.md
  10. 9 0
      docs/reference/query-languages/esql/functions-operators/type-conversion-functions.md
  11. 1 1
      docs/reference/query-languages/esql/kibana/definition/functions/st_geohash.json
  12. 1 1
      docs/reference/query-languages/esql/kibana/definition/functions/st_geohex.json
  13. 1 1
      docs/reference/query-languages/esql/kibana/definition/functions/st_geotile.json
  14. 2 2
      docs/reference/query-languages/esql/kibana/definition/functions/to_geohash.json
  15. 2 2
      docs/reference/query-languages/esql/kibana/definition/functions/to_geohex.json
  16. 2 2
      docs/reference/query-languages/esql/kibana/definition/functions/to_geotile.json
  17. 1 1
      docs/reference/query-languages/esql/kibana/docs/functions/st_geohash.md
  18. 1 1
      docs/reference/query-languages/esql/kibana/docs/functions/st_geohex.md
  19. 1 1
      docs/reference/query-languages/esql/kibana/docs/functions/st_geotile.md
  20. 2 1
      docs/reference/query-languages/esql/kibana/docs/functions/to_geohash.md
  21. 2 1
      docs/reference/query-languages/esql/kibana/docs/functions/to_geohex.md
  22. 2 1
      docs/reference/query-languages/esql/kibana/docs/functions/to_geotile.md
  23. 7 13
      x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/spatial/SpatialGridLicenseTestCase.java
  24. 3 3
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
  25. 6 6
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java
  26. 2 1
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToGeohash.java
  27. 2 1
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToGeohex.java
  28. 2 1
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToGeotile.java
  29. 1 1
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohash.java
  30. 1 1
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohex.java
  31. 1 1
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeotile.java
  32. 1 1
      x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml

+ 1 - 1
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).
 

+ 1 - 1
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).
 

+ 1 - 1
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).
 

+ 1 - 1
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).
 

+ 1 - 1
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).
 

+ 1 - 1
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).
 

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

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

+ 9 - 0
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
+:::

+ 9 - 0
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
 :::
 

+ 1 - 1
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
 }

+ 1 - 1
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
 }

+ 1 - 1
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
 }

+ 2 - 2
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" : [
@@ -57,5 +57,5 @@
     "ROW string = \"u3bu\"\n| EVAL geohash = TO_GEOHASH(string)"
   ],
   "preview" : true,
-  "snapshot_only" : true
+  "snapshot_only" : false
 }

+ 2 - 2
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" : [
@@ -57,5 +57,5 @@
     "ROW string = \"841f059ffffffff\"\n| EVAL geohex = TO_GEOHEX(string)"
   ],
   "preview" : true,
-  "snapshot_only" : true
+  "snapshot_only" : false
 }

+ 2 - 2
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" : [
@@ -57,5 +57,5 @@
     "ROW string = \"4/8/5\"\n| EVAL geotile = TO_GEOTILE(string)"
   ],
   "preview" : true,
-  "snapshot_only" : true
+  "snapshot_only" : false
 }

+ 1 - 1
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)

+ 1 - 1
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)

+ 1 - 1
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)

+ 2 - 1
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"

+ 2 - 1
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"

+ 2 - 1
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"

+ 7 - 13
x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/spatial/SpatialGridLicenseTestCase.java

@@ -61,10 +61,10 @@ public abstract class SpatialGridLicenseTestCase extends AbstractEsqlIntegTestCa
     }
 
     /**
-     * Test that the geo_grid functions are disabled outside of SNAPSHOT.
+     * Test that the geo_grid functions are enabled outside of SNAPSHOT.
      */
-    public void testGeoGridDisabled() {
-        assertGeoGridDisabledWith("index_geo_point");
+    public void testGeoGridEnabled() {
+        assertGeoGridEnabled();
     }
 
     /**
@@ -120,16 +120,10 @@ public abstract class SpatialGridLicenseTestCase extends AbstractEsqlIntegTestCa
         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<String, Long> getValuesMap(Iterator<Iterator<Object>> values) {

+ 3 - 3
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

@@ -414,17 +414,17 @@ public class EsqlCapabilities {
         /**
          * 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

+ 6 - 6
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java

@@ -422,6 +422,9 @@ public class EsqlFunctionRegistry {
                 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"),
@@ -448,6 +451,9 @@ public class EsqlFunctionRegistry {
                 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"),
@@ -510,12 +516,6 @@ public class EsqlFunctionRegistry {
                 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"),

+ 2 - 1
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(

+ 2 - 1
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(

+ 2 - 1
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(

+ 1 - 1
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohash.java

@@ -118,7 +118,7 @@ public class StGeohash extends SpatialGridFunction implements EvaluatorMapper {
         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)

+ 1 - 1
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeohex.java

@@ -119,7 +119,7 @@ public class StGeohex extends SpatialGridFunction implements EvaluatorMapper {
         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)

+ 1 - 1
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeotile.java

@@ -115,7 +115,7 @@ public class StGeotile extends SpatialGridFunction implements EvaluatorMapper {
         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)

+ 1 - 1
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: 144} # 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: