From dc5a835060e39b8084d18921d21d71f4ae211ff3 Mon Sep 17 00:00:00 2001 From: Telomeraz Date: Sat, 21 May 2022 12:33:40 +0300 Subject: [PATCH] Add GeohexGrid aggregation --- elasticsearch_dsl/aggs.py | 4 ++++ tests/test_aggs.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/elasticsearch_dsl/aggs.py b/elasticsearch_dsl/aggs.py index d9412e26..69c2d85e 100644 --- a/elasticsearch_dsl/aggs.py +++ b/elasticsearch_dsl/aggs.py @@ -209,6 +209,10 @@ class GeohashGrid(Bucket): name = "geohash_grid" +class GeohexGrid(Bucket): + name = "geohex_grid" + + class GeotileGrid(Bucket): name = "geotile_grid" diff --git a/tests/test_aggs.py b/tests/test_aggs.py index 936c2bcd..aa928de4 100644 --- a/tests/test_aggs.py +++ b/tests/test_aggs.py @@ -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})