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();