Module org.elasticsearch.server
Class RandomSamplerAggregator
java.lang.Object
org.elasticsearch.search.aggregations.BucketCollector
org.elasticsearch.search.aggregations.Aggregator
org.elasticsearch.search.aggregations.AggregatorBase
org.elasticsearch.search.aggregations.bucket.BucketsAggregator
org.elasticsearch.search.aggregations.bucket.sampler.random.RandomSamplerAggregator
- All Implemented Interfaces:
 Closeable,AutoCloseable,Releasable,SingleBucketAggregator
- 
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.bucket.BucketsAggregator
BucketsAggregator.BucketBuilderForFixedCount<B>, BucketsAggregator.BucketBuilderForVariable<B>, BucketsAggregator.ResultBuilderForVariable<B>, BucketsAggregator.SingleBucketResultBuilderNested classes/interfaces inherited from class org.elasticsearch.search.aggregations.Aggregator
Aggregator.BucketComparator, Aggregator.Parser, Aggregator.SubAggCollectionMode - 
Field Summary
Fields inherited from class org.elasticsearch.search.aggregations.bucket.BucketsAggregator
docCountProviderFields inherited from class org.elasticsearch.search.aggregations.AggregatorBase
collectableSubAggregators, DEFAULT_WEIGHT, name, parent, subAggregatorsFields inherited from class org.elasticsearch.search.aggregations.BucketCollector
NO_OP_BUCKET_COLLECTOR, NO_OP_COLLECTOR - 
Method Summary
Modifier and TypeMethodDescriptionbuildAggregations(long[] owningBucketOrds) Build the results of this aggregation.Build an empty aggregation.protected LeafBucketCollectorThis is an optimized leaf collector that iterates the documents provided theRandomSamplingQuerydirectly.Methods inherited from class org.elasticsearch.search.aggregations.bucket.BucketsAggregator
bucketComparator, bucketDocCount, buildAggregationsForFixedBucketCount, buildAggregationsForSingleBucket, buildAggregationsForVariableBuckets, buildSubAggsForAllBuckets, buildSubAggsForBuckets, buildSubAggsForBuckets, close, collectBucket, collectExistingBucket, descendsFromGlobalAggregator, getDocCounts, grow, incrementBucketDocCount, maxBucketOrd, preGetSubLeafCollectors, prepareSubAggs, resolveSortPath, rewriteBucketsMethods inherited from class org.elasticsearch.search.aggregations.AggregatorBase
addRequestCircuitBreakerBytes, bigArrays, buildEmptySubAggregations, doClose, doPostCollection, doPreCollection, getLeafCollector, metadata, name, parent, pointReaderIfAvailable, postCollection, preCollection, scoreMode, searcher, subAggregator, subAggregators, topLevelQuery, toStringMethods inherited from class org.elasticsearch.search.aggregations.Aggregator
buildTopLevel, collectDebugInfo, resolveSortPathOnValidAggMethods inherited from class org.elasticsearch.search.aggregations.BucketCollector
asCollector 
- 
Method Details
- 
buildAggregations
Description copied from class:AggregatorBuild the results of this aggregation.- Specified by:
 buildAggregationsin classAggregator- Parameters:
 owningBucketOrds- the ordinals of the buckets that we want to collect from this aggregation- Returns:
 - the results for each ordinal, in the same order as the array of ordinals
 - Throws:
 IOException
 - 
buildEmptyAggregation
Description copied from class:AggregatorBuild an empty aggregation.- Specified by:
 buildEmptyAggregationin classAggregator
 - 
getLeafCollector
protected LeafBucketCollector getLeafCollector(AggregationExecutionContext aggCtx, LeafBucketCollector sub) throws IOException This is an optimized leaf collector that iterates the documents provided theRandomSamplingQuerydirectly. Instead of sampling in the foreground (i.e. iterating the documents as they are matched by theAggregatorBase.topLevelQuery()), iterating the document set returned byRandomSamplingQuerydirectly allows this aggregation to sample documents in the background. This provides a dramatic speed improvement, especially when a non-trivialAggregatorBase.topLevelQuery()is provided.- Specified by:
 getLeafCollectorin classAggregatorBase- Parameters:
 aggCtx- aggregation contextsub- collector- Returns:
 - returns 
LeafBucketCollector.NO_OP_COLLECTORif sampling was done. Otherwise, it is a simple pass through collector - Throws:
 IOException- when building the query or extracting docs fails
 
 -