diff --git a/core/src/main/java/org/elasticsearch/percolator/PercolatorService.java b/core/src/main/java/org/elasticsearch/percolator/PercolatorService.java index b845647cd2c..01755f24f22 100644 --- a/core/src/main/java/org/elasticsearch/percolator/PercolatorService.java +++ b/core/src/main/java/org/elasticsearch/percolator/PercolatorService.java @@ -220,7 +220,6 @@ public class PercolatorService extends AbstractComponent implements Releasable { if (context.aggregations() != null) { AggregationContext aggregationContext = new AggregationContext(context); context.aggregations().aggregationContext(aggregationContext); - context.aggregations().factories().init(aggregationContext); Aggregator[] aggregators = context.aggregations().factories().createTopLevelAggregators(); List aggregatorCollectors = new ArrayList<>(aggregators.length); for (int i = 0; i < aggregators.length; i++) { diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/AggregationParseElement.java b/core/src/main/java/org/elasticsearch/search/aggregations/AggregationParseElement.java index 3bcb74bec40..fee445dd104 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/AggregationParseElement.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/AggregationParseElement.java @@ -67,7 +67,7 @@ public class AggregationParseElement implements SearchParseElement { parseContext.parseFieldMatcher(context.parseFieldMatcher()); AggregatorFactories.Builder builders = aggregatorParsers.parseAggregators(parser, parseContext); AggregationContext aggContext = new AggregationContext(context); - AggregatorFactories factories = builders.build(aggContext); + AggregatorFactories factories = builders.build(aggContext, null); factories.validate(); context.aggregations(new SearchContextAggregations(factories)); } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/AggregationPhase.java b/core/src/main/java/org/elasticsearch/search/aggregations/AggregationPhase.java index 50b0e0672e6..d707ff4206c 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/AggregationPhase.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/AggregationPhase.java @@ -72,7 +72,6 @@ public class AggregationPhase implements SearchPhase { if (context.aggregations() != null) { AggregationContext aggregationContext = new AggregationContext(context); context.aggregations().aggregationContext(aggregationContext); - context.aggregations().factories().init(aggregationContext); List collectors = new ArrayList<>(); Aggregator[] aggregators; diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/AggregatorBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/AggregatorBuilder.java index 63221da6568..70527a62b49 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/AggregatorBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/AggregatorBuilder.java @@ -97,16 +97,13 @@ public abstract class AggregatorBuilder> extend return type.name(); } - public final AggregatorFactory build(AggregationContext context) throws IOException { - AggregatorFactory factory = doBuild(context); - if (factoriesBuilder != null && factoriesBuilder.count() > 0) { - factory.subFactories(factoriesBuilder.build(context)); - } - factory.setMetaData(metaData); + public final AggregatorFactory build(AggregationContext context, AggregatorFactory parent) throws IOException { + AggregatorFactory factory = doBuild(context, parent, factoriesBuilder); return factory; } - protected abstract AggregatorFactory doBuild(AggregationContext context) throws IOException; + protected abstract AggregatorFactory doBuild(AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subfactoriesBuilder) throws IOException; @Override public final AB readFrom(StreamInput in) throws IOException { diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/AggregatorFactories.java b/core/src/main/java/org/elasticsearch/search/aggregations/AggregatorFactories.java index 2ecee469db5..1f3c24dae9d 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/AggregatorFactories.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/AggregatorFactories.java @@ -44,7 +44,7 @@ import java.util.Set; */ public class AggregatorFactories { - public static final AggregatorFactories EMPTY = new AggregatorFactories(new AggregatorFactory[0], + public static final AggregatorFactories EMPTY = new AggregatorFactories(null, new AggregatorFactory[0], new ArrayList()); private AggregatorFactory parent; @@ -55,18 +55,13 @@ public class AggregatorFactories { return new Builder(); } - private AggregatorFactories(AggregatorFactory[] factories, + private AggregatorFactories(AggregatorFactory parent, AggregatorFactory[] factories, List pipelineAggregators) { + this.parent = parent; this.factories = factories; this.pipelineAggregatorFactories = pipelineAggregators; } - public void init(AggregationContext context) { - for (AggregatorFactory factory : factories) { - factory.init(context); - } - } - public List createPipelineAggregators() throws IOException { List pipelineAggregators = new ArrayList<>(); for (PipelineAggregatorFactory factory : this.pipelineAggregatorFactories) { @@ -118,13 +113,6 @@ public class AggregatorFactories { return pipelineAggregatorFactories.size(); } - void setParent(AggregatorFactory parent) { - this.parent = parent; - for (AggregatorFactory factory : factories) { - factory.parent = parent; - } - } - public void validate() { for (AggregatorFactory factory : factories) { factory.validate(); @@ -168,7 +156,7 @@ public class AggregatorFactories { return this; } - public AggregatorFactories build(AggregationContext context) throws IOException { + public AggregatorFactories build(AggregationContext context, AggregatorFactory parent) throws IOException { if (aggregatorBuilders.isEmpty() && pipelineAggregatorFactories.isEmpty()) { return EMPTY; } @@ -180,9 +168,9 @@ public class AggregatorFactories { } AggregatorFactory[] aggFactories = new AggregatorFactory[aggregatorBuilders.size()]; for (int i = 0; i < aggregatorBuilders.size(); i++) { - aggFactories[i] = aggregatorBuilders.get(i).build(context); + aggFactories[i] = aggregatorBuilders.get(i).build(context, parent); } - return new AggregatorFactories(aggFactories, orderedpipelineAggregators); + return new AggregatorFactories(parent, aggFactories, orderedpipelineAggregators); } private List resolvePipelineAggregatorOrder(List pipelineAggregatorFactories, diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/AggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/AggregatorFactory.java index 0d615ca0c79..1ac67c53488 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/AggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/AggregatorFactory.java @@ -58,45 +58,15 @@ public abstract class AggregatorFactory> extend * The aggregation name * @param type * The aggregation type + * @throws IOException + * if an error occurs creating the factory */ - public AggregatorFactory(String name, Type type) { + public AggregatorFactory(String name, Type type, AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { this.name = name; this.type = type; - } - - /** - * Initializes this factory with the given {@link AggregationContext} ready - * to create {@link Aggregator}s - */ - public final void init(AggregationContext context) { this.context = context; - doInit(context); - this.factories.init(context); - } - - /** - * Allows the {@link AggregatorFactory} to initialize any state prior to - * using it to create {@link Aggregator}s. - * - * @param context - * the {@link AggregationContext} to use during initialization. - */ - protected void doInit(AggregationContext context) { - } - - /** - * Registers sub-factories with this factory. The sub-factory will be - * responsible for the creation of sub-aggregators under the aggregator - * created by this factory. - * - * @param subFactories - * The sub-factories - * @return this factory (fluent interface) - */ - public AF subFactories(AggregatorFactories subFactories) { - this.factories = subFactories; - this.factories.setParent(this); - return (AF) this; + this.factories = subFactoriesBuilder.build(context, this); } public String name() { @@ -115,14 +85,6 @@ public abstract class AggregatorFactory> extend public void doValidate() { } - /** - * @return The parent factory if one exists (will always return {@code null} - * for top level aggregator factories). - */ - public AggregatorFactory parent() { - return parent; - } - protected abstract Aggregator createInternal(AggregationContext context, Aggregator parent, boolean collectsFromSingleBucket, List pipelineAggregators, Map metaData) throws IOException; @@ -144,11 +106,6 @@ public abstract class AggregatorFactory> extend return createInternal(context, parent, collectsFromSingleBucket, this.factories.createPipelineAggregators(), this.metaData); } - public AF setMetaData(Map metaData) { - this.metaData = metaData; - return (AF) this; - } - public String getType() { return type.name(); } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/children/ChildrenAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/children/ChildrenAggregatorFactory.java index 611bcb81f69..9c46a7b6b45 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/children/ChildrenAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/children/ChildrenAggregatorFactory.java @@ -21,6 +21,8 @@ package org.elasticsearch.search.aggregations.bucket.children; import org.apache.lucene.search.Query; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.NonCollectingAggregator; @@ -43,8 +45,9 @@ public class ChildrenAggregatorFactory private final Query childFilter; public ChildrenAggregatorFactory(String name, Type type, ValuesSourceConfig config, String parentType, Query childFilter, - Query parentFilter) { - super(name, type, config); + Query parentFilter, AggregationContext context, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, + Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); this.parentType = parentType; this.childFilter = childFilter; this.parentFilter = parentFilter; diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/children/ParentToChildrenAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/children/ParentToChildrenAggregator.java index 7de17e827de..386eb9c2396 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/children/ParentToChildrenAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/children/ParentToChildrenAggregator.java @@ -41,8 +41,10 @@ import org.elasticsearch.index.mapper.internal.ParentFieldMapper; import org.elasticsearch.search.SearchParseException; import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -210,8 +212,9 @@ public class ParentToChildrenAggregator extends SingleBucketAggregator { @Override protected ValuesSourceAggregatorFactory innerBuild(AggregationContext context, - ValuesSourceConfig config) { - return new ChildrenAggregatorFactory(name, type, config, parentType, childFilter, parentFilter); + ValuesSourceConfig config, AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new ChildrenAggregatorFactory(name, type, config, parentType, childFilter, parentFilter, context, parent, + subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/FilterAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/FilterAggregator.java index 65ab7a6edee..9fae8bf1913 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/FilterAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/FilterAggregator.java @@ -103,8 +103,9 @@ public class FilterAggregator extends SingleBucketAggregator { } @Override - protected AggregatorFactory doBuild(AggregationContext context) throws IOException { - return new FilterAggregatorFactory(name, type, filter, context); + protected AggregatorFactory doBuild(AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactoriesBuilder) throws IOException { + return new FilterAggregatorFactory(name, type, filter, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/FilterAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/FilterAggregatorFactory.java index 15e1fb5749f..f1659ae5130 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/FilterAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/FilterAggregatorFactory.java @@ -24,6 +24,7 @@ import org.apache.lucene.search.Query; import org.apache.lucene.search.Weight; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; @@ -37,8 +38,9 @@ public class FilterAggregatorFactory extends AggregatorFactory filterBuilder, AggregationContext context) throws IOException { - super(name, type); + public FilterAggregatorFactory(String name, Type type, QueryBuilder filterBuilder, AggregationContext context, + AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, context, parent, subFactoriesBuilder, metaData); IndexSearcher contextSearcher = context.searchContext().searcher(); Query filter = filterBuilder.toQuery(context.searchContext().indexShard().getQueryShardContext()); weight = contextSearcher.createNormalizedWeight(filter, false); diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregator.java index 8722ce53157..0a7ae5ede90 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregator.java @@ -38,6 +38,7 @@ import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -269,8 +270,10 @@ public class FiltersAggregator extends BucketsAggregator { } @Override - protected AggregatorFactory doBuild(AggregationContext context) throws IOException { - return new FiltersAggregatorFactory(name, type, filters, keyed, otherBucket, otherBucketKey, context); + protected AggregatorFactory doBuild(AggregationContext context, AggregatorFactory parent, Builder subFactoriesBuilder) + throws IOException { + return new FiltersAggregatorFactory(name, type, filters, keyed, otherBucket, otherBucketKey, context, parent, + subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregatorFactory.java index 36b492051f9..2564fa512b7 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregatorFactory.java @@ -23,6 +23,7 @@ import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; import org.apache.lucene.search.Weight; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.bucket.filters.FiltersAggregator.KeyedFilter; @@ -42,8 +43,9 @@ public class FiltersAggregatorFactory extends AggregatorFactory filters, boolean keyed, boolean otherBucket, - String otherBucketKey, AggregationContext context) throws IOException { - super(name, type); + String otherBucketKey, AggregationContext context, AggregatorFactory parent, AggregatorFactories.Builder subFactories, + Map metaData) throws IOException { + super(name, type, context, parent, subFactories, metaData); this.keyed = keyed; this.otherBucket = otherBucket; this.otherBucketKey = otherBucketKey; diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregatorFactory.java index 6ea498b23b6..22a4c6f15e2 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.bucket.geogrid; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.NonCollectingAggregator; import org.elasticsearch.search.aggregations.InternalAggregation.Type; @@ -44,8 +46,9 @@ public class GeoHashGridAggregatorFactory extends ValuesSourceAggregatorFactory< private final int shardSize; public GeoHashGridAggregatorFactory(String name, Type type, ValuesSourceConfig config, int precision, int requiredSize, - int shardSize) { - super(name, type, config); + int shardSize, AggregationContext context, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, + Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); this.precision = precision; this.requiredSize = requiredSize; this.shardSize = shardSize; diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridParser.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridParser.java index e5121361351..b67edfe5200 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridParser.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridParser.java @@ -35,6 +35,8 @@ import org.elasticsearch.index.fielddata.SortedNumericDoubleValues; import org.elasticsearch.index.fielddata.SortingNumericDocValues; import org.elasticsearch.index.query.GeoBoundingBoxQueryBuilder; import org.elasticsearch.search.aggregations.AggregatorBuilder; +import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.bucket.BucketUtils; import org.elasticsearch.search.aggregations.support.AbstractValuesSourceParser.GeoPointValuesSourceParser; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -149,7 +151,8 @@ public class GeoHashGridParser extends GeoPointValuesSourceParser { @Override protected ValuesSourceAggregatorFactory innerBuild(AggregationContext context, - ValuesSourceConfig config) { + ValuesSourceConfig config, AggregatorFactory parent, Builder subFactoriesBuilder) + throws IOException { int shardSize = this.shardSize; if (shardSize == 0) { shardSize = Integer.MAX_VALUE; @@ -168,7 +171,8 @@ public class GeoHashGridParser extends GeoPointValuesSourceParser { if (shardSize < requiredSize) { shardSize = requiredSize; } - return new GeoHashGridAggregatorFactory(name, type, config, precision, requiredSize, shardSize); + return new GeoHashGridAggregatorFactory(name, type, config, precision, requiredSize, shardSize, context, parent, + subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/global/GlobalAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/global/GlobalAggregator.java index 46910f95cd5..42b9bcc0b81 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/global/GlobalAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/global/GlobalAggregator.java @@ -28,6 +28,7 @@ import org.elasticsearch.search.aggregations.AggregatorBuilder; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -77,8 +78,9 @@ public class GlobalAggregator extends SingleBucketAggregator { } @Override - protected AggregatorFactory doBuild(AggregationContext context) throws IOException { - return new GlobalAggregatorFactory(name, type); + protected AggregatorFactory doBuild(AggregationContext context, AggregatorFactory parent, Builder subFactoriesBuilder) + throws IOException { + return new GlobalAggregatorFactory(name, type, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/global/GlobalAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/global/GlobalAggregatorFactory.java index 805a51a807d..1f54055ccc5 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/global/GlobalAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/global/GlobalAggregatorFactory.java @@ -21,6 +21,7 @@ package org.elasticsearch.search.aggregations.bucket.global; import org.elasticsearch.search.aggregations.AggregationExecutionException; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; @@ -32,8 +33,9 @@ import java.util.Map; public class GlobalAggregatorFactory extends AggregatorFactory { - public GlobalAggregatorFactory(String name, Type type) { - super(name, type); + public GlobalAggregatorFactory(String name, Type type, AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactories, Map metaData) throws IOException { + super(name, type, context, parent, subFactories, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/AbstractHistogramAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/AbstractHistogramAggregatorFactory.java index a748229f52d..5c1dadf75de 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/AbstractHistogramAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/AbstractHistogramAggregatorFactory.java @@ -22,6 +22,8 @@ package org.elasticsearch.search.aggregations.bucket.histogram; import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.rounding.Rounding; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -48,8 +50,9 @@ public abstract class AbstractHistogramAggregatorFactory config, long interval, long offset, InternalOrder order, boolean keyed, long minDocCount, ExtendedBounds extendedBounds, - InternalHistogram.Factory histogramFactory) { - super(name, type, config); + InternalHistogram.Factory histogramFactory, AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); this.interval = interval; this.offset = offset; this.order = order; 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 7aff7cfebe6..949542a7625 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 @@ -23,14 +23,18 @@ import org.elasticsearch.common.rounding.DateTimeUnit; import org.elasticsearch.common.rounding.Rounding; import org.elasticsearch.common.rounding.TimeZoneRounding; import org.elasticsearch.common.unit.TimeValue; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; +import java.io.IOException; import java.util.HashMap; import java.util.Map; import static java.util.Collections.unmodifiableMap; +import org.elasticsearch.search.aggregations.support.AggregationContext; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; public class DateHistogramAggregatorFactory extends AbstractHistogramAggregatorFactory { @@ -60,8 +64,10 @@ public class DateHistogramAggregatorFactory extends AbstractHistogramAggregatorF public DateHistogramAggregatorFactory(String name, Type type, ValuesSourceConfig config, long interval, DateHistogramInterval dateHistogramInterval, long offset, InternalOrder order, boolean keyed, long minDocCount, - ExtendedBounds extendedBounds) { - super(name, type, config, interval, offset, order, keyed, minDocCount, extendedBounds, InternalDateHistogram.HISTOGRAM_FACTORY); + ExtendedBounds extendedBounds, AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, interval, offset, order, keyed, minDocCount, extendedBounds, InternalDateHistogram.HISTOGRAM_FACTORY, + context, parent, subFactoriesBuilder, metaData); this.dateHistogramInterval = dateHistogramInterval; } 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 4561235b2c4..6c819525231 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 @@ -32,9 +32,11 @@ import org.elasticsearch.common.util.LongHash; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -170,8 +172,10 @@ public class HistogramAggregator extends BucketsAggregator { } @Override - protected HistogramAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config) { - return new HistogramAggregatorFactory(name, type, config, interval, offset, order, keyed, minDocCount, extendedBounds); + protected HistogramAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new HistogramAggregatorFactory(name, type, config, interval, offset, order, keyed, minDocCount, extendedBounds, context, + parent, subFactoriesBuilder, metaData); } } @@ -373,9 +377,10 @@ public class HistogramAggregator extends BucketsAggregator { } @Override - protected DateHistogramAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config) { + protected DateHistogramAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { return new DateHistogramAggregatorFactory(name, type, config, interval, dateHistogramInterval, offset, order, keyed, - minDocCount, extendedBounds); + minDocCount, extendedBounds, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregatorFactory.java index fd1f7f06182..a862aadeb62 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregatorFactory.java @@ -19,15 +19,24 @@ package org.elasticsearch.search.aggregations.bucket.histogram; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; + +import java.io.IOException; +import java.util.Map; + +import org.elasticsearch.search.aggregations.support.AggregationContext; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; public class HistogramAggregatorFactory extends AbstractHistogramAggregatorFactory { public HistogramAggregatorFactory(String name, Type type, ValuesSourceConfig config, long interval, long offset, - InternalOrder order, boolean keyed, long minDocCount, ExtendedBounds extendedBounds) { - super(name, type, config, interval, offset, order, keyed, minDocCount, extendedBounds, InternalHistogram.HISTOGRAM_FACTORY); + InternalOrder order, boolean keyed, long minDocCount, ExtendedBounds extendedBounds, AggregationContext context, + AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, interval, offset, order, keyed, minDocCount, extendedBounds, InternalHistogram.HISTOGRAM_FACTORY, context, + parent, subFactoriesBuilder, metaData); } } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregator.java index 45d3d75c021..758b6c9c004 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregator.java @@ -25,9 +25,11 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -95,8 +97,8 @@ public class MissingAggregator extends SingleBucketAggregator { @Override protected ValuesSourceAggregatorFactory innerBuild(AggregationContext context, - ValuesSourceConfig config) { - return new MissingAggregatorFactory(name, type, config); + ValuesSourceConfig config, AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new MissingAggregatorFactory(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregatorFactory.java index 095d6ae0ea7..4da7037d58c 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.bucket.missing; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -33,8 +35,9 @@ import java.util.Map; public class MissingAggregatorFactory extends ValuesSourceAggregatorFactory { - public MissingAggregatorFactory(String name, Type type, ValuesSourceConfig config) { - super(name, type, config); + public MissingAggregatorFactory(String name, Type type, ValuesSourceConfig config, AggregationContext context, + AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregator.java index c38ca519cb8..4b186200a4d 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregator.java @@ -41,6 +41,7 @@ import org.elasticsearch.search.aggregations.AggregatorBuilder; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -173,8 +174,9 @@ public class NestedAggregator extends SingleBucketAggregator { } @Override - protected AggregatorFactory doBuild(AggregationContext context) throws IOException { - return new NestedAggregatorFactory(name, type, path); + protected AggregatorFactory doBuild(AggregationContext context, AggregatorFactory parent, Builder subFactoriesBuilder) + throws IOException { + return new NestedAggregatorFactory(name, type, path, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregatorFactory.java index c0dba6b9f0e..4e1506eaf28 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregatorFactory.java @@ -22,6 +22,7 @@ package org.elasticsearch.search.aggregations.bucket.nested; import org.elasticsearch.index.mapper.object.ObjectMapper; import org.elasticsearch.search.aggregations.AggregationExecutionException; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.NonCollectingAggregator; @@ -37,8 +38,9 @@ public class NestedAggregatorFactory extends AggregatorFactory parent, + AggregatorFactories.Builder subFactories, Map metaData) throws IOException { + super(name, type, context, parent, subFactories, metaData); this.path = path; } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/ReverseNestedAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/ReverseNestedAggregator.java index 9f1bbd99ba4..b823af5b663 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/ReverseNestedAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/ReverseNestedAggregator.java @@ -37,6 +37,7 @@ import org.elasticsearch.search.aggregations.AggregatorBuilder; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -140,8 +141,9 @@ public class ReverseNestedAggregator extends SingleBucketAggregator { } @Override - protected AggregatorFactory doBuild(AggregationContext context) throws IOException { - return new ReverseNestedAggregatorFactory(name, type, path); + protected AggregatorFactory doBuild(AggregationContext context, AggregatorFactory parent, Builder subFactoriesBuilder) + throws IOException { + return new ReverseNestedAggregatorFactory(name, type, path, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/ReverseNestedAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/ReverseNestedAggregatorFactory.java index 089f174aefa..6ccbe93b99d 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/ReverseNestedAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/ReverseNestedAggregatorFactory.java @@ -23,6 +23,7 @@ import org.elasticsearch.index.mapper.object.ObjectMapper; import org.elasticsearch.search.SearchParseException; import org.elasticsearch.search.aggregations.AggregationExecutionException; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.NonCollectingAggregator; @@ -38,8 +39,9 @@ public class ReverseNestedAggregatorFactory extends AggregatorFactory parent, + AggregatorFactories.Builder subFactories, Map metaData) throws IOException { + super(name, type, context, parent, subFactories, metaData); this.path = path; } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/AbstractRangeAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/AbstractRangeAggregatorFactory.java index 812df46ede4..ae547994df2 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/AbstractRangeAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/AbstractRangeAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.bucket.range; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Range; import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Unmapped; @@ -42,8 +44,9 @@ public class AbstractRangeAggregatorFactory config, List ranges, boolean keyed, - InternalRange.Factory rangeFactory) { - super(name, type, config); + InternalRange.Factory rangeFactory, AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); this.ranges = ranges; this.keyed = keyed; this.rangeFactory = rangeFactory; diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java index bdc49752897..118a6f312a7 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java @@ -31,11 +31,13 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.fielddata.SortedNumericDoubleValues; import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.NonCollectingAggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -540,8 +542,10 @@ public class RangeAggregator extends BucketsAggregator { } @Override - protected RangeAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config) { - return new RangeAggregatorFactory(name, type, config, ranges, keyed, rangeFactory); + protected RangeAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new RangeAggregatorFactory(name, type, config, ranges, keyed, rangeFactory, context, parent, subFactoriesBuilder, + metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregatorFactory.java index b1dd2ca53c4..5dec4c40c45 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregatorFactory.java @@ -19,19 +19,25 @@ package org.elasticsearch.search.aggregations.bucket.range; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.bucket.range.InternalRange.Factory; import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Range; import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; +import org.elasticsearch.search.aggregations.support.AggregationContext; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; +import java.io.IOException; import java.util.List; +import java.util.Map; public class RangeAggregatorFactory extends AbstractRangeAggregatorFactory { public RangeAggregatorFactory(String name, Type type, ValuesSourceConfig config, List ranges, boolean keyed, - Factory rangeFactory) { - super(name, type, config, ranges, keyed, rangeFactory); + Factory rangeFactory, AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, ranges, keyed, rangeFactory, context, parent, subFactoriesBuilder, metaData); } } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/date/DateRangeAggregatorBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/date/DateRangeAggregatorBuilder.java index 9a8a3a5ae88..f07e2516a28 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/date/DateRangeAggregatorBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/date/DateRangeAggregatorBuilder.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.bucket.range.date; import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator; import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.AbstractBuilder; import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Range; @@ -245,8 +247,10 @@ public class DateRangeAggregatorBuilder extends AbstractBuilder config) { - return new DateRangeAggregatorFactory(name, type, config, ranges, keyed, rangeFactory); + protected DateRangeAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new DateRangeAggregatorFactory(name, type, config, ranges, keyed, rangeFactory, context, parent, subFactoriesBuilder, + metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/date/DateRangeAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/date/DateRangeAggregatorFactory.java index fd193842878..d3bb7ac6238 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/date/DateRangeAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/date/DateRangeAggregatorFactory.java @@ -19,20 +19,26 @@ package org.elasticsearch.search.aggregations.bucket.range.date; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.bucket.range.AbstractRangeAggregatorFactory; import org.elasticsearch.search.aggregations.bucket.range.InternalRange.Factory; import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Range; import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; +import org.elasticsearch.search.aggregations.support.AggregationContext; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; +import java.io.IOException; import java.util.List; +import java.util.Map; public class DateRangeAggregatorFactory extends AbstractRangeAggregatorFactory { public DateRangeAggregatorFactory(String name, Type type, ValuesSourceConfig config, List ranges, boolean keyed, - Factory rangeFactory) { - super(name, type, config, ranges, keyed, rangeFactory); + Factory rangeFactory, AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, ranges, keyed, rangeFactory, context, parent, subFactoriesBuilder, metaData); } } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/geodistance/GeoDistanceParser.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/geodistance/GeoDistanceParser.java index 6923861d038..9c4fde8268c 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/geodistance/GeoDistanceParser.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/geodistance/GeoDistanceParser.java @@ -29,6 +29,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentParser.Token; import org.elasticsearch.search.aggregations.AggregatorBuilder; +import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.bucket.range.InternalRange; import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator; import org.elasticsearch.search.aggregations.support.AbstractValuesSourceParser.GeoPointValuesSourceParser; @@ -318,8 +320,10 @@ public class GeoDistanceParser extends GeoPointValuesSourceParser { @Override protected ValuesSourceAggregatorFactory innerBuild(AggregationContext context, - ValuesSourceConfig config) { - return new GeoDistanceRangeAggregatorFactory(name, type, config, origin, ranges, unit, distanceType, keyed); + ValuesSourceConfig config, AggregatorFactory parent, Builder subFactoriesBuilder) + throws IOException { + return new GeoDistanceRangeAggregatorFactory(name, type, config, origin, ranges, unit, distanceType, keyed, context, parent, + subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/geodistance/GeoDistanceRangeAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/geodistance/GeoDistanceRangeAggregatorFactory.java index 8c5c3a681c6..b5f3fb5a91a 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/geodistance/GeoDistanceRangeAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/geodistance/GeoDistanceRangeAggregatorFactory.java @@ -29,6 +29,8 @@ import org.elasticsearch.index.fielddata.MultiGeoPointValues; import org.elasticsearch.index.fielddata.SortedBinaryDocValues; import org.elasticsearch.index.fielddata.SortedNumericDoubleValues; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.bucket.range.InternalRange; import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator; @@ -55,8 +57,9 @@ public class GeoDistanceRangeAggregatorFactory private final boolean keyed; public GeoDistanceRangeAggregatorFactory(String name, Type type, ValuesSourceConfig config, GeoPoint origin, - List ranges, DistanceUnit unit, GeoDistance distanceType, boolean keyed) { - super(name, type, config); + List ranges, DistanceUnit unit, GeoDistance distanceType, boolean keyed, AggregationContext context, + AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); this.origin = origin; this.ranges = ranges; this.unit = unit; diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/ipv4/IPv4RangeAggregatorBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/ipv4/IPv4RangeAggregatorBuilder.java index 0d0ee3ab5c6..f4b7a78ab2f 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/ipv4/IPv4RangeAggregatorBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/ipv4/IPv4RangeAggregatorBuilder.java @@ -26,6 +26,8 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.network.Cidrs; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator; import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.AbstractBuilder; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -120,8 +122,10 @@ public class IPv4RangeAggregatorBuilder extends AbstractBuilder config) { - return new Ipv4RangeAggregatorFactory(name, type, config, ranges, keyed, rangeFactory); + protected Ipv4RangeAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new Ipv4RangeAggregatorFactory(name, type, config, ranges, keyed, rangeFactory, context, parent, subFactoriesBuilder, + metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/ipv4/Ipv4RangeAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/ipv4/Ipv4RangeAggregatorFactory.java index 6fd894bc21b..1c059356c5d 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/ipv4/Ipv4RangeAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/ipv4/Ipv4RangeAggregatorFactory.java @@ -19,21 +19,26 @@ package org.elasticsearch.search.aggregations.bucket.range.ipv4; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.bucket.range.AbstractRangeAggregatorFactory; import org.elasticsearch.search.aggregations.bucket.range.InternalRange.Factory; import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; +import org.elasticsearch.search.aggregations.support.AggregationContext; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; +import java.io.IOException; import java.util.List; +import java.util.Map; public class Ipv4RangeAggregatorFactory extends AbstractRangeAggregatorFactory { public Ipv4RangeAggregatorFactory(String name, Type type, ValuesSourceConfig config, - List ranges, boolean keyed, - Factory rangeFactory) { - super(name, type, config, ranges, keyed, rangeFactory); + List ranges, boolean keyed, Factory rangeFactory, AggregationContext context, + AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, ranges, keyed, rangeFactory, context, parent, subFactoriesBuilder, metaData); } } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/DiversifiedAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/DiversifiedAggregatorFactory.java index c214a1f8e68..42527a9df9a 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/DiversifiedAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/DiversifiedAggregatorFactory.java @@ -21,6 +21,8 @@ package org.elasticsearch.search.aggregations.bucket.sampler; import org.elasticsearch.search.aggregations.AggregationExecutionException; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.NonCollectingAggregator; import org.elasticsearch.search.aggregations.InternalAggregation.Type; @@ -43,8 +45,9 @@ public class DiversifiedAggregatorFactory extends ValuesSourceAggregatorFactory< private final String executionHint; public DiversifiedAggregatorFactory(String name, Type type, ValuesSourceConfig config, int shardSize, int maxDocsPerValue, - String executionHint) { - super(name, type, config); + String executionHint, AggregationContext context, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, + Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); this.shardSize = shardSize; this.maxDocsPerValue = maxDocsPerValue; this.executionHint = executionHint; diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregator.java index b8d58c193e7..f9c156e770d 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregator.java @@ -33,6 +33,7 @@ import org.elasticsearch.search.aggregations.AggregatorBuilder; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.LeafBucketCollector; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.bucket.BestDocsDeferringCollector; import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector; import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator; @@ -44,7 +45,6 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuild import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceType; - import java.io.IOException; import java.util.List; import java.util.Map; @@ -217,8 +217,9 @@ public class SamplerAggregator extends SingleBucketAggregator { } @Override - protected AggregatorFactory doBuild(AggregationContext context) { - return new SamplerAggregatorFactory(name, type, shardSize); + protected SamplerAggregatorFactory doBuild(AggregationContext context, AggregatorFactory parent, Builder subFactoriesBuilder) + throws IOException { + return new SamplerAggregatorFactory(name, type, shardSize, context, parent, subFactoriesBuilder, metaData); } @Override @@ -315,8 +316,9 @@ public class SamplerAggregator extends SingleBucketAggregator { @Override protected ValuesSourceAggregatorFactory innerBuild(AggregationContext context, - ValuesSourceConfig config) { - return new DiversifiedAggregatorFactory(name, TYPE, config, shardSize, maxDocsPerValue, executionHint); + ValuesSourceConfig config, AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new DiversifiedAggregatorFactory(name, TYPE, config, shardSize, maxDocsPerValue, executionHint, context, parent, + subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregatorFactory.java index d7b84825cf9..cce3a8738e4 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregatorFactory.java @@ -20,6 +20,7 @@ package org.elasticsearch.search.aggregations.bucket.sampler; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; @@ -33,8 +34,9 @@ public class SamplerAggregatorFactory extends AggregatorFactory parent, + AggregatorFactories.Builder subFactories, Map metaData) throws IOException { + super(name, type, context, parent, subFactories, metaData); this.shardSize = shardSize; } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorBuilder.java index add259bf9ca..ce2edfdd239 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorBuilder.java @@ -25,6 +25,8 @@ import org.elasticsearch.common.lucene.index.FilterableTermsEnum; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.mapper.MappedFieldType; import org.elasticsearch.index.query.QueryBuilder; +import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.JLHScore; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristicStreams; @@ -167,10 +169,10 @@ public class SignificantTermsAggregatorBuilder extends ValuesSourceAggregatorBui } @Override - protected ValuesSourceAggregatorFactory innerBuild(AggregationContext context, - ValuesSourceConfig config) { + protected ValuesSourceAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { return new SignificantTermsAggregatorFactory(name, type, config, includeExclude, executionHint, filterBuilder, - bucketCountThresholds, significanceHeuristic, context); + bucketCountThresholds, significanceHeuristic, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java index b5dd3dd56f9..217287e4a90 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java @@ -35,6 +35,7 @@ import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.search.aggregations.AggregationExecutionException; import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.NonCollectingAggregator; import org.elasticsearch.search.aggregations.InternalAggregation.Type; @@ -69,8 +70,9 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac public SignificantTermsAggregatorFactory(String name, Type type, ValuesSourceConfig config, IncludeExclude includeExclude, String executionHint, QueryBuilder filterBuilder, TermsAggregator.BucketCountThresholds bucketCountThresholds, - SignificanceHeuristic significanceHeuristic, AggregationContext context) { - super(name, type, config); + SignificanceHeuristic significanceHeuristic, AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); this.includeExclude = includeExclude; this.executionHint = executionHint; this.filterBuilder = filterBuilder; diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorBuilder.java index f0c7eac862d..2bfdcfe77ce 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorBuilder.java @@ -22,7 +22,9 @@ import org.elasticsearch.common.ParseField; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator.BucketCountThresholds; import org.elasticsearch.search.aggregations.bucket.terms.support.IncludeExclude; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -32,7 +34,6 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuild import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceType; - import java.io.IOException; import java.util.List; import java.util.Objects; @@ -199,10 +200,11 @@ public class TermsAggregatorBuilder extends ValuesSourceAggregatorBuilder innerBuild(AggregationContext context, - ValuesSourceConfig config) { + protected ValuesSourceAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { return new TermsAggregatorFactory(name, type, config, order, includeExclude, executionHint, collectMode, - bucketCountThresholds, showTermDocCountError); + bucketCountThresholds, + showTermDocCountError, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java index 19b8a2051a9..cdab6dd5810 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java @@ -25,6 +25,7 @@ import org.elasticsearch.common.ParseFieldMatcher; import org.elasticsearch.search.aggregations.AggregationExecutionException; import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.NonCollectingAggregator; import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode; @@ -53,8 +54,9 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory config, Terms.Order order, IncludeExclude includeExclude, String executionHint, SubAggCollectionMode collectMode, - TermsAggregator.BucketCountThresholds bucketCountThresholds, boolean showTermDocCountError) { - super(name, type, config); + TermsAggregator.BucketCountThresholds bucketCountThresholds, boolean showTermDocCountError, AggregationContext context, + AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); this.order = order; this.includeExclude = includeExclude; this.executionHint = executionHint; diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/avg/AvgAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/avg/AvgAggregator.java index b9d5f88e0fa..0f6657e307c 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/avg/AvgAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/avg/AvgAggregator.java @@ -28,9 +28,11 @@ import org.elasticsearch.common.util.LongArray; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.fielddata.SortedNumericDoubleValues; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.metrics.NumericMetricsAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -126,8 +128,9 @@ public class AvgAggregator extends NumericMetricsAggregator.SingleValue { } @Override - protected AvgAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config) { - return new AvgAggregatorFactory(name, type, config); + protected AvgAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new AvgAggregatorFactory(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/avg/AvgAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/avg/AvgAggregatorFactory.java index 5b570c00883..dec0ee1ffcf 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/avg/AvgAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/avg/AvgAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.metrics.avg; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -34,8 +36,9 @@ import java.util.Map; public class AvgAggregatorFactory extends ValuesSourceAggregatorFactory { - public AvgAggregatorFactory(String name, Type type, ValuesSourceConfig config) { - super(name, type, config); + public AvgAggregatorFactory(String name, Type type, ValuesSourceConfig config, AggregationContext context, + AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/cardinality/CardinalityAggregatorBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/cardinality/CardinalityAggregatorBuilder.java index 995e7b531f6..4f033c34990 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/cardinality/CardinalityAggregatorBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/cardinality/CardinalityAggregatorBuilder.java @@ -23,6 +23,8 @@ import org.elasticsearch.common.ParseField; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; +import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.support.AggregationContext; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; @@ -69,8 +71,9 @@ public final class CardinalityAggregatorBuilder extends ValuesSourceAggregatorBu } @Override - protected CardinalityAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config) { - return new CardinalityAggregatorFactory(name, type, config, precisionThreshold); + protected CardinalityAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new CardinalityAggregatorFactory(name, type, config, precisionThreshold, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/cardinality/CardinalityAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/cardinality/CardinalityAggregatorFactory.java index 61bf0a4e8ac..8ad3c959f12 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/cardinality/CardinalityAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/cardinality/CardinalityAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.metrics.cardinality; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; @@ -36,8 +38,10 @@ public class CardinalityAggregatorFactory extends ValuesSourceAggregatorFactory< private final Long precisionThreshold; - public CardinalityAggregatorFactory(String name, Type type, ValuesSourceConfig config, Long precisionThreshold) { - super(name, type, config); + public CardinalityAggregatorFactory(String name, Type type, ValuesSourceConfig config, Long precisionThreshold, + AggregationContext context, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, + Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); this.precisionThreshold = precisionThreshold; } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geobounds/GeoBoundsAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geobounds/GeoBoundsAggregator.java index 69f7eb6c3d8..be2c773c1a7 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geobounds/GeoBoundsAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geobounds/GeoBoundsAggregator.java @@ -30,9 +30,11 @@ import org.elasticsearch.common.util.DoubleArray; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.fielddata.MultiGeoPointValues; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.metrics.MetricsAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -41,7 +43,6 @@ import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceType; - import java.io.IOException; import java.util.List; import java.util.Map; @@ -199,9 +200,9 @@ public final class GeoBoundsAggregator extends MetricsAggregator { } @Override - protected GeoBoundsAggregatorFactory innerBuild(AggregationContext context, - ValuesSourceConfig config) { - return new GeoBoundsAggregatorFactory(name, type, config, wrapLongitude); + protected GeoBoundsAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new GeoBoundsAggregatorFactory(name, type, config, wrapLongitude, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geobounds/GeoBoundsAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geobounds/GeoBoundsAggregatorFactory.java index 44d1fe5994b..e36b03a9316 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geobounds/GeoBoundsAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geobounds/GeoBoundsAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.metrics.geobounds; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -35,8 +37,10 @@ public class GeoBoundsAggregatorFactory extends ValuesSourceAggregatorFactory config, boolean wrapLongitude) { - super(name, type, config); + public GeoBoundsAggregatorFactory(String name, Type type, ValuesSourceConfig config, boolean wrapLongitude, + AggregationContext context, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, + Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); this.wrapLongitude = wrapLongitude; } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geocentroid/GeoCentroidAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geocentroid/GeoCentroidAggregator.java index 37b3696a3cc..a4ef9f73803 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geocentroid/GeoCentroidAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geocentroid/GeoCentroidAggregator.java @@ -30,9 +30,11 @@ import org.elasticsearch.common.util.LongArray; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.fielddata.MultiGeoPointValues; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.metrics.MetricsAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -133,8 +135,9 @@ public final class GeoCentroidAggregator extends MetricsAggregator { } @Override - protected GeoCentroidAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config) { - return new GeoCentroidAggregatorFactory(name, type, config); + protected GeoCentroidAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new GeoCentroidAggregatorFactory(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geocentroid/GeoCentroidAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geocentroid/GeoCentroidAggregatorFactory.java index cb64eabde5d..81dc51466b0 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geocentroid/GeoCentroidAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geocentroid/GeoCentroidAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.metrics.geocentroid; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -33,8 +35,10 @@ import java.util.Map; public class GeoCentroidAggregatorFactory extends ValuesSourceAggregatorFactory { - public GeoCentroidAggregatorFactory(String name, Type type, ValuesSourceConfig config) { - super(name, type, config); + public GeoCentroidAggregatorFactory(String name, Type type, ValuesSourceConfig config, + AggregationContext context, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, + Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/max/MaxAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/max/MaxAggregator.java index d2ed9310872..dd5e667e0da 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/max/MaxAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/max/MaxAggregator.java @@ -29,9 +29,11 @@ import org.elasticsearch.index.fielddata.NumericDoubleValues; import org.elasticsearch.index.fielddata.SortedNumericDoubleValues; import org.elasticsearch.search.MultiValueMode; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.metrics.NumericMetricsAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -127,8 +129,9 @@ public class MaxAggregator extends NumericMetricsAggregator.SingleValue { } @Override - protected MaxAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config) { - return new MaxAggregatorFactory(name, type, config); + protected MaxAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new MaxAggregatorFactory(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/max/MaxAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/max/MaxAggregatorFactory.java index 3c9e8d224a4..39785f2abaf 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/max/MaxAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/max/MaxAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.metrics.max; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -34,8 +36,9 @@ import java.util.Map; public class MaxAggregatorFactory extends ValuesSourceAggregatorFactory { - public MaxAggregatorFactory(String name, Type type, ValuesSourceConfig config) { - super(name, type, config); + public MaxAggregatorFactory(String name, Type type, ValuesSourceConfig config, AggregationContext context, + AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregator.java index 7e9da858268..70b7050019d 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregator.java @@ -29,9 +29,11 @@ import org.elasticsearch.index.fielddata.NumericDoubleValues; import org.elasticsearch.index.fielddata.SortedNumericDoubleValues; import org.elasticsearch.search.MultiValueMode; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.metrics.NumericMetricsAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -126,8 +128,9 @@ public class MinAggregator extends NumericMetricsAggregator.SingleValue { } @Override - protected MinAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config) { - return new MinAggregatorFactory(name, type, config); + protected MinAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new MinAggregatorFactory(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregatorFactory.java index 126d992f057..aade8de45aa 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.metrics.min; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -34,8 +36,9 @@ import java.util.Map; public class MinAggregatorFactory extends ValuesSourceAggregatorFactory { - public MinAggregatorFactory(String name, Type type, ValuesSourceConfig config) { - super(name, type, config); + public MinAggregatorFactory(String name, Type type, ValuesSourceConfig config, AggregationContext context, + AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/PercentileRanksAggregatorBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/PercentileRanksAggregatorBuilder.java index 30dbc0c39b9..d022c910096 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/PercentileRanksAggregatorBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/PercentileRanksAggregatorBuilder.java @@ -22,6 +22,8 @@ package org.elasticsearch.search.aggregations.metrics.percentiles; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; +import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.metrics.percentiles.hdr.HDRPercentileRanksAggregatorFactory; import org.elasticsearch.search.aggregations.metrics.percentiles.tdigest.InternalTDigestPercentileRanks; import org.elasticsearch.search.aggregations.metrics.percentiles.tdigest.TDigestPercentileRanksAggregatorFactory; @@ -126,12 +128,15 @@ public class PercentileRanksAggregatorBuilder extends LeafOnly innerBuild(AggregationContext context, ValuesSourceConfig config) { + protected ValuesSourceAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { switch (method) { case TDIGEST: - return new TDigestPercentileRanksAggregatorFactory(name, type, config, values, compression, keyed); + return new TDigestPercentileRanksAggregatorFactory(name, type, config, values, compression, keyed, context, parent, + subFactoriesBuilder, metaData); case HDR: - return new HDRPercentileRanksAggregatorFactory(name, type, config, values, numberOfSignificantValueDigits, keyed); + return new HDRPercentileRanksAggregatorFactory(name, type, config, values, numberOfSignificantValueDigits, keyed, context, + parent, subFactoriesBuilder, metaData); default: throw new IllegalStateException("Illegal method [" + method.getName() + "]"); } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/PercentilesAggregatorBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/PercentilesAggregatorBuilder.java index 89a3e00fa50..243028a5bf8 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/PercentilesAggregatorBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/PercentilesAggregatorBuilder.java @@ -22,6 +22,8 @@ package org.elasticsearch.search.aggregations.metrics.percentiles; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; +import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.metrics.percentiles.hdr.HDRPercentilesAggregatorFactory; import org.elasticsearch.search.aggregations.metrics.percentiles.tdigest.InternalTDigestPercentiles; import org.elasticsearch.search.aggregations.metrics.percentiles.tdigest.TDigestPercentilesAggregatorFactory; @@ -126,12 +128,15 @@ public class PercentilesAggregatorBuilder extends LeafOnly innerBuild(AggregationContext context, ValuesSourceConfig config) { + protected ValuesSourceAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { switch (method) { case TDIGEST: - return new TDigestPercentilesAggregatorFactory(name, type, config, percents, compression, keyed); + return new TDigestPercentilesAggregatorFactory(name, type, config, percents, compression, keyed, context, parent, + subFactoriesBuilder, metaData); case HDR: - return new HDRPercentilesAggregatorFactory(name, type, config, percents, numberOfSignificantValueDigits, keyed); + return new HDRPercentilesAggregatorFactory(name, type, config, percents, numberOfSignificantValueDigits, keyed, context, parent, + subFactoriesBuilder, metaData); default: throw new IllegalStateException("Illegal method [" + method.getName() + "]"); } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/hdr/HDRPercentileRanksAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/hdr/HDRPercentileRanksAggregatorFactory.java index 8ff764fcc23..6a52e86b868 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/hdr/HDRPercentileRanksAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/hdr/HDRPercentileRanksAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.metrics.percentiles.hdr; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -40,8 +42,9 @@ public class HDRPercentileRanksAggregatorFactory private final boolean keyed; public HDRPercentileRanksAggregatorFactory(String name, Type type, ValuesSourceConfig config, double[] values, - int numberOfSignificantValueDigits, boolean keyed) { - super(name, type, config); + int numberOfSignificantValueDigits, boolean keyed, AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); this.values = values; this.numberOfSignificantValueDigits = numberOfSignificantValueDigits; this.keyed = keyed; diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/hdr/HDRPercentilesAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/hdr/HDRPercentilesAggregatorFactory.java index 103f5fbbe66..64416103e08 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/hdr/HDRPercentilesAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/hdr/HDRPercentilesAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.metrics.percentiles.hdr; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -39,8 +41,9 @@ public class HDRPercentilesAggregatorFactory extends ValuesSourceAggregatorFacto private final boolean keyed; public HDRPercentilesAggregatorFactory(String name, Type type, ValuesSourceConfig config, double[] percents, - int numberOfSignificantValueDigits, boolean keyed) { - super(name, type, config); + int numberOfSignificantValueDigits, boolean keyed, AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); this.percents = percents; this.numberOfSignificantValueDigits = numberOfSignificantValueDigits; this.keyed = keyed; diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/tdigest/TDigestPercentileRanksAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/tdigest/TDigestPercentileRanksAggregatorFactory.java index 0ed62aa7fea..b75db659d5f 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/tdigest/TDigestPercentileRanksAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/tdigest/TDigestPercentileRanksAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.metrics.percentiles.tdigest; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -40,8 +42,9 @@ public class TDigestPercentileRanksAggregatorFactory private final boolean keyed; public TDigestPercentileRanksAggregatorFactory(String name, Type type, ValuesSourceConfig config, double[] percents, - double compression, boolean keyed) { - super(name, type, config); + double compression, boolean keyed, AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); this.percents = percents; this.compression = compression; this.keyed = keyed; diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/tdigest/TDigestPercentilesAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/tdigest/TDigestPercentilesAggregatorFactory.java index 47c8392cc72..3838dc2b4d7 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/tdigest/TDigestPercentilesAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/tdigest/TDigestPercentilesAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.metrics.percentiles.tdigest; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -40,8 +42,9 @@ public class TDigestPercentilesAggregatorFactory private final boolean keyed; public TDigestPercentilesAggregatorFactory(String name, Type type, ValuesSourceConfig config, double[] percents, - double compression, boolean keyed) { - super(name, type, config); + double compression, boolean keyed, AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); this.percents = percents; this.compression = compression; this.keyed = keyed; diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregator.java index ca0980c41f0..d2d7ccbb615 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregator.java @@ -35,6 +35,7 @@ import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.metrics.MetricsAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -195,8 +196,10 @@ public class ScriptedMetricAggregator extends MetricsAggregator { } @Override - protected AggregatorFactory doBuild(AggregationContext context) { - return new ScriptedMetricAggregatorFactory(name, type, initScript, mapScript, combineScript, reduceScript, params); + protected ScriptedMetricAggregatorFactory doBuild(AggregationContext context, AggregatorFactory parent, + Builder subfactoriesBuilder) throws IOException { + return new ScriptedMetricAggregatorFactory(name, type, initScript, mapScript, combineScript, reduceScript, params, context, + parent, subfactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregatorFactory.java index 7c11a5809f6..e19f7b70fe9 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregatorFactory.java @@ -22,6 +22,7 @@ package org.elasticsearch.search.aggregations.metrics.scripted; import org.elasticsearch.script.Script; import org.elasticsearch.search.SearchParseException; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; @@ -44,8 +45,9 @@ public class ScriptedMetricAggregatorFactory extends AggregatorFactory params; public ScriptedMetricAggregatorFactory(String name, Type type, Script initScript, Script mapScript, Script combineScript, - Script reduceScript, Map params) { - super(name, type); + Script reduceScript, Map params, AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactories, Map metaData) throws IOException { + super(name, type, context, parent, subFactories, metaData); this.initScript = initScript; this.mapScript = mapScript; this.combineScript = combineScript; diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/StatsAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/StatsAggregator.java index 88fe4a177d2..bdd513e56a4 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/StatsAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/StatsAggregator.java @@ -28,9 +28,11 @@ import org.elasticsearch.common.util.LongArray; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.fielddata.SortedNumericDoubleValues; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.metrics.NumericMetricsAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -168,8 +170,9 @@ public class StatsAggregator extends NumericMetricsAggregator.MultiValue { } @Override - protected StatsAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config) { - return new StatsAggregatorFactory(name, type, config); + protected StatsAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new StatsAggregatorFactory(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/StatsAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/StatsAggregatorFactory.java index 42b0b9b3541..9c9cc6854e6 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/StatsAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/StatsAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.metrics.stats; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -34,8 +36,9 @@ import java.util.Map; public class StatsAggregatorFactory extends ValuesSourceAggregatorFactory { - public StatsAggregatorFactory(String name, Type type, ValuesSourceConfig config) { - super(name, type, config); + public StatsAggregatorFactory(String name, Type type, ValuesSourceConfig config, AggregationContext context, + AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/extended/ExtendedStatsAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/extended/ExtendedStatsAggregator.java index 45c836edceb..fab1cd5a3a5 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/extended/ExtendedStatsAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/extended/ExtendedStatsAggregator.java @@ -29,9 +29,11 @@ import org.elasticsearch.common.util.LongArray; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.fielddata.SortedNumericDoubleValues; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.metrics.NumericMetricsAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -216,8 +218,9 @@ public class ExtendedStatsAggregator extends NumericMetricsAggregator.MultiValue } @Override - protected ExtendedStatsAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config) { - return new ExtendedStatsAggregatorFactory(name, type, config, sigma); + protected ExtendedStatsAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new ExtendedStatsAggregatorFactory(name, type, config, sigma, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/extended/ExtendedStatsAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/extended/ExtendedStatsAggregatorFactory.java index 472158bc22f..16208d9797c 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/extended/ExtendedStatsAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/extended/ExtendedStatsAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.metrics.stats.extended; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -36,8 +38,10 @@ public class ExtendedStatsAggregatorFactory extends ValuesSourceAggregatorFactor private final double sigma; - public ExtendedStatsAggregatorFactory(String name, Type type, ValuesSourceConfig config, double sigma) { - super(name, type, config); + public ExtendedStatsAggregatorFactory(String name, Type type, ValuesSourceConfig config, double sigma, + AggregationContext context, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, + Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); this.sigma = sigma; } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/sum/SumAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/sum/SumAggregator.java index b734bd5d3cf..7c1548deb2b 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/sum/SumAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/sum/SumAggregator.java @@ -27,6 +27,8 @@ import org.elasticsearch.common.util.DoubleArray; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.fielddata.SortedNumericDoubleValues; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; @@ -118,8 +120,9 @@ public class SumAggregator extends NumericMetricsAggregator.SingleValue { } @Override - protected SumAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config) { - return new SumAggregatorFactory(name, type, config); + protected SumAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { + return new SumAggregatorFactory(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/sum/SumAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/sum/SumAggregatorFactory.java index e6956bfb0f1..4efd4b42876 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/sum/SumAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/sum/SumAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.metrics.sum; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -34,8 +36,9 @@ import java.util.Map; public class SumAggregatorFactory extends ValuesSourceAggregatorFactory { - public SumAggregatorFactory(String name, Type type, ValuesSourceConfig config) { - super(name, type, config); + public SumAggregatorFactory(String name, Type type, ValuesSourceConfig config, AggregationContext context, + AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregator.java index 7ab92e8bb59..c064f9b0bab 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregator.java @@ -49,6 +49,7 @@ import org.elasticsearch.search.aggregations.AggregatorBuilder; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.metrics.MetricsAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -554,11 +555,11 @@ public class TopHitsAggregator extends MetricsAggregator { public boolean trackScores() { return trackScores; } - @Override - protected AggregatorFactory doBuild(AggregationContext context) { + protected AggregatorFactory doBuild(AggregationContext context, AggregatorFactory parent, Builder subfactoriesBuilder) + throws IOException { return new TopHitsAggregatorFactory(name, type, from, size, explain, version, trackScores, sorts, highlightBuilder, fieldNames, - fieldDataFields, scriptFields, fetchSourceContext); + fieldDataFields, scriptFields, fetchSourceContext, context, parent, subfactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregatorFactory.java index 2a12a956513..565b1b7c67b 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregatorFactory.java @@ -28,6 +28,7 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.script.ScriptContext; import org.elasticsearch.script.SearchScript; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; @@ -63,8 +64,9 @@ public class TopHitsAggregatorFactory extends AggregatorFactory sorts, HighlightBuilder highlightBuilder, List fieldNames, List fieldDataFields, - List scriptFields, FetchSourceContext fetchSourceContext) { - super(name, type); + List scriptFields, FetchSourceContext fetchSourceContext, AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactories, Map metaData) throws IOException { + super(name, type, context, parent, subFactories, metaData); this.from = from; this.size = size; this.explain = explain; diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/valuecount/ValueCountAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/valuecount/ValueCountAggregator.java index 68aabf90cb5..16c38e2422e 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/valuecount/ValueCountAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/valuecount/ValueCountAggregator.java @@ -27,6 +27,9 @@ import org.elasticsearch.common.util.LongArray; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.fielddata.SortedBinaryDocValues; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; @@ -36,6 +39,7 @@ import org.elasticsearch.search.aggregations.support.AggregationContext; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorBuilder; +import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceType; import org.elasticsearch.search.aggregations.support.format.ValueFormatter; @@ -121,8 +125,9 @@ public class ValueCountAggregator extends NumericMetricsAggregator.SingleValue { } @Override - protected ValueCountAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config) { - return new ValueCountAggregatorFactory(name, type, config); + protected ValueCountAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) throws IOException { + return new ValueCountAggregatorFactory(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/valuecount/ValueCountAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/valuecount/ValueCountAggregatorFactory.java index d27fd5a0cb2..ee65dea2766 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/valuecount/ValueCountAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/valuecount/ValueCountAggregatorFactory.java @@ -20,6 +20,8 @@ package org.elasticsearch.search.aggregations.metrics.valuecount; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationContext; @@ -33,8 +35,9 @@ import java.util.Map; public class ValueCountAggregatorFactory extends ValuesSourceAggregatorFactory { - public ValueCountAggregatorFactory(String name, Type type, ValuesSourceConfig config) { - super(name, type, config); + public ValueCountAggregatorFactory(String name, Type type, ValuesSourceConfig config, AggregationContext context, + AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, config, context, parent, subFactoriesBuilder, metaData); } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceAggregatorBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceAggregatorBuilder.java index dee2ad62fc2..4a84507f7f2 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceAggregatorBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceAggregatorBuilder.java @@ -37,6 +37,8 @@ import org.elasticsearch.search.aggregations.AggregationInitializationException; import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorBuilder; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.format.ValueFormat; @@ -177,9 +179,10 @@ public abstract class ValuesSourceAggregatorBuilder doBuild(AggregationContext context) { + protected final ValuesSourceAggregatorFactory doBuild(AggregationContext context, AggregatorFactory parent, + AggregatorFactories.Builder subFactoriesBuilder) throws IOException { ValuesSourceConfig config = resolveConfig(context); - ValuesSourceAggregatorFactory factory = innerBuild(context, config); + ValuesSourceAggregatorFactory factory = innerBuild(context, config, parent, subFactoriesBuilder); return factory; } @@ -188,7 +191,8 @@ public abstract class ValuesSourceAggregatorBuilder innerBuild(AggregationContext context, ValuesSourceConfig config); + protected abstract ValuesSourceAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, + AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) throws IOException; public ValuesSourceConfig config(AggregationContext context) { diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceAggregatorFactory.java index 12c821eeebd..b724bdcc2af 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceAggregatorFactory.java @@ -20,6 +20,7 @@ package org.elasticsearch.search.aggregations.support; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.InternalAggregation.Type; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; @@ -35,8 +36,9 @@ public abstract class ValuesSourceAggregatorFactory config; - public ValuesSourceAggregatorFactory(String name, Type type, ValuesSourceConfig config) { - super(name, type); + public ValuesSourceAggregatorFactory(String name, Type type, ValuesSourceConfig config, AggregationContext context, + AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map metaData) throws IOException { + super(name, type, context, parent, subFactoriesBuilder, metaData); this.config = config; } diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/AggregationCollectorTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/AggregationCollectorTests.java index 6152df579c9..29eb13dd72d 100644 --- a/core/src/test/java/org/elasticsearch/search/aggregations/AggregationCollectorTests.java +++ b/core/src/test/java/org/elasticsearch/search/aggregations/AggregationCollectorTests.java @@ -69,9 +69,7 @@ public class AggregationCollectorTests extends ESSingleNodeTestCase { aggParser.nextToken(); SearchContext searchContext = createSearchContext(index); AggregationContext aggContext = new AggregationContext(searchContext); - final AggregatorFactories factories = parser.parseAggregators(aggParser, parseContext).build(aggContext); - AggregationContext aggregationContext = new AggregationContext(searchContext); - factories.init(aggregationContext); + final AggregatorFactories factories = parser.parseAggregators(aggParser, parseContext).build(aggContext, null); final Aggregator[] aggregators = factories.createTopLevelAggregators(); assertEquals(1, aggregators.length); return aggregators[0].needsScores(); diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregatorTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregatorTests.java index 84950e8f258..cfe7e0079f6 100644 --- a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregatorTests.java +++ b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregatorTests.java @@ -125,9 +125,8 @@ public class NestedAggregatorTests extends ESSingleNodeTestCase { AggregatorFactories.Builder builder = AggregatorFactories.builder(); NestedAggregator.NestedAggregatorBuilder factory = new NestedAggregator.NestedAggregatorBuilder("test", "nested_field"); builder.addAggregator(factory); - AggregatorFactories factories = builder.build(context); + AggregatorFactories factories = builder.build(context, null); searchContext.aggregations(new SearchContextAggregations(factories)); - factories.init(context); Aggregator[] aggs = factories.createTopLevelAggregators(); BucketCollector collector = BucketCollector.wrap(Arrays.asList(aggs)); collector.preCollection();