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

Max Aggregation

More info about max aggregation is in the official elasticsearch docs

A single-value metrics aggregation that keeps track and returns the maximum value among the numeric values extracted from the aggregated documents.

Simple example

{
    "aggregations" : {
        "max_price" : { "max" : { "field" : "price" } }
    }
}

And now the query via DSL:

$maxAggregation = new MaxAggregation('max_price', 'price');

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

$queryArray = $search->toArray();