Class MultiBucketCollector
java.lang.Object
org.elasticsearch.search.aggregations.BucketCollector
org.elasticsearch.search.aggregations.MultiBucketCollector
- All Implemented Interfaces:
org.apache.lucene.search.Collector
A
BucketCollector
which allows running a bucket collection with several
BucketCollector
s. 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_COLLECTOR
s and not
the null ones.-
Field Summary
Fields inherited from class org.elasticsearch.search.aggregations.BucketCollector
NO_OP_COLLECTOR
-
Method Summary
Modifier and TypeMethodDescriptiongetLeafCollector(org.apache.lucene.index.LeafReaderContext context)
void
Post-collection callback.void
Pre collection callback.org.apache.lucene.search.ScoreMode
toString()
static BucketCollector
wrap(boolean terminateIfNoop, Iterable<? extends BucketCollector> collectors)
Wraps a list ofBucketCollector
s with aMultiBucketCollector
.
-
Method Details
-
wrap
public static BucketCollector wrap(boolean terminateIfNoop, Iterable<? extends BucketCollector> collectors)Wraps a list ofBucketCollector
s with aMultiBucketCollector
. This method works as follows:- Filters out the
BucketCollector.NO_OP_COLLECTOR
s collectors, so they are not used during search time. - If the input contains 1 real collector we wrap it in a collector that takes
terminateIfNoop
into account. - Otherwise the method returns a
MultiBucketCollector
which wraps the non-BucketCollector.NO_OP_COLLECTOR
collectors.
- Parameters:
terminateIfNoop
- Pass true ifgetLeafCollector(org.apache.lucene.index.LeafReaderContext)
should throwCollectionTerminatedException
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.
- Filters out the
-
scoreMode
public org.apache.lucene.search.ScoreMode scoreMode() -
preCollection
Description copied from class:BucketCollector
Pre collection callback.- Specified by:
preCollection
in classBucketCollector
- Throws:
IOException
-
postCollection
Description copied from class:BucketCollector
Post-collection callback.- Specified by:
postCollection
in classBucketCollector
- Throws:
IOException
-
toString
-
getLeafCollector
public LeafBucketCollector getLeafCollector(org.apache.lucene.index.LeafReaderContext context) throws IOException- Specified by:
getLeafCollector
in interfaceorg.apache.lucene.search.Collector
- Specified by:
getLeafCollector
in classBucketCollector
- Throws:
IOException
-