Type to search.

ES|QL ST_GEOTILE function

Serverless Preview

Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud.

Availability

  • Preview

    This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply.

Serverless interfaces and procedures might differ from classic Elastic Stack deployments.

Stack Preview 9.2+

The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats.

Availability

  • Preview since 9.2

    This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply.

Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

Calculates the geotile of the supplied geo_point or geo_shape at the specified precision.

Embedded
Embedded
geometry
Expression of type geo_point or geo_shape. If null, the function returns null. For geo_shape inputs all intersecting geotile cells are returned as multi-values.
precision
Expression of type integer. If null, the function returns null. Valid values are between 0 and 29.
bounds

Optional bounds to filter the grid tiles, a geo_shape of type BBOX. Use ST_ENVELOPE if the geo_shape is of any other type.

Calculates the geotile of the supplied geo_point or geo_shape at the specified precision. For geo_shape inputs, all intersecting geotile cells are returned as multi-values. The result is long encoded. Use TO_STRING to convert the result to a string, TO_LONG to convert it to a long, or TO_GEOSHAPE to calculate the geo_shape bounding geometry. These functions are related to the geo_grid query and the geotile_grid aggregation.

geometry precision bounds result
geo_point integer geo_shape geotile
geo_point integer geotile
geo_shape The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability Planned We plan to add this functionality in a future Elastic Stack update. Subject to changes. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes. integer geo_shape geotile
geo_shape The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability Planned We plan to add this functionality in a future Elastic Stack update. Subject to changes. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes. integer geotile
ES|QL
FROM airports
| EVAL geotile = ST_GEOTILE(location, 2)
| STATS
    count = COUNT(geotile),
    centroid = ST_CENTROID_AGG(location)
      BY geotile
| EVAL geotileString = TO_STRING(geotile)
| SORT count DESC, geotileString ASC
| KEEP count, centroid, geotileString
count:long centroid:geo_point geotileString:keyword
286 POINT (39.31202001609169 35.149993664386415) 2/2/1
197 POINT (-55.387361375756825 31.952955322292855) 2/1/1
136 POINT (-110.97162496141048 36.87185255084734) 2/0/1
106 POINT (119.35907618669827 25.46263281488791) 2/3/1
67 POINT (-58.031108492373754 -22.624166105151065) 2/1/2
46 POINT (142.95455511274707 -20.581492295427978) 2/3/2
34 POINT (31.38476753634784 -14.64374022804858) 2/2/2
8 POINT (-160.0723083713092 -19.124013530672528) 2/0/2
6 POINT (23.95813101902604 70.17537698848173) 2/2/0
3 POINT (-133.4001641627401 72.06833167467266) 2/0/0
2 POINT (-68.47209956031293 66.77569948369637) 2/1/0