From ba2e815cc28334e562e889f22f79b4c6884e2cb2 Mon Sep 17 00:00:00 2001 From: Telomeraz Date: Sun, 16 Oct 2022 14:12:41 +0300 Subject: [PATCH] Add MatrixStats 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 8f91333aa..61a27f3c4 100644 --- a/elasticsearch_dsl/aggs.py +++ b/elasticsearch_dsl/aggs.py @@ -333,6 +333,10 @@ class Max(Agg): name = "max" +class MatrixStats(Agg): + name = "matrix_stats" + + class MedianAbsoluteDeviation(Agg): name = "median_absolute_deviation" diff --git a/tests/test_aggs.py b/tests/test_aggs.py index 0874a66c4..327892862 100644 --- a/tests/test_aggs.py +++ b/tests/test_aggs.py @@ -341,6 +341,12 @@ def test_inference_aggregation(): } == a.to_dict() +def test_matrix_stats_aggregation(): + a = aggs.MatrixStats(fields=["poverty", "income"]) + + assert {"matrix_stats": {"fields": ["poverty", "income"]}} == a.to_dict() + + def test_moving_percentiles_aggregation(): a = aggs.DateHistogram() a.bucket("the_percentile", "percentiles", field="price", percents=[1.0, 99.0])