Class LeafBucketCollectorBase
java.lang.Object
org.elasticsearch.search.aggregations.LeafBucketCollector
org.elasticsearch.search.aggregations.LeafBucketCollectorBase
- All Implemented Interfaces:
org.apache.lucene.search.LeafCollector
A
LeafBucketCollector
that delegates all calls to the sub leaf
aggregator and sets the scorer on its source of values if it implements
ScorerAware
.-
Field Summary
Fields inherited from class org.elasticsearch.search.aggregations.LeafBucketCollector
NO_OP_COLLECTOR
-
Constructor Summary
-
Method Summary
Methods inherited from class org.elasticsearch.search.aggregations.LeafBucketCollector
collect, isNoop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.lucene.search.LeafCollector
competitiveIterator
-
Constructor Details
-
LeafBucketCollectorBase
- Parameters:
sub
- The leaf collector for sub aggregations.values
- The values.ScorerAware.setScorer(org.apache.lucene.search.Scorable)
will be called automatically on them if they implementScorerAware
.
-
-
Method Details
-
setScorer
- Specified by:
setScorer
in interfaceorg.apache.lucene.search.LeafCollector
- Overrides:
setScorer
in classLeafBucketCollector
- Throws:
IOException
-
collect
Description copied from class:LeafBucketCollector
Collect the givendoc
in the bucket owned byowningBucketOrd
.The implementation of this method metric aggregations is generally something along the lines of
array[owningBucketOrd] += loadValueFromDoc(doc)
Bucket aggregations have more trouble because their job is to make new ordinals. So their implementation generally looks kind of like
long myBucketOrd = mapOwningBucketAndValueToMyOrd(owningBucketOrd, loadValueFromDoc(doc)); collectBucket(doc, myBucketOrd);
Some bucket aggregations "know" how many ordinals each owning ordinal needs so they can map "densely". The
range
aggregation, for example, can perform this mapping with something like:
Other aggregations don't know how many buckets will fall into any particular owning bucket. Thereturn rangeCount * owningBucketOrd + matchingRange(value);
terms
aggregation, for example, usesLongKeyedBucketOrds
which amounts to a hash lookup.- Specified by:
collect
in classLeafBucketCollector
- Throws:
IOException
-