﻿---
title: ES|QL ST_CENTROID_AGG function
description: 
url: https://www.elastic.co/elastic/docs-builder/docs/2856/reference/query-languages/esql/functions-operators/aggregation-functions/st_centroid_agg
products:
  - Elasticsearch
---

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


## Syntax

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


## Parameters

<definitions>
  <definition term="field">
  </definition>
</definitions>


## Description

Calculate the spatial centroid over a field with spatial geometry type. Supports `geo_point` and `cartesian_point`, as well as `geo_shape` and `cartesian_shape` <applies-to>Elastic Stack: Planned</applies-to>.

## Supported types


| field                                                           | result          |
|-----------------------------------------------------------------|-----------------|
| cartesian_point                                                 | cartesian_point |
| cartesian_shape <applies-to>Elastic Stack: Planned</applies-to> | cartesian_point |
| geo_point                                                       | geo_point       |
| geo_shape <applies-to>Elastic Stack: Planned</applies-to>       | geo_point       |


## Example

```esql
FROM airports
| STATS centroid=ST_CENTROID_AGG(location)
```


| centroid:geo_point                             |
|------------------------------------------------|
| POINT(-0.030548143003023033 24.37553649504829) |