Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get aggregations as collection #37

Open
Danko90 opened this issue Jul 27, 2015 · 0 comments
Open

get aggregations as collection #37

Danko90 opened this issue Jul 27, 2015 · 0 comments

Comments

@Danko90
Copy link

Danko90 commented Jul 27, 2015

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)

{{{ $cif_element->observable }}}
{{{ $cif_element->provider }}}
{{{ $cif_element->tags[0] }}}
{{{ $cif_element->otype }}}
{{{ $cif_element->confidence }}}
@Endforeach

I don't receive anything.. blank page. If I make the query without the aggregation it will work.

Thanks in advance,
Danilo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant