---
title: ES|QL ST_GEOMETRYTYPE function
description: 
url: https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/spatial-functions/st_geometrytype
products:
  - Elasticsearch
---

# ES|QL ST_GEOMETRYTYPE function
<applies-to>
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Planned
</applies-to>


## Syntax

![Embedded](https://www.elastic.co/docs/reference/query-languages/esql/images/functions/st_geometrytype.svg)


## Parameters

<definitions>
  <definition term="geometry">
    Expression of type `geo_point`, `geo_shape`, `cartesian_point` or `cartesian_shape`. If `null`, the function returns `null`.
  </definition>
</definitions>


## Description

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`.

## Supported types


| geometry        | result  |
|-----------------|---------|
| cartesian_point | keyword |
| cartesian_shape | keyword |
| geo_point       | keyword |
| geo_shape       | keyword |


## Example

```esql
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              |