Skip to content

Commit ab787b4

Browse files
Add support for geotile_grid agg
1 parent c94fc9a commit ab787b4

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

elasticsearch_dsl/aggs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ class GeoDistance(Bucket):
174174
class GeohashGrid(Bucket):
175175
name = 'geohash_grid'
176176

177+
class GeotileGrid(Bucket):
178+
name = 'geotile_grid'
179+
177180
class GeoCentroid(Bucket):
178181
name = 'geo_centroid'
179182

test_elasticsearch_dsl/test_aggs.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,23 @@ def test_bucket_sort_agg_only_trnunc():
252252
}
253253
}
254254
} == a.to_dict()
255+
256+
def test_geohash_grid_aggregation():
257+
a = aggs.GeohashGrid(**{'field': 'centroid', 'precision': 3})
258+
259+
assert {
260+
'geohash_grid': {
261+
'field': 'centroid',
262+
'precision': 3
263+
}
264+
} == a.to_dict()
265+
266+
def test_geotile_grid_aggregation():
267+
a = aggs.GeotileGrid(**{'field': 'centroid', 'precision': 3})
268+
269+
assert {
270+
'geotile_grid': {
271+
'field': 'centroid',
272+
'precision': 3
273+
}
274+
} == a.to_dict()

0 commit comments

Comments
 (0)