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 and sub-aggregations #16537

Closed
bsideup opened this issue Feb 9, 2016 · 3 comments
Closed

top_hits and sub-aggregations #16537

bsideup opened this issue Feb 9, 2016 · 3 comments

Comments

@bsideup
Copy link

bsideup commented Feb 9, 2016

Hi!

Why top_hits doesn't allow to have sub-aggregations?

I.e. I want to calculate a median of last N hits in each category

@martijnvg
Copy link
Member

because the top_hits agg is a metric aggregations and metric aggs can't
have sub aggs.
How would you determine what last N hit would be the median? On what field
are you going to sort? Maybe instead use the percentile agg?

On 9 February 2016 at 16:01, Sergei Egorov notifications@github.com wrote:

Hi!

Why top_hits doesn't allow to have sub-aggregations?

I.e. I want to calculate a median of last N hits in each category


Reply to this email directly or view it on GitHub
#16537.

Met vriendelijke groet,

Martijn van Groningen

@bsideup
Copy link
Author

bsideup commented Feb 9, 2016

@martijnvg I use "sort" from top_hits for such decisions.

Also, I need to calculate median of exactly last N hits in each category, I can't calculate median (aka 50th percentile) of all hits :(

@clintongormley
Copy link

This sounds like you will need to postprocess your results on the client. As @martijnvg says, metric aggs can't support sub-aggs.

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

3 participants