public class ScriptedMetricAggregator extends MetricsAggregator
Modifier and Type | Class and Description |
---|---|
static class |
ScriptedMetricAggregator.Factory |
Aggregator.BucketAggregationMode, Aggregator.Parser, Aggregator.SubAggCollectionMode
BucketCollector.BucketAnalysisCollector
bigArrays, bucketAggregationMode, COLLECT_MODE, collectableSubAggregators, context, depth, estimatedBucketCount, factories, name, parent, subAggregators
NO_OP_COLLECTOR
Modifier | Constructor and Description |
---|---|
protected |
ScriptedMetricAggregator(String name,
String scriptLang,
ScriptService.ScriptType initScriptType,
String initScript,
ScriptService.ScriptType mapScriptType,
String mapScript,
ScriptService.ScriptType combineScriptType,
String combineScript,
ScriptService.ScriptType reduceScriptType,
String reduceScript,
Map<String,Object> params,
Map<String,Object> reduceParams,
AggregationContext context,
Aggregator parent) |
Modifier and Type | Method and Description |
---|---|
InternalAggregation |
buildAggregation(long owningBucketOrdinal) |
InternalAggregation |
buildEmptyAggregation() |
void |
collect(int docId,
long bucketOrdinal)
Called during the query phase, to collect & aggregate the given document.
|
void |
setNextReader(org.apache.lucene.index.AtomicReaderContext reader) |
boolean |
shouldCollect() |
bucketAggregationMode, buildEmptySubAggregations, close, context, depth, doClose, doPostCollection, estimatedBucketCount, gatherAnalysis, hasParentBucketAggregator, name, parent, postCollection, preCollection, runDeferredCollections, shouldDefer, subAggregator, subAggregators
wrap
protected ScriptedMetricAggregator(String name, String scriptLang, ScriptService.ScriptType initScriptType, String initScript, ScriptService.ScriptType mapScriptType, String mapScript, ScriptService.ScriptType combineScriptType, String combineScript, ScriptService.ScriptType reduceScriptType, String reduceScript, Map<String,Object> params, Map<String,Object> reduceParams, AggregationContext context, Aggregator parent)
public boolean shouldCollect()
shouldCollect
in class Aggregator
public void setNextReader(org.apache.lucene.index.AtomicReaderContext reader)
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 InternalAggregation buildAggregation(long owningBucketOrdinal)
buildAggregation
in class Aggregator
public InternalAggregation buildEmptyAggregation()
buildEmptyAggregation
in class Aggregator
Copyright © 2009–2015. All rights reserved.