summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalDateHistogram.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalDateHistogram.java')
-rw-r--r--core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalDateHistogram.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalDateHistogram.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalDateHistogram.java
index c3eab06f28..6082366094 100644
--- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalDateHistogram.java
+++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalDateHistogram.java
@@ -369,8 +369,8 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation<
Bucket firstBucket = iter.hasNext() ? list.get(iter.nextIndex()) : null;
if (firstBucket == null) {
if (bounds.getMin() != null && bounds.getMax() != null) {
- long key = bounds.getMin();
- long max = bounds.getMax();
+ long key = bounds.getMin() + offset;
+ long max = bounds.getMax() + offset;
while (key <= max) {
iter.add(new InternalDateHistogram.Bucket(key, 0, keyed, format, reducedEmptySubAggs));
key = nextKey(key).longValue();
@@ -378,7 +378,7 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation<
}
} else {
if (bounds.getMin() != null) {
- long key = bounds.getMin();
+ long key = bounds.getMin() + offset;
if (key < firstBucket.key) {
while (key < firstBucket.key) {
iter.add(new InternalDateHistogram.Bucket(key, 0, keyed, format, reducedEmptySubAggs));
@@ -405,12 +405,12 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation<
}
// finally, adding the empty buckets *after* the actual data (based on the extended_bounds.max requested by the user)
- if (bounds != null && lastBucket != null && bounds.getMax() != null && bounds.getMax() > lastBucket.key) {
- long key = emptyBucketInfo.rounding.nextRoundingValue(lastBucket.key);
- long max = bounds.getMax();
+ if (bounds != null && lastBucket != null && bounds.getMax() != null && bounds.getMax() + offset > lastBucket.key) {
+ long key = nextKey(lastBucket.key).longValue();
+ long max = bounds.getMax() + offset;
while (key <= max) {
iter.add(new InternalDateHistogram.Bucket(key, 0, keyed, format, reducedEmptySubAggs));
- key = emptyBucketInfo.rounding.nextRoundingValue(key);
+ key = nextKey(key).longValue();
}
}
}