Skip to content

Stop terms agg from losing buckets (backport of #70493) #70670

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

Merged
merged 2 commits into from
Mar 22, 2021

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Mar 22, 2021

When the terms agg is at the top level it can run as a filters agg
instead because that is typically faster. This was added in #68871 and
we mistakely made it so that a bucket without any hits could take up a
slot on the way back to the coordinating node. You could trigger this by
having a fairly precise size on the terms agg and a top level filter.

This fixes the issue by properly mimicing the regular terms aggregator
in the "as filters" version: only send back buckets without any matching
documents if the min_doc_count is 0.

Closes #70449

When the `terms` agg is at the top level it can run as a `filters` agg
instead because that is typically faster. This was added in elastic#68871 and
we mistakely made it so that a bucket without any hits could take up a
slot on the way back to the coordinating node. You could trigger this by
having a fairly precise `size` on the terms agg and a top level filter.

This fixes the issue by properly mimicing the regular terms aggregator
in the "as filters" version: only send back buckets without any matching
documents if the min_doc_count is 0.

Closes elastic#70449
@nik9000
Copy link
Member Author

nik9000 commented Mar 22, 2021

@elasticmachine update branch

@nik9000 nik9000 merged commit b5e02b5 into elastic:7.x Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants