瀏覽代碼

Update docs with support for geo_shape and cartesian_shape  (#104480)

* Document to_geoshape and to_cartesianshape

* Note that geo_point and point are now supported Elasticsearch types

* Fix doc links
Craig Taverner 1 年之前
父節點
當前提交
9ac356bbcf

+ 2 - 3
docs/reference/esql/esql-limitations.asciidoc

@@ -36,7 +36,9 @@ include::processing-commands/limit.asciidoc[tag=limitation]
 * `version`
 * Spatial types
 ** `geo_point`
+** `geo_shape`
 ** `point`
+** `shape`
 
 [discrete]
 ==== Unsupported types
@@ -47,9 +49,6 @@ include::processing-commands/limit.asciidoc[tag=limitation]
 ** `counter`
 ** `position`
 ** `aggregate_metric_double`
-* Spatial types
-** `geo_shape`
-** `shape`
 * Date/time
 ** `date_nanos`
 ** `date_range`

+ 4 - 0
docs/reference/esql/functions/to_cartesianpoint.asciidoc

@@ -17,3 +17,7 @@ include::{esql-specs}/spatial.csv-spec[tag=to_cartesianpoint-str]
 |===
 include::{esql-specs}/spatial.csv-spec[tag=to_cartesianpoint-str-result]
 |===
+
+Supported types:
+
+include::types/to_cartesianpoint.asciidoc[]

+ 23 - 0
docs/reference/esql/functions/to_cartesianshape.asciidoc

@@ -0,0 +1,23 @@
+[discrete]
+[[esql-to_cartesianshape]]
+=== `TO_CARTESIANSHAPE`
+Converts an input value to a `cartesian_shape` value.
+
+The input can be a single- or multi-valued field or an expression.
+The input type must be a string or a `cartesian_shape`.
+
+A string will only be successfully converted if it respects the
+https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry[WKT] format:
+
+[source.merge.styled,esql]
+----
+include::{esql-specs}/spatial_shapes.csv-spec[tag=to_cartesianshape-str]
+----
+[%header.monospaced.styled,format=dsv,separator=|]
+|===
+include::{esql-specs}/spatial_shapes.csv-spec[tag=to_cartesianshape-str-result]
+|===
+
+Supported types:
+
+include::types/to_cartesianshape.asciidoc[]

+ 4 - 0
docs/reference/esql/functions/to_geopoint.asciidoc

@@ -17,3 +17,7 @@ include::{esql-specs}/spatial.csv-spec[tag=to_geopoint-str]
 |===
 include::{esql-specs}/spatial.csv-spec[tag=to_geopoint-str-result]
 |===
+
+Supported types:
+
+include::types/to_geopoint.asciidoc[]

+ 23 - 0
docs/reference/esql/functions/to_geoshape.asciidoc

@@ -0,0 +1,23 @@
+[discrete]
+[[esql-to_geoshape]]
+=== `TO_GEOSHAPE`
+Converts an input value to a `geo_point` value.
+
+The input can be a single- or multi-valued field or an expression.
+The input type must be a string or a `geo_point`.
+
+A string will only be successfully converted if it respects the
+https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry[WKT] format:
+
+[source.merge.styled,esql]
+----
+include::{esql-specs}/spatial_shapes.csv-spec[tag=to_geoshape-str]
+----
+[%header.monospaced.styled,format=dsv,separator=|]
+|===
+include::{esql-specs}/spatial_shapes.csv-spec[tag=to_geoshape-str-result]
+|===
+
+Supported types:
+
+include::types/to_geoshape.asciidoc[]

+ 4 - 0
docs/reference/esql/functions/type-conversion-functions.asciidoc

@@ -10,10 +10,12 @@
 // tag::type_list[]
 * <<esql-to_boolean>>
 * <<esql-to_cartesianpoint>>
+* <<esql-to_cartesianshape>>
 * <<esql-to_datetime>>
 * <<esql-to_degrees>>
 * <<esql-to_double>>
 * <<esql-to_geopoint>>
+* <<esql-to_geoshape>>
 * <<esql-to_integer>>
 * <<esql-to_ip>>
 * <<esql-to_long>>
@@ -25,10 +27,12 @@
 
 include::to_boolean.asciidoc[]
 include::to_cartesianpoint.asciidoc[]
+include::to_cartesianshape.asciidoc[]
 include::to_datetime.asciidoc[]
 include::to_degrees.asciidoc[]
 include::to_double.asciidoc[]
 include::to_geopoint.asciidoc[]
+include::to_geoshape.asciidoc[]
 include::to_integer.asciidoc[]
 include::to_ip.asciidoc[]
 include::to_long.asciidoc[]

+ 7 - 0
docs/reference/esql/functions/types/to_cartesianpoint.asciidoc

@@ -0,0 +1,7 @@
+[%header.monospaced.styled,format=dsv,separator=|]
+|===
+v | result
+cartesian_point | cartesian_point
+keyword | cartesian_point
+text | cartesian_point
+|===

+ 7 - 0
docs/reference/esql/functions/types/to_cartesianshape.asciidoc

@@ -0,0 +1,7 @@
+[%header.monospaced.styled,format=dsv,separator=|]
+|===
+v | result
+cartesian_shape | cartesian_shape
+keyword | cartesian_shape
+text | cartesian_shape
+|===

+ 7 - 0
docs/reference/esql/functions/types/to_geopoint.asciidoc

@@ -0,0 +1,7 @@
+[%header.monospaced.styled,format=dsv,separator=|]
+|===
+v | result
+geo_point | geo_point
+keyword | geo_point
+text | geo_point
+|===

+ 7 - 0
docs/reference/esql/functions/types/to_geoshape.asciidoc

@@ -0,0 +1,7 @@
+[%header.monospaced.styled,format=dsv,separator=|]
+|===
+v | result
+geo_shape | geo_shape
+keyword | geo_shape
+text | geo_shape
+|===

+ 5 - 5
x-pack/plugin/esql/qa/testFixtures/src/main/resources/spatial.csv-spec

@@ -12,8 +12,8 @@ POINT(42.97109629958868 14.7552534006536) |POINT(42.97109629958868 14.7552534006
 
 convertFromString#[skip:-8.12.99, reason:spatial type geo_point improved precision in 8.13]
 // tag::to_geopoint-str[]
-row wkt = "POINT(42.97109630194 14.7552534413725)"
-| eval pt = to_geopoint(wkt)
+ROW wkt = "POINT(42.97109630194 14.7552534413725)"
+| EVAL pt = TO_GEOPOINT(wkt)
 // end::to_geopoint-str[]
 ;
 
@@ -107,9 +107,9 @@ wkt:keyword                               |pt:geo_point
 
 convertCartesianFromString#[skip:-8.12.99, reason:spatial type cartesian_point improved precision in 8.13]
 // tag::to_cartesianpoint-str[]
-row wkt = ["POINT(4297.11 -1475.53)", "POINT(7580.93 2272.77)"]
-| mv_expand wkt
-| eval pt = to_cartesianpoint(wkt)
+ROW wkt = ["POINT(4297.11 -1475.53)", "POINT(7580.93 2272.77)"]
+| MV_EXPAND wkt
+| EVAL pt = TO_CARTESIANPOINT(wkt)
 // end::to_cartesianpoint-str[]
 ;
 

+ 17 - 8
x-pack/plugin/esql/qa/testFixtures/src/main/resources/spatial_shapes.csv-spec

@@ -3,11 +3,16 @@
 #
 
 convertFromString#[skip:-8.12.99, reason: spatial type geo_shape only added in 8.13]
-row wkt = "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))"
-| eval pt = to_geoshape(wkt);
+// tag::to_geoshape-str[]
+ROW wkt = "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))"
+| EVAL geom = TO_GEOSHAPE(wkt)
+// end::to_geoshape-str[]
+;
 
-wkt:keyword                                     |pt:geo_shape
+// tag::to_geoshape-str-result[]
+wkt:keyword                                     | geom:geo_shape
 "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))" | POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))
+// end::to_geoshape-str-result[]
 ;
 
 convertFromStringArray#[skip:-8.12.99, reason: spatial type geo_shape only added in 8.13]
@@ -70,14 +75,18 @@ wkt:keyword                               |pt:geo_shape
 #
 
 convertCartesianShapeFromString#[skip:-8.12.99, reason: spatial type cartesian_shape only added in 8.13]
-
-row wkt = "POLYGON ((3339584.72 1118889.97, 4452779.63 4865942.27, 2226389.81 4865942.27, 1113194.90 2273030.92, 3339584.72 1118889.97))"
-| mv_expand wkt
-| eval pt = to_cartesianshape(wkt)
+// tag::to_cartesianshape-str[]
+ROW wkt = ["POINT(4297.11 -1475.53)", "POLYGON ((3339584.72 1118889.97, 4452779.63 4865942.27, 2226389.81 4865942.27, 1113194.90 2273030.92, 3339584.72 1118889.97))"]
+| MV_EXPAND wkt
+| EVAL geom = TO_CARTESIANSHAPE(wkt)
+// end::to_cartesianshape-str[]
 ;
 
-wkt:keyword               |pt:cartesian_shape 
+// tag::to_cartesianshape-str-result[]
+wkt:keyword               |geom:cartesian_shape
+"POINT(4297.11 -1475.53)" |POINT(4297.11 -1475.53)
 "POLYGON ((3339584.72 1118889.97, 4452779.63 4865942.27, 2226389.81 4865942.27, 1113194.90 2273030.92, 3339584.72 1118889.97))" |POLYGON ((3339584.72 1118889.97, 4452779.63 4865942.27, 2226389.81 4865942.27, 1113194.90 2273030.92, 3339584.72 1118889.97))
+// end::to_cartesianshape-str-result[]
 ;
 
 convertCartesianFromStringArray#[skip:-8.12.99, reason:spatial type cartesian_shape only added in 8.13]