Skip to content

Improve reduction of terms aggregations (#61779) #62028

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
Sep 7, 2020

Conversation

jimczi
Copy link
Contributor

@jimczi jimczi commented Sep 7, 2020

Backport of #61779

* Improve reduction of terms aggregations

Today, the terms aggregation reduces multiple aggregations at once using a map
to group same buckets together. This operation can be costly since it requires
to lookup every bucket in a global map with no particular order.
This commit changes how term buckets are sorted by shards and partial reduces in
order to be able to reduce results using a merge-sort strategy.
For bwc, results are merged with the legacy code if any of the aggregations use
a different sort (if it was returned by a node in prior versions).

Relates elastic#51857
@jimczi jimczi added the backport label Sep 7, 2020
jimczi added a commit to jimczi/elasticsearch that referenced this pull request Sep 7, 2020
This commit adapts the bwc version checks added in elastic#61779 and disable
bwc tests until the backport elastic#62028 is merged.
jimczi added a commit that referenced this pull request Sep 7, 2020
This commit adapts the bwc version checks added in #61779 and disable
bwc tests until the backport #62028 is merged.
@jimczi jimczi merged commit fa8e76a into elastic:7.x Sep 7, 2020
@jimczi jimczi deleted the terms_reduce_backport branch September 7, 2020 11:13
jimczi added a commit to jimczi/elasticsearch that referenced this pull request Sep 21, 2020
This commit ensures that the final order of the terms aggregations
is registered correctly after the final reduce.
This bug was introduced in elastic#62028 which is not released yet so this PR is marked
as a non-issue.
This issue was discovered when running a terms aggregation under an auto-date
histogram. In such a case, the auto-date histogram may run multiple final reduce
to merge buckets together. This change makes sure that running multiple final reduces
doesn't create duplicates but it doesn't fix the fact that the final reduce may prune
the list of terms prematurely. This other bug is tracked separately in elastic#62731.
jimczi added a commit that referenced this pull request Sep 21, 2020
This commit ensures that the final order of the terms aggregations
is registered correctly after the final reduce.
This bug was introduced in #62028 which is not released yet so this PR is marked
as a non-issue.
This issue was discovered when running a terms aggregation under an auto-date
histogram. In such a case, the auto-date histogram may run multiple final reduce
to merge buckets together. This change makes sure that running multiple final reduces
doesn't create duplicates but it doesn't fix the fact that the final reduce may prune
the list of terms prematurely. This other bug is tracked separately in #62731.
jimczi added a commit that referenced this pull request Sep 21, 2020
This commit ensures that the final order of the terms aggregations
is registered correctly after the final reduce.
This bug was introduced in #62028 which is not released yet so this PR is marked
as a non-issue.
This issue was discovered when running a terms aggregation under an auto-date
histogram. In such a case, the auto-date histogram may run multiple final reduce
to merge buckets together. This change makes sure that running multiple final reduces
doesn't create duplicates but it doesn't fix the fact that the final reduce may prune
the list of terms prematurely. This other bug is tracked separately in #62731.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant