diff --git a/elasticsearch_dsl/aggs.py b/elasticsearch_dsl/aggs.py index 8f91333a..61a27f3c 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 0874a66c..32789286 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])