From 6f4c0afdede326f4ebf7dc28c0eacd927a9c34a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Emre=20Arma=C4=9Fan?= Date: Mon, 15 Apr 2024 17:59:31 +0100 Subject: [PATCH] Add Geo-Line aggregation (#1629) (cherry picked from commit 619daa1c28e687eab539ae3a052a53f9fb66fe07) --- elasticsearch_dsl/aggs.py | 4 ++++ tests/test_aggs.py | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/elasticsearch_dsl/aggs.py b/elasticsearch_dsl/aggs.py index 61a27f3c4..11612fb39 100644 --- a/elasticsearch_dsl/aggs.py +++ b/elasticsearch_dsl/aggs.py @@ -329,6 +329,10 @@ class GeoBounds(Agg): name = "geo_bounds" +class GeoLine(Agg): + name = "geo_line" + + class Max(Agg): name = "max" diff --git a/tests/test_aggs.py b/tests/test_aggs.py index 327892862..16c2ad5f3 100644 --- a/tests/test_aggs.py +++ b/tests/test_aggs.py @@ -334,6 +334,17 @@ def test_t_test_aggregation(): } == a.to_dict() +def test_geo_line_aggregation(): + a = aggs.GeoLine(point={"field": "centroid"}, sort={"field": "date"}) + + assert { + "geo_line": { + "point": {"field": "centroid"}, + "sort": {"field": "date"}, + }, + } == a.to_dict() + + def test_inference_aggregation(): a = aggs.Inference(model_id="model-id", buckets_path={"agg_name": "agg_name"}) assert {