Class DeferableBucketAggregator

All Implemented Interfaces:
java.io.Closeable, java.lang.AutoCloseable, org.apache.lucene.search.Collector, Releasable
Direct Known Subclasses:
AbstractRareTermsAggregator, SamplerAggregator, TermsAggregator, VariableWidthHistogramAggregator

public abstract class DeferableBucketAggregator
extends BucketsAggregator
  • Constructor Details

    • DeferableBucketAggregator

      protected DeferableBucketAggregator​(java.lang.String name, AggregatorFactories factories, AggregationContext context, Aggregator parent, java.util.Map<java.lang.String,​java.lang.Object> metadata) throws java.io.IOException
      Throws:
      java.io.IOException
  • Method Details

    • doPreCollection

      protected void doPreCollection() throws java.io.IOException
      Description copied from class: AggregatorBase
      Can be overridden by aggregator implementation to be called back when the collection phase starts.
      Overrides:
      doPreCollection in class AggregatorBase
      Throws:
      java.io.IOException
    • deferringCollector

      protected DeferringBucketCollector deferringCollector()
      Get the deferring collector.
    • buildDeferringCollector

      protected DeferringBucketCollector buildDeferringCollector()
      Build the DeferringBucketCollector. The default implementation replays all hits against the buckets selected by {#link DeferringBucketCollector.prepareSelectedBuckets(long...).
    • shouldDefer

      protected boolean shouldDefer​(Aggregator aggregator)
      This method should be overridden by subclasses that want to defer calculation of a child aggregation until a first pass is complete and a set of buckets has been pruned.
      Parameters:
      aggregator - the child aggregator
      Returns:
      true if the aggregator should be deferred until a first pass at collection has completed
    • prepareSubAggs

      protected final void prepareSubAggs​(long[] bucketOrdsToCollect) throws java.io.IOException
      Description copied from class: BucketsAggregator
      Hook to allow taking an action before building the sub agg results.
      Overrides:
      prepareSubAggs in class BucketsAggregator
      Throws:
      java.io.IOException
    • collectDebugInfo

      public void collectDebugInfo​(java.util.function.BiConsumer<java.lang.String,​java.lang.Object> add)
      Description copied from class: Aggregator
      Collect debug information to add to the profiling results. This will only be called if the aggregation is being profiled.

      Well behaved implementations will always call the superclass implementation just in case it has something interesting. They will also only add objects which can be serialized with StreamOutput.writeGenericValue(Object) and XContentBuilder.value(Object). And they'll have an integration test.

      Overrides:
      collectDebugInfo in class Aggregator