move extended bounds parse and validate to date hitso factory

This commit is contained in:
Colin Goodheart-Smithe 2016-10-05 09:05:58 +01:00
parent 587bdcef38
commit cbb3cc625e
2 changed files with 6 additions and 2 deletions

View File

@ -245,6 +245,11 @@ public class DateHistogramAggregationBuilder
@Override @Override
protected ValuesSourceAggregatorFactory<Numeric, ?> innerBuild(AggregationContext context, ValuesSourceConfig<Numeric> config, protected ValuesSourceAggregatorFactory<Numeric, ?> innerBuild(AggregationContext context, ValuesSourceConfig<Numeric> config,
AggregatorFactory<?> parent, Builder subFactoriesBuilder) throws IOException { 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, return new DateHistogramAggregatorFactory(name, type, config, interval, dateHistogramInterval, offset, order, keyed, minDocCount,
extendedBounds, context, parent, subFactoriesBuilder, metaData); extendedBounds, context, parent, subFactoriesBuilder, metaData);
} }

View File

@ -134,8 +134,7 @@ public final class DateHistogramAggregatorFactory
// code so we won't need to do that // code so we won't need to do that
ExtendedBounds roundedBounds = null; ExtendedBounds roundedBounds = null;
if (extendedBounds != null) { if (extendedBounds != null) {
// parse any string bounds to longs and round them roundedBounds = extendedBounds.round(rounding);
roundedBounds = extendedBounds.parseAndValidate(name, context.searchContext(), config.format()).round(rounding);
} }
return new DateHistogramAggregator(name, factories, rounding, offset, order, keyed, minDocCount, roundedBounds, valuesSource, return new DateHistogramAggregator(name, factories, rounding, offset, order, keyed, minDocCount, roundedBounds, valuesSource,
config.format(), context, parent, pipelineAggregators, metaData); config.format(), context, parent, pipelineAggregators, metaData);