The aggregations framework is available in the aggs.py file of the elasticsearch-dsl package. You can use the A() method to define an aggregation. There are provided classes for the supported aggregation types. A list of supported aggregation types and its provided classes are compiled in the following table. You can use the class to construct the aggregation object:
Category |
Aggregation type |
Provided class name |
Metrics |
avg |
Avg |
weighted_avg |
WeightedAvg |
|
cardinality |
Cardinality |
|
extended_stats |
ExtendedStats |
|
max |
Max |
|
min |
Min |
|
percentiles |
Percentiles |
|
percentile_ranks |
PercentRanks |
|
scripted_metric |
ScriptedMetric |
|
stats |
Stats |
|
sum |
Sum |
|
top_hots |
TopHits ... |