From be64bfb1356c66d57dc75da5baeb77742024bd66 Mon Sep 17 00:00:00 2001 From: Colin Goodheart-Smithe Date: Fri, 13 Nov 2015 12:48:51 +0000 Subject: [PATCH] Revert "Aggregations: Pass extended bounds into HistogramAggregator when creating an unmapped aggregator" This reverts commit e1bf9798bff698d23537b53b5a31287da70f9ccb. --- .../bucket/histogram/HistogramAggregator.java | 2 +- .../messy/tests/HistogramTests.java | 33 ------------------- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregator.java index d2ca0a9121a..c47c519d503 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregator.java @@ -173,7 +173,7 @@ public class HistogramAggregator extends BucketsAggregator { @Override protected Aggregator createUnmapped(AggregationContext aggregationContext, Aggregator parent, List pipelineAggregators, Map metaData) throws IOException { - return new HistogramAggregator(name, factories, rounding, order, keyed, minDocCount, extendedBounds, null, config.formatter(), + return new HistogramAggregator(name, factories, rounding, order, keyed, minDocCount, null, null, config.formatter(), histogramFactory, aggregationContext, parent, pipelineAggregators, metaData); } diff --git a/plugins/lang-groovy/src/test/java/org/elasticsearch/messy/tests/HistogramTests.java b/plugins/lang-groovy/src/test/java/org/elasticsearch/messy/tests/HistogramTests.java index dd3d2e99fcd..d6799835a0f 100644 --- a/plugins/lang-groovy/src/test/java/org/elasticsearch/messy/tests/HistogramTests.java +++ b/plugins/lang-groovy/src/test/java/org/elasticsearch/messy/tests/HistogramTests.java @@ -892,39 +892,6 @@ public class HistogramTests extends ESIntegTestCase { } } - public void testPartiallyUnmappedWithExtendedBounds() throws Exception { - SearchResponse response = client() - .prepareSearch("idx", "idx_unmapped") - .addAggregation( - histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) - .extendedBounds((long) -1 * 2 * interval, (long) valueCounts.length * interval)).execute().actionGet(); - - assertSearchResponse(response); - - Histogram histo = response.getAggregations().get("histo"); - assertThat(histo, notNullValue()); - assertThat(histo.getName(), equalTo("histo")); - List buckets = histo.getBuckets(); - assertThat(buckets.size(), equalTo(numValueBuckets + 3)); - - Histogram.Bucket bucket = buckets.get(0); - assertThat(bucket, notNullValue()); - assertThat(((Number) bucket.getKey()).longValue(), equalTo((long) -1 * 2 * interval)); - assertThat(bucket.getDocCount(), equalTo(0l)); - - bucket = buckets.get(1); - assertThat(bucket, notNullValue()); - assertThat(((Number) bucket.getKey()).longValue(), equalTo((long) -1 * interval)); - assertThat(bucket.getDocCount(), equalTo(0l)); - - for (int i = 2; i < numValueBuckets + 2; ++i) { - bucket = buckets.get(i); - assertThat(bucket, notNullValue()); - assertThat(((Number) bucket.getKey()).longValue(), equalTo((long) (i - 2) * interval)); - assertThat(bucket.getDocCount(), equalTo(valueCounts[i - 2])); - } - } - public void testEmptyAggregation() throws Exception { SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx") .setQuery(matchAllQuery())