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

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


## Syntax

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


## Parameters

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


## Description

Calculate the spatial extent over a field with geometry type. Returns a bounding box for all values of the field.

## Supported types


| field           | result          |
|-----------------|-----------------|
| cartesian_point | cartesian_shape |
| cartesian_shape | cartesian_shape |
| geo_point       | geo_shape       |
| geo_shape       | geo_shape       |


## Example

```esql
FROM airports
| WHERE country == "India"
| STATS extent = ST_EXTENT_AGG(location)
```


| extent:geo_shape                                                               |
|--------------------------------------------------------------------------------|
| BBOX (70.77995480038226, 91.5882289968431, 33.9830909203738, 8.47650992218405) |