Class AggregatorFactory
- java.lang.Object
-
- org.elasticsearch.search.aggregations.AggregatorFactory
-
- Direct Known Subclasses:
AdjacencyMatrixAggregatorFactory,FilterAggregatorFactory,FiltersAggregatorFactory,GlobalAggregatorFactory,MultiValuesSourceAggregatorFactory,NestedAggregatorFactory,ReverseNestedAggregatorFactory,SamplerAggregatorFactory,SignificantTextAggregatorFactory,ValuesSourceAggregatorFactory
public abstract class AggregatorFactory extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAggregatorFactory.MultiBucketAggregatorWrapper
-
Field Summary
Fields Modifier and Type Field Description protected AggregatorFactoriesfactoriesprotected Map<String,Object>metaDataprotected Stringnameprotected AggregatorFactoryparentprotected QueryShardContextqueryShardContext
-
Constructor Summary
Constructors Constructor Description AggregatorFactory(String name, QueryShardContext queryShardContext, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map<String,Object> metaData)Constructs a new aggregator factory.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static AggregatorasMultiBucketAggregator(AggregatorFactory factory, SearchContext searchContext, Aggregator parent)Utility method.Aggregatorcreate(SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket)Creates the aggregatorprotected abstract AggregatorcreateInternal(SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators, Map<String,Object> metaData)voiddoValidate()AggregatorFactorygetParent()Stringname()
-
-
-
Field Detail
-
name
protected final String name
-
parent
protected final AggregatorFactory parent
-
factories
protected final AggregatorFactories factories
-
queryShardContext
protected final QueryShardContext queryShardContext
-
-
Constructor Detail
-
AggregatorFactory
public AggregatorFactory(String name, QueryShardContext queryShardContext, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map<String,Object> metaData) throws IOException
Constructs a new aggregator factory.- Parameters:
name- The aggregation name- Throws:
IOException- if an error occurs creating the factory
-
-
Method Detail
-
name
public String name()
-
doValidate
public void doValidate()
-
createInternal
protected abstract Aggregator createInternal(SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators, Map<String,Object> metaData) throws IOException
- Throws:
IOException
-
create
public final Aggregator create(SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket) throws IOException
Creates the aggregator- Parameters:
searchContext- The search contextparent- The parent aggregator (if this is a top level factory, the parent will benull)collectsFromSingleBucket- If true then the created aggregator will only be collected with0as a bucket ordinal. Some factories can take advantage of this in order to return more optimized implementations.- Returns:
- The created aggregator
- Throws:
IOException
-
getParent
public AggregatorFactory getParent()
-
asMultiBucketAggregator
protected static Aggregator asMultiBucketAggregator(AggregatorFactory factory, SearchContext searchContext, Aggregator parent) throws IOException
Utility method. Given anAggregatorFactorythat createsAggregators that only know how to collect bucket0, this returns an aggregator that can collect any bucket.- Throws:
IOException
-
-