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 terms aggregation is in the official elasticsearch docs
A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value.
{
"aggregations" : {
"genders" : {
"terms" : { "field" : "gender" }
}
}
}
And now the query via DSL:
$termsAggregation = new TermsAggregation('genders', 'gender');
$search = new Search();
$search->addAggregation($termsAggregation);
$queryArray = $search->toArray();
How can I help you explore Laravel packages today?