get aggregations as collection
Opened this issue · 0 comments
Hello!
Im doing some queries in ES through laravel and I've made this query to remove duplicates :
$json = '{
"aggs":{
"dedup" : {
"terms":{
"field": "name"
},
"aggs":{
"dedup_docs":{
"top_hits":{
"size":1
}
}
}
}
}
}';
Now I need to get a collection. I've tried in this way but it doesn't work:
$search_params = array(
'index' => 'cif.observables-*',
'size' => 25000,
'search_type' => 'count'
);
$search_params['body'] = $json;
$cifs = new \Elasticquent\ElasticquentResultCollection($client->search($search_params), new \App\CustomModels\Cif);
In the blade page instead :
@foreach($cifs as $cif_element)
I don't receive anything.. blank page. If I make the query without the aggregation it will work.
Thanks in advance,
Danilo