Geo bounds aggregation

Geo bounds aggregation #

A metrics aggregation computing the bounding box (top-left / bottom-right corners) of all geo_point values — the rectangle that just contains every point in the bucket.

How it works #

The engine scans the bucket’s geo_point column, tracks the minimum and maximum latitude and longitude, and emits:

{
  "bounds": {
    "top_left":     { "lat": <max lat>, "lon": <min lon> },
    "bottom_right": { "lat": <min lat>, "lon": <max lon> }
  }
}

null when the bucket holds no parseable point. The column-store fast path and the executor path run the same min/max scan.

geo_point fields are normalized at ingestion: an object {"lat": .., "lon": ..}, an array [lon, lat] (longitude first), and a "lat,lon" string all become the same internal point stored in a two-dimensional BKD index. Unparseable values are skipped at ingest time with a warning, so they never reach the aggregation.

wrap_longitude is accepted for compatibility but is not applied: the box is always the plain min/max span, never wrapped across the 180th meridian.

Examples #

Returns the bounds wrapping all 15 places — the box you would fit a map viewport to. On the teaching data the corners are top_left: {lat 45.8038, lon 87.6168} (Harbin’s latitude, Ürümqi’s longitude) and bottom_right: {lat 18.2528, lon 126.5349} (Sanya’s latitude, Harbin’s longitude).

Use cases #

  • Fit a map viewport — zoom a map to exactly the data shown, instead of a hardcoded region.
  • Pre-check before gridding — the extent tells you whether one geohash grid precision covers the data or several cells are needed.
  • Data QA — a wildly stretched box exposes stray points, such as a store mapped to the wrong hemisphere.
  • Coverage guard — verify that all delivery points stay inside a service region before plotting them.

Parameters for geo_bounds #

  • field
    (Required, string) geo_point field you wish to aggregate.
  • wrap_longitude
    (Optional, boolean) Accepted for compatibility; not applied — the box is always the plain min/max span.
Calendar October 6, 2026
Edit Edit this page