Class MultiBucketCollector

java.lang.Object
org.elasticsearch.search.aggregations.BucketCollector
org.elasticsearch.search.aggregations.MultiBucketCollector
All Implemented Interfaces:
org.apache.lucene.search.Collector

public class MultiBucketCollector
extends BucketCollector
A BucketCollector which allows running a bucket collection with several BucketCollectors. It is similar to the MultiCollector except that the wrap(boolean, java.lang.Iterable<? extends org.elasticsearch.search.aggregations.BucketCollector>) method filters out the BucketCollector.NO_OP_COLLECTORs and not the null ones.
  • Method Details

    • wrap

      public static BucketCollector wrap​(boolean terminateIfNoop, java.lang.Iterable<? extends BucketCollector> collectors)
      Wraps a list of BucketCollectors with a MultiBucketCollector. This method works as follows:
      Parameters:
      terminateIfNoop - Pass true if getLeafCollector(org.apache.lucene.index.LeafReaderContext) should throw CollectionTerminatedException if all leaf collectors are noop. Pass false if terminating would break stuff. The top level collection for aggregations should pass true here because we want to skip collections if all aggregations return NOOP. But when aggregtors themselves call this method they chould *generally* pass false here because they have collection actions to perform even if their sub-aggregators are NOOPs.
    • scoreMode

      public org.apache.lucene.search.ScoreMode scoreMode()
    • preCollection

      public void preCollection() throws java.io.IOException
      Description copied from class: BucketCollector
      Pre collection callback.
      Specified by:
      preCollection in class BucketCollector
      Throws:
      java.io.IOException
    • postCollection

      public void postCollection() throws java.io.IOException
      Description copied from class: BucketCollector
      Post-collection callback.
      Specified by:
      postCollection in class BucketCollector
      Throws:
      java.io.IOException
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • getLeafCollector

      public LeafBucketCollector getLeafCollector​(org.apache.lucene.index.LeafReaderContext context) throws java.io.IOException
      Specified by:
      getLeafCollector in interface org.apache.lucene.search.Collector
      Specified by:
      getLeafCollector in class BucketCollector
      Throws:
      java.io.IOException