ongr/elasticsearch-dsl
Object-oriented Elasticsearch query builder for PHP. Build searches, filters, aggregations and more with a DSL, then export to arrays for elasticsearch-php or ONGR ElasticsearchBundle. Supports Elasticsearch 5/6/7 via versioned releases.
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.
{
"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();
How can I help you explore Laravel packages today?