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

Top Hits Aggregation #718

Closed
akorthaus opened this issue Nov 8, 2014 · 3 comments
Closed

Top Hits Aggregation #718

akorthaus opened this issue Nov 8, 2014 · 3 comments

Comments

@akorthaus
Copy link

Hi!

Does Elastica offer support for Top Hits Aggregation (introduced with elasticsearch 1.3)?

http://www.elasticsearch.org/blog/top-hits-aggregation/
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html

I could not find anything about it in the code, also seems not very simple to implement, but would be a very useful addition!

Thank you!

best
Andreas

@ruflin
Copy link
Owner

ruflin commented Nov 11, 2014

TopHits is unfortunately not implemented yet. But it can be easily added on top of the abstract aggregation: https://github.com/ruflin/Elastica/tree/master/lib/Elastica/Aggregation

Also in case you urgently need a function which is not in the code yet you can always use raw query: http://elastica.io/example/raw-array-query.html

Feel free to open a pull request with this addition.

@akorthaus
Copy link
Author

Thanks!
TopHits will return documents inside (grouped by) the aggregation: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html#_example

I'm not aware of any method like that, can elastica handle that already?

@ruflin
Copy link
Owner

ruflin commented Nov 13, 2014

I didn't test it yet, but I assume it will handle it quite well. But as it not "natively" supported yet there will be some traversing needed through the response object. In case it doesn't we will extend Elastica to make it work.

@ruflin ruflin closed this as completed in 4dfacf3 Jan 13, 2015
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

2 participants