From 19cdfe256ecae064bb2ed6e09dc4818f24898edd Mon Sep 17 00:00:00 2001 From: Colin Goodheart-Smithe Date: Tue, 17 Feb 2015 10:08:25 +0000 Subject: [PATCH] DerivativeReducer now copies histogram options from old histogram instance --- .../aggregations/reducers/derivative/DerivativeReducer.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/org/elasticsearch/search/aggregations/reducers/derivative/DerivativeReducer.java b/src/main/java/org/elasticsearch/search/aggregations/reducers/derivative/DerivativeReducer.java index 730a85a2d41..40397d8f46e 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/reducers/derivative/DerivativeReducer.java +++ b/src/main/java/org/elasticsearch/search/aggregations/reducers/derivative/DerivativeReducer.java @@ -97,7 +97,6 @@ public class DerivativeReducer extends Reducer { List newBuckets = new ArrayList<>(); Double lastBucketValue = null; - // NOCOMMIT this needs to be improved so that the aggs are cloned correctly to ensure aggs are fully immutable. for (InternalHistogram.Bucket bucket : buckets) { Double thisBucketValue = resolveBucketValue(histo, bucket); if (lastBucketValue != null) { @@ -116,8 +115,7 @@ public class DerivativeReducer extends Reducer { } lastBucketValue = thisBucketValue; } - return factory.create(histo.getName(), newBuckets, histo.getOrder(), 1, null, null, false, new ArrayList(), - histo.getMetaData()); // NOCOMMIT get order, minDocCount, emptyBucketInfo etc. from histo + return factory.create(histo.getName(), newBuckets, histo); } private Double resolveBucketValue(InternalHistogram histo, InternalHistogram.Bucket bucket) {