Skip to content

Commit 620ddc8

Browse files
authored
Add the MultiTerms aggregation
1 parent 7874040 commit 620ddc8

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

elasticsearch_dsl/aggs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,10 @@ def result(self, search, data):
296296
return FieldBucketData(self, search, data)
297297

298298

299+
class MultiTerms(Bucket):
300+
name = "multi_terms"
301+
302+
299303
# metric aggregations
300304
class TopHits(Agg):
301305
name = "top_hits"

tests/test_aggs.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,18 @@ def test_variable_width_histogram_aggregation():
300300
assert {"variable_width_histogram": {"buckets": 2, "field": "price"}} == a.to_dict()
301301

302302

303+
def test_multi_terms_aggregation():
304+
a = aggs.MultiTerms(terms=[{"field": "tags"}, {"field": "author.row"}])
305+
assert {
306+
"multi_terms": {
307+
"terms": [
308+
{"field": "tags"},
309+
{"field": "author.row"},
310+
]
311+
}
312+
} == a.to_dict()
313+
314+
303315
def test_median_absolute_deviation_aggregation():
304316
a = aggs.MedianAbsoluteDeviation(field="rating")
305317

0 commit comments

Comments
 (0)