## ST_CENTROID_AGG

ST_CENTROID_AGG is a function that calculates the spatial centroid over a field with spatial point geometry type. This functionality is currently in technical preview and may be changed or removed in a future release.

### Examples

Here are a couple of examples of full ES|QL queries using the ST_CENTROID_AGG function:

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

In this example, the ST_CENTROID_AGG function is used to calculate the spatial centroid over the 'location' field from the 'airports' index.

```esql
FROM geo_data
| STATS geo_centroid = ST_CENTROID_AGG(geo_point)
```

In this second example, the ST_CENTROID_AGG function is used to calculate the spatial centroid over the 'geo_point' field from the 'geo_data' index.