Sort the values of a legacy histogram during downsampling#140771
Merged
elasticsearchmachine merged 4 commits intoelastic:mainfrom Jan 16, 2026
Merged
Sort the values of a legacy histogram during downsampling#140771elasticsearchmachine merged 4 commits intoelastic:mainfrom
elasticsearchmachine merged 4 commits intoelastic:mainfrom
Conversation
Collaborator
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
kkrik-es
reviewed
Jan 16, 2026
| } | ||
| sortedCentroids.sort(Centroid::compareTo); | ||
| double[] values = sortedCentroids.stream().mapToDouble(Centroid::mean).toArray(); | ||
| long[] counts = sortedCentroids.stream().mapToLong(Centroid::count).toArray(); |
Member
There was a problem hiding this comment.
Nit: consider replacing streams with a loop, iirc streams are inefficient and downsampling is cpu intensive.
kkrik-es
approved these changes
Jan 16, 2026
Collaborator
|
Hi @gmarouli, I've created a changelog YAML for you. |
Collaborator
💚 Backport successful
|
gmarouli
added a commit
to gmarouli/elasticsearch
that referenced
this pull request
Jan 16, 2026
…0771) When indexing legacy histograms in elasticsearch we require that their values are sorted. When downsampling is using the aggregate method, it merges the histograms to a single one and indexes it in the target index. We noticed that some merging algorithms do not guarantee that the centroids will be sorted. This PR adds code that sorts the centroids before they are indexed to the target index to avoid indexing failures. Fixes elastic#139382
elasticsearchmachine
pushed a commit
that referenced
this pull request
Jan 16, 2026
…140829) When indexing legacy histograms in elasticsearch we require that their values are sorted. When downsampling is using the aggregate method, it merges the histograms to a single one and indexes it in the target index. We noticed that some merging algorithms do not guarantee that the centroids will be sorted. This PR adds code that sorts the centroids before they are indexed to the target index to avoid indexing failures. Fixes #139382
spinscale
pushed a commit
to spinscale/elasticsearch
that referenced
this pull request
Jan 21, 2026
…0771) When indexing legacy histograms in elasticsearch we require that their values are sorted. When downsampling is using the aggregate method, it merges the histograms to a single one and indexes it in the target index. We noticed that some merging algorithms do not guarantee that the centroids will be sorted. This PR adds code that sorts the centroids before they are indexed to the target index to avoid indexing failures. Fixes elastic#139382
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When indexing legacy histograms in elasticsearch we require that their values are sorted.
When downsampling is using the aggregate method, it merges the histograms to a single one and indexes it in the target index. We noticed that some merging algorithms do not guarantee that the centroids will be sorted.
This PR adds code that sorts the centroids before they are indexed to the target index to avoid indexing failures.
Fixes #139382