Skip to content

Commit

Permalink
Add GeohexGrid aggregation (#1591)
Browse files Browse the repository at this point in the history
  • Loading branch information
Telomeraz committed Apr 15, 2024
1 parent f091a23 commit acd63a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions elasticsearch_dsl/aggs.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ class GeohashGrid(Bucket):
name = "geohash_grid"


class GeohexGrid(Bucket):
name = "geohex_grid"


class GeotileGrid(Bucket):
name = "geotile_grid"

Expand Down
6 changes: 6 additions & 0 deletions tests/test_aggs.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ def test_geohash_grid_aggregation():
assert {"geohash_grid": {"field": "centroid", "precision": 3}} == a.to_dict()


def test_geohex_grid_aggregation():
a = aggs.GeohexGrid(**{"field": "centroid", "precision": 3})

assert {"geohex_grid": {"field": "centroid", "precision": 3}} == a.to_dict()


def test_geotile_grid_aggregation():
a = aggs.GeotileGrid(**{"field": "centroid", "precision": 3})

Expand Down

0 comments on commit acd63a8

Please sign in to comment.