public abstract class AggregatorFactory<AF extends AggregatorFactory<AF>>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
AggregatorFactory.MultiBucketAggregatorWrapper |
Modifier and Type | Field and Description |
---|---|
protected SearchContext |
context |
protected AggregatorFactories |
factories |
protected java.util.Map<java.lang.String,java.lang.Object> |
metaData |
protected java.lang.String |
name |
protected AggregatorFactory<?> |
parent |
Constructor and Description |
---|
AggregatorFactory(java.lang.String name,
SearchContext context,
AggregatorFactory<?> parent,
AggregatorFactories.Builder subFactoriesBuilder,
java.util.Map<java.lang.String,java.lang.Object> metaData)
Constructs a new aggregator factory.
|
Modifier and Type | Method and Description |
---|---|
protected static Aggregator |
asMultiBucketAggregator(AggregatorFactory<?> factory,
SearchContext context,
Aggregator parent)
Utility method.
|
Aggregator |
create(Aggregator parent,
boolean collectsFromSingleBucket)
Creates the aggregator
|
protected abstract Aggregator |
createInternal(Aggregator parent,
boolean collectsFromSingleBucket,
java.util.List<PipelineAggregator> pipelineAggregators,
java.util.Map<java.lang.String,java.lang.Object> metaData) |
void |
doValidate() |
AggregatorFactory<?> |
getParent() |
java.lang.String |
name() |
void |
validate()
Validates the state of this factory (makes sure the factory is properly
configured)
|
protected final java.lang.String name
protected final AggregatorFactory<?> parent
protected final AggregatorFactories factories
protected final java.util.Map<java.lang.String,java.lang.Object> metaData
protected final SearchContext context
public AggregatorFactory(java.lang.String name, SearchContext context, AggregatorFactory<?> parent, AggregatorFactories.Builder subFactoriesBuilder, java.util.Map<java.lang.String,java.lang.Object> metaData) throws java.io.IOException
name
- The aggregation namejava.io.IOException
- if an error occurs creating the factorypublic java.lang.String name()
public final void validate()
public void doValidate()
protected abstract Aggregator createInternal(Aggregator parent, boolean collectsFromSingleBucket, java.util.List<PipelineAggregator> pipelineAggregators, java.util.Map<java.lang.String,java.lang.Object> metaData) throws java.io.IOException
java.io.IOException
public final Aggregator create(Aggregator parent, boolean collectsFromSingleBucket) throws java.io.IOException
parent
- The parent aggregator (if this is a top level factory, the
parent will be null
)collectsFromSingleBucket
- If true then the created aggregator will only be collected
with 0 as a bucket ordinal. Some factories can take
advantage of this in order to return more optimized
implementations.java.io.IOException
public AggregatorFactory<?> getParent()
protected static Aggregator asMultiBucketAggregator(AggregatorFactory<?> factory, SearchContext context, Aggregator parent) throws java.io.IOException
AggregatorFactory
that creates
Aggregator
s that only know how to collect bucket 0, this
returns an aggregator that can collect any bucket.java.io.IOException