ES|QL ST_GEOMETRYTYPE function
geometry-
Expression of type
geo_point,geo_shape,cartesian_pointorcartesian_shape. Ifnull, the function returnsnull.
Returns the geometry type of the supplied geometry, as a string. For example: ST_Point, ST_LineString, ST_Polygon, ST_MultiPoint, ST_MultiLineString, ST_MultiPolygon, or ST_GeometryCollection.
| geometry | result |
|---|---|
| cartesian_point | keyword |
| cartesian_shape | keyword |
| geo_point | keyword |
| geo_shape | keyword |
ROW wkt = [
"POINT(1.0 2.0)",
"LINESTRING (30 10, 10 30, 40 40)",
"POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))"]
| MV_EXPAND wkt
| EVAL geometry = TO_GEOSHAPE(wkt),
type = ST_GEOMETRYTYPE(geometry),
points = ST_NPOINTS(geometry)
| KEEP type, points
| type:keyword | points:integer |
|---|---|
| ST_Point | 1 |
| ST_LineString | 3 |
| ST_Polygon | 5 |