diff --git a/docs/changelog/125143.yaml b/docs/changelog/125143.yaml deleted file mode 100644 index 83e15973f9932..0000000000000 --- a/docs/changelog/125143.yaml +++ /dev/null @@ -1,6 +0,0 @@ -pr: 125143 -summary: "ES|QL Support for ST_GEOHASH, ST_GEOTILE and ST_GEOHEX" -area: "ES|QL" -type: enhancement -issues: - - 123903 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 763c45ba92460..83cfdd4c60867 100644 --- a/docs/reference/query-languages/esql/_snippets/lists/spatial-functions.md +++ b/docs/reference/query-languages/esql/_snippets/lists/spatial-functions.md @@ -10,12 +10,3 @@ * [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_GEOTILE_TO_STRING`](../../functions-operators/spatial-functions.md#esql-st_geotile_to_string) - * [preview] [`ST_GEOTILE_TO_LONG`](../../functions-operators/spatial-functions.md#esql-st_geotile_to_long) -* [preview] [`ST_GEOHEX`](../../functions-operators/spatial-functions.md#esql-st_geohex) - * [preview] [`ST_GEOHEX_TO_STRING`](../../functions-operators/spatial-functions.md#esql-st_geohex_to_string) - * [preview] [`ST_GEOHEX_TO_LONG`](../../functions-operators/spatial-functions.md#esql-st_geohex_to_long) -* [preview] [`ST_GEOHASH`](../../functions-operators/spatial-functions.md#esql-st_geohash) - * [preview] [`ST_GEOHASH_TO_STRING`](../../functions-operators/spatial-functions.md#esql-st_geohash_to_string) - * [preview] [`ST_GEOHASH_TO_LONG`](../../functions-operators/spatial-functions.md#esql-st_geohash_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 912401a3c0161..806e5e8157a63 100644 --- a/docs/reference/query-languages/esql/functions-operators/spatial-functions.md +++ b/docs/reference/query-languages/esql/functions-operators/spatial-functions.md @@ -48,29 +48,3 @@ mapped_pages: :::{include} ../_snippets/functions/layout/st_ymin.md ::: -:::{include} ../_snippets/functions/layout/st_geotile.md -::: - -:::{include} ../_snippets/functions/layout/st_geotile_to_string.md -::: - -:::{include} ../_snippets/functions/layout/st_geotile_to_long.md -::: - -:::{include} ../_snippets/functions/layout/st_geohex.md -::: - -:::{include} ../_snippets/functions/layout/st_geohex_to_string.md -::: - -:::{include} ../_snippets/functions/layout/st_geohex_to_long.md -::: - -:::{include} ../_snippets/functions/layout/st_geohash.md -::: - -:::{include} ../_snippets/functions/layout/st_geohash_to_string.md -::: - -:::{include} ../_snippets/functions/layout/st_geohash_to_long.md -::: 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 d9f5a981e5108..e019d408667ef 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(*),\n centroid = ST_CENTROID_AGG(location)\n BY geohash\n| WHERE count >= 10\n| EVAL geohashString = ST_GEOHASH_TO_STRING(geohash)\n| KEEP count, centroid, geohashString\n| SORT count DESC, geohashString ASC" ], "preview" : false, - "snapshot_only" : false + "snapshot_only" : true } diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash_to_long.json b/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash_to_long.json index 27f0048ba4e43..024d03b16e6be 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash_to_long.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash_to_long.json @@ -33,5 +33,5 @@ "ROW geohash = \"u3bu\"\n| EVAL geohashLong = ST_GEOHASH_TO_LONG(geohash)" ], "preview" : false, - "snapshot_only" : false + "snapshot_only" : true } diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash_to_string.json b/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash_to_string.json index 07d3e57f13a7e..dc3c6529f07eb 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash_to_string.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/st_geohash_to_string.json @@ -33,5 +33,5 @@ "ROW geohash = TO_LONG(13686180)\n| EVAL geohashString = ST_GEOHASH_TO_STRING(geohash)" ], "preview" : false, - "snapshot_only" : false + "snapshot_only" : true } 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 e172f317b3e4d..cd0d7d3b82f1c 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(*),\n centroid = ST_CENTROID_AGG(location)\n BY geohex\n| WHERE count >= 10\n| EVAL geohexString = ST_GEOHEX_TO_STRING(geohex)\n| KEEP count, centroid, geohexString\n| SORT count DESC, geohexString ASC" ], "preview" : false, - "snapshot_only" : false + "snapshot_only" : true } diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/st_geohex_to_long.json b/docs/reference/query-languages/esql/kibana/definition/functions/st_geohex_to_long.json index a7733bf4cee2f..b08a5c62e5a47 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/st_geohex_to_long.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/st_geohex_to_long.json @@ -33,5 +33,5 @@ "ROW geohex = \"841f059ffffffff\"\n| EVAL geohexLong = ST_GEOHEX_TO_LONG(geohex)" ], "preview" : false, - "snapshot_only" : false + "snapshot_only" : true } diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/st_geohex_to_string.json b/docs/reference/query-languages/esql/kibana/definition/functions/st_geohex_to_string.json index 757876b43d6ba..e787931fdb8e1 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/st_geohex_to_string.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/st_geohex_to_string.json @@ -33,5 +33,5 @@ "ROW geohex = 595020895127339007\n| EVAL geohexString = ST_GEOHEX_TO_STRING(geohex)" ], "preview" : false, - "snapshot_only" : false + "snapshot_only" : true } 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 a77236dd6a592..64e8f9cfea9ab 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(*),\n centroid = ST_CENTROID_AGG(location)\n BY geotile\n| EVAL geotileString = ST_GEOTILE_TO_STRING(geotile)\n| SORT count DESC, geotileString ASC\n| KEEP count, centroid, geotileString" ], "preview" : false, - "snapshot_only" : false + "snapshot_only" : true } diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/st_geotile_to_long.json b/docs/reference/query-languages/esql/kibana/definition/functions/st_geotile_to_long.json index 74dc9021a0bd6..407117a5c0b26 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/st_geotile_to_long.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/st_geotile_to_long.json @@ -33,5 +33,5 @@ "ROW geotile = \"4/8/5\"\n| EVAL geotileLong = ST_GEOTILE_TO_LONG(geotile)" ], "preview" : false, - "snapshot_only" : false + "snapshot_only" : true } diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/st_geotile_to_string.json b/docs/reference/query-languages/esql/kibana/definition/functions/st_geotile_to_string.json index 23eeb00ac65e5..c27faa68049de 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/st_geotile_to_string.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/st_geotile_to_string.json @@ -33,5 +33,5 @@ "ROW geotile = 1152921508901814277\n| EVAL geotileString = ST_GEOTILE_TO_STRING(geotile)" ], "preview" : false, - "snapshot_only" : false + "snapshot_only" : true } 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 a59df618641de..9a8b71e8e5eea 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 @@ -382,7 +382,7 @@ public enum Cap { /** * Support ST_GEOHASH, ST_GEOTILE and ST_GEOHEX functions */ - SPATIAL_GRID, + SPATIAL_GRID(Build.current().isSnapshot()), /** * 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 b115eb5c33c6e..bf6affb49a0b2 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 @@ -401,16 +401,7 @@ private static FunctionDefinition[][] functions() { def(StYMax.class, StYMax::new, "st_ymax"), def(StYMin.class, StYMin::new, "st_ymin"), def(StX.class, StX::new, "st_x"), - def(StY.class, StY::new, "st_y"), - def(StGeohash.class, StGeohash::new, "st_geohash"), - def(StGeohashToLong.class, StGeohashToLong::new, "st_geohash_to_long"), - def(StGeohashToString.class, StGeohashToString::new, "st_geohash_to_string"), - def(StGeotile.class, StGeotile::new, "st_geotile"), - def(StGeotileToLong.class, StGeotileToLong::new, "st_geotile_to_long"), - def(StGeotileToString.class, StGeotileToString::new, "st_geotile_to_string"), - def(StGeohex.class, StGeohex::new, "st_geohex"), - def(StGeohexToLong.class, StGeohexToLong::new, "st_geohex_to_long"), - def(StGeohexToString.class, StGeohexToString::new, "st_geohex_to_string") }, + def(StY.class, StY::new, "st_y") }, // conditional new FunctionDefinition[] { def(Case.class, Case::new, "case") }, // null @@ -487,7 +478,16 @@ private static FunctionDefinition[][] snapshotFunctions() { def(LastOverTime.class, LastOverTime::withUnresolvedTimestamp, "last_over_time"), def(FirstOverTime.class, FirstOverTime::withUnresolvedTimestamp, "first_over_time"), def(Term.class, bi(Term::new), "term"), - def(Knn.class, tri(Knn::new), "knn") } }; + def(Knn.class, tri(Knn::new), "knn"), + def(StGeohash.class, StGeohash::new, "st_geohash"), + def(StGeohashToLong.class, StGeohashToLong::new, "st_geohash_to_long"), + def(StGeohashToString.class, StGeohashToString::new, "st_geohash_to_string"), + def(StGeotile.class, StGeotile::new, "st_geotile"), + def(StGeotileToLong.class, StGeotileToLong::new, "st_geotile_to_long"), + def(StGeotileToString.class, StGeotileToString::new, "st_geotile_to_string"), + def(StGeohex.class, StGeohex::new, "st_geohex"), + def(StGeohexToLong.class, StGeohexToLong::new, "st_geohex_to_long"), + def(StGeohexToString.class, StGeohexToString::new, "st_geohex_to_string") } }; } public EsqlFunctionRegistry snapshotRegistry() {