Class AggregatorFactory

Direct Known Subclasses:
AdjacencyMatrixAggregatorFactory, FilterAggregatorFactory, FiltersAggregatorFactory, GlobalAggregatorFactory, MultiValuesSourceAggregatorFactory, NestedAggregatorFactory, ReverseNestedAggregatorFactory, SamplerAggregatorFactory, SignificantTextAggregatorFactory, ValuesSourceAggregatorFactory

public abstract class AggregatorFactory
extends java.lang.Object
  • Field Details

  • Constructor Details

    • AggregatorFactory

      public AggregatorFactory​(java.lang.String name, QueryShardContext queryShardContext, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, java.util.Map<java.lang.String,​java.lang.Object> metaData) throws
      Constructs a new aggregator factory.
      name - The aggregation name
      Throws: - if an error occurs creating the factory
  • Method Details

    • name

      public java.lang.String name()
    • doValidate

      public void doValidate()
    • createInternal

      protected abstract Aggregator createInternal​(SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket, java.util.List<PipelineAggregator> pipelineAggregators, java.util.Map<java.lang.String,​java.lang.Object> metaData) throws
    • create

      public final Aggregator create​(SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket) throws
      Creates the aggregator
      searchContext - The search context
      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.
      The created aggregator
    • getParent

      public AggregatorFactory getParent()
    • asMultiBucketAggregator

      protected static Aggregator asMultiBucketAggregator​(AggregatorFactory factory, SearchContext searchContext, Aggregator parent) throws
      Utility method. Given an AggregatorFactory that creates Aggregators that only know how to collect bucket 0, this returns an aggregator that can collect any bucket.