public class DeferringBucketCollector extends BucketCollector implements Releasable
RecordingBucketCollector
is to allow
the possibility of alternative recorder impl choices while keeping the logic in here for
setting AggregationContext
's setNextReader method and preparing the appropriate choice
of filtering logic for stream replay. These felt like agg-specific functions that should be kept away
from the RecordingBucketCollector
impl which is concentrated on efficient storage of doc and bucket IDsBucketCollector.BucketAnalysisCollector
NO_OP_COLLECTOR
Constructor and Description |
---|
DeferringBucketCollector(BucketCollector deferred,
AggregationContext context) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
collect(int docId,
long bucketOrdinal)
Called during the query phase, to collect & aggregate the given document.
|
void |
gatherAnalysis(BucketCollector.BucketAnalysisCollector analysisCollector,
long bucketOrdinal)
Called post-collection to gather the results from surviving buckets.
|
void |
postCollection()
Post collection callback.
|
void |
prepareSelectedBuckets(long... survivingBucketOrds)
Plays a selection of the data cached from previous collect calls to the
deferred collector.
|
void |
setNextReader(org.apache.lucene.index.AtomicReaderContext reader) |
wrap
public DeferringBucketCollector(BucketCollector deferred, AggregationContext context)
public void setNextReader(org.apache.lucene.index.AtomicReaderContext reader)
setNextReader
in interface ReaderContextAware
public void collect(int docId, long bucketOrdinal) throws IOException
BucketCollector
collect
in class BucketCollector
bucketOrdinal
- The ordinal of the bucket this aggregator belongs to, assuming this aggregator is not a top level aggregator.
Typically, aggregators with #bucketAggregationMode
set to Aggregator.BucketAggregationMode.MULTI_BUCKETS
will heavily depend on this ordinal. Other aggregators may or may not use it and can see this ordinal as just
an extra information for the aggregation context. For top level aggregators, the ordinal will always be
equal to 0.IOException
public void postCollection() throws IOException
BucketCollector
postCollection
in class BucketCollector
IOException
public void prepareSelectedBuckets(long... survivingBucketOrds)
survivingBucketOrds
- the valid bucket ords for which deferred collection should be
attemptedpublic void close() throws ElasticsearchException
close
in interface AutoCloseable
close
in interface Releasable
ElasticsearchException
public void gatherAnalysis(BucketCollector.BucketAnalysisCollector analysisCollector, long bucketOrdinal)
BucketCollector
gatherAnalysis
in class BucketCollector
Copyright © 2009–2015. All rights reserved.