The hard bounds were incorrectly scaled for intervals, which was causing incorrect buckets to show up or no buckets at all for interval other than 1. Closes #62126
This commit is contained in:
parent
e80f68ed77
commit
b6bff56a56
|
@ -1236,7 +1236,7 @@ public class HistogramIT extends ESIntegTestCase {
|
|||
assertEquals(-0.6, (double) buckets.get(0).getKey(), 0.01d);
|
||||
|
||||
r = client().prepareSearch("test")
|
||||
.addAggregation(histogram("histo").field("d").interval(0.1).hardBounds(new DoubleBounds(0.0, 3.0)))
|
||||
.addAggregation(histogram("histo").field("d").interval(0.1).hardBounds(new DoubleBounds(0.0, 0.3)))
|
||||
.get();
|
||||
assertSearchResponse(r);
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ public class NumericHistogramAggregator extends AbstractHistogramAggregator {
|
|||
if (key == previousKey) {
|
||||
continue;
|
||||
}
|
||||
if (hardBounds == null || hardBounds.contain(key)) {
|
||||
if (hardBounds == null || hardBounds.contain(key * interval)) {
|
||||
long bucketOrd = bucketOrds.add(owningBucketOrd, Double.doubleToLongBits(key));
|
||||
if (bucketOrd < 0) { // already seen
|
||||
bucketOrd = -1 - bucketOrd;
|
||||
|
|
Loading…
Reference in New Issue