From cbb3cc625e592beeac8fd6ad0f700770c0a86be5 Mon Sep 17 00:00:00 2001 From: Colin Goodheart-Smithe Date: Wed, 5 Oct 2016 09:05:58 +0100 Subject: [PATCH] move extended bounds parse and validate to date hitso factory --- .../bucket/histogram/DateHistogramAggregationBuilder.java | 5 +++++ .../bucket/histogram/DateHistogramAggregatorFactory.java | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregationBuilder.java index d3b8857ccab..191d4e62ab4 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregationBuilder.java @@ -245,6 +245,11 @@ public class DateHistogramAggregationBuilder @Override protected ValuesSourceAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + ExtendedBounds extendedBounds = null; + if (this.extendedBounds != null) { + // parse any string bounds to longs + extendedBounds = this.extendedBounds.parseAndValidate(name, context.searchContext(), config.format()); + } return new DateHistogramAggregatorFactory(name, type, config, interval, dateHistogramInterval, offset, order, keyed, minDocCount, extendedBounds, context, parent, subFactoriesBuilder, metaData); } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregatorFactory.java index 79f81e28374..52b0a77829f 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregatorFactory.java @@ -134,8 +134,7 @@ public final class DateHistogramAggregatorFactory // code so we won't need to do that ExtendedBounds roundedBounds = null; if (extendedBounds != null) { - // parse any string bounds to longs and round them - roundedBounds = extendedBounds.parseAndValidate(name, context.searchContext(), config.format()).round(rounding); + roundedBounds = extendedBounds.round(rounding); } return new DateHistogramAggregator(name, factories, rounding, offset, order, keyed, minDocCount, roundedBounds, valuesSource, config.format(), context, parent, pipelineAggregators, metaData);