Skip to content

Commit 511f1a9

Browse files
committed
Adding composite aggregation, including an example helper
Fixes elastic#902
1 parent d46330a commit 511f1a9

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

elasticsearch_dsl/aggs.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,13 @@ class Sampler(Bucket):
209209
class DiversifiedSampler(Bucket):
210210
name = 'diversified_sampler'
211211

212+
class Composite(Bucket):
213+
name = 'composite'
214+
_param_defs = {
215+
'sources': {'type': 'agg', 'hash': True},
216+
'aggs': {'type': 'agg', 'hash': True},
217+
}
218+
212219
# metric aggregations
213220
class TopHits(Agg):
214221
name = 'top_hits'

examples/README.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,11 @@ For simplicity we use a timestamp as version in the index name.
2020

2121
More complex example highlighting the possible relationships available in
2222
elasticsearch - parent/child and nested.
23+
24+
``composite_agg.py``
25+
--------------------
26+
27+
A helper function using the `composite aggregation
28+
<https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-composite-aggregation.html>`_
29+
to paginate over aggregation results.
30+

0 commit comments

Comments
 (0)