Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.

Extended Stats Aggregation

More info about extended stats aggregation is in the official elasticsearch docs

A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents.

Simple example

{
    "aggregations" : {
        "agg_grades_stats" : {
            "extended_stats" : { "field" : "grade" }
        }
    }
}

And now the query via DSL:

$extendedStatsAggregation = new ExtendedStatsAggregation('grades_stats', 'grade');

$search = new Search();
$search->addAggregation($extendedStatsAggregation);

$queryArray = $search->toArray();