Skip to content

[elasticgraph]: Add geographic tile grouping - #1436

Closed
zandt-square wants to merge 1 commit into
block:mainfrom
zandt-square:zandt-geo-tile-grouping
Closed

zandt-square wants to merge 1 commit into
block:mainfrom
zandt-square:zandt-geo-tile-grouping

Conversation

@zandt-square

@zandt-square zandt-square commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Why

GeoLocation fields cannot currently be grouped in aggregation queries. This adds the geographic grouping API discussed in #1426.

What

Adds asGeoTile(zoomLevel: ...), with a default zoom level of 7. Each tile exposes zoomLevel, x, y, centerPoint, bounds, and corners.

How

Uses geotile_grid for both root and nested aggregations on Elasticsearch and OpenSearch. The response decodes the tile key into Web Mercator coordinates. Missing locations return a null tile, and root pagination compares tile coordinates in datastore order.

Standalone nested geo grids use conservative count bounds because the datastore does not provide their count error bounds.

Risk

This adds a new grouping API. Existing filtering and non-geographic grouping behavior is unchanged.

Testing

No manual testing.

Generated with Pi

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@zandt-square
zandt-square force-pushed the zandt-geo-tile-grouping branch 2 times, most recently from fb022ef to ba79c02 Compare October 15, 2026 14:39

@myronmarston myronmarston left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good! Left some suggestions. (Note: I haven't finished my initial review so I'll have more feedback at a later time, but I wanted to submit what I had so far).

Comment thread elasticgraph-graphql/lib/elastic_graph/graphql/aggregation/geo_tile.rb Outdated
Comment thread config/site/src/query-api/aggregations/grouping.md
Comment thread elasticgraph-graphql/lib/elastic_graph/graphql/aggregation/query_adapter.rb Outdated
Comment thread elasticgraph-graphql/lib/elastic_graph/graphql/aggregation/query_adapter.rb Outdated
Comment thread config/schema/artifacts/schema.graphql Outdated
Comment thread elasticgraph-graphql/lib/elastic_graph/graphql/aggregation/geo_tile.rb Outdated
@zandt-square
zandt-square force-pushed the zandt-geo-tile-grouping branch from ba79c02 to c53e79f Compare October 20, 2026 23:02
@zandt-square

Copy link
Copy Markdown
Collaborator Author

This is looking good! Left some suggestions. (Note: I haven't finished my initial review so I'll have more feedback at a later time, but I wanted to submit what I had so far).

Thanks @myronmarston. I pushed the updates.

asGeoTile now has its own resolver, and the tile, bounds, and corners use ResolvableValue. GroupedBy no longer has geo-specific logic. I also moved sorting onto grouping.sort_value, added the shared zoom range, tightened integer parsing, and applied the naming and validation wording changes.

The grouping docs are split into subpages with an expandable nav. I clarified the boundary and corner descriptions too.

For centerPoint, I kept the projection math and clarified that it’s the latitude that differs from the average latitude bounds. The docs now include the 1/0/0 example: approximately 66.51° versus 42.53°.

@zandt-square
zandt-square force-pushed the zandt-geo-tile-grouping branch from c53e79f to 9498f27 Compare October 21, 2026 14:10
@zandt-square

Copy link
Copy Markdown
Collaborator Author

@myronmarston I am closing this pr in favor of this one on the block org, which I recently gained access. #1438

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants