本文整理汇总了Java中org.elasticsearch.search.aggregations.pipeline.PipelineAggregator类的典型用法代码示例。如果您正苦于以下问题:Java PipelineAggregator类的具体用法?Java PipelineAggregator怎么用?Java PipelineAggregator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PipelineAggregator类属于org.elasticsearch.search.aggregations.pipeline包,在下文中一共展示了PipelineAggregator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createInternal
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; //导入依赖的package包/类
@Override
public Aggregator createInternal(Aggregator parent, boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metaData) throws IOException {
HashMap<String, VS> valuesSources = new HashMap<>();
for (Map.Entry<String, ValuesSourceConfig<VS>> config : configs.entrySet()) {
VS vs = config.getValue().toValuesSource(context.getQueryShardContext());
if (vs != null) {
valuesSources.put(config.getKey(), vs);
}
}
if (valuesSources.isEmpty()) {
return createUnmapped(parent, pipelineAggregators, metaData);
}
return doCreateInternal(valuesSources, parent, collectsFromSingleBucket, pipelineAggregators, metaData);
}
示例2: HistogramAggregator
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; //导入依赖的package包/类
public HistogramAggregator(String name, AggregatorFactories factories, Rounding rounding, InternalOrder order, boolean keyed,
long minDocCount, @Nullable ExtendedBounds extendedBounds, @Nullable ValuesSource.Numeric valuesSource,
ValueFormatter formatter, InternalHistogram.Factory<?> histogramFactory, AggregationContext aggregationContext,
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException {
super(name, factories, aggregationContext, parent, pipelineAggregators, metaData);
this.rounding = rounding;
this.order = order;
this.keyed = keyed;
this.minDocCount = minDocCount;
this.extendedBounds = extendedBounds;
this.valuesSource = valuesSource;
this.formatter = formatter;
this.histogramFactory = histogramFactory;
bucketOrds = new LongHash(1, aggregationContext.bigArrays());
}
示例3: ScriptedMetricAggregator
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; //导入依赖的package包/类
protected ScriptedMetricAggregator(String name, Script initScript, Script mapScript, Script combineScript, Script reduceScript,
Map<String, Object> params, AggregationContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData)
throws IOException {
super(name, context, parent, pipelineAggregators, metaData);
this.params = params;
ScriptService scriptService = context.searchContext().scriptService();
if (initScript != null) {
scriptService.executable(initScript, ScriptContext.Standard.AGGS, context.searchContext(), Collections.<String, String>emptyMap()).run();
}
this.mapScript = scriptService.search(context.searchContext().lookup(), mapScript, ScriptContext.Standard.AGGS, Collections.<String, String>emptyMap());
if (combineScript != null) {
this.combineScript = scriptService.executable(combineScript, ScriptContext.Standard.AGGS, context.searchContext(), Collections.<String, String>emptyMap());
} else {
this.combineScript = null;
}
this.reduceScript = reduceScript;
}
示例4: createInternal
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; //导入依赖的package包/类
@Override
protected PipelineAggregator createInternal(Map<String, Object> metaData) throws IOException {
DocValueFormat formatter;
if (format != null) {
formatter = new DocValueFormat.Decimal(format);
} else {
formatter = DocValueFormat.RAW;
}
Long xAxisUnits = null;
if (units != null) {
DateTimeUnit dateTimeUnit = DateHistogramAggregationBuilder.DATE_FIELD_UNITS.get(units);
if (dateTimeUnit != null) {
xAxisUnits = dateTimeUnit.field(DateTimeZone.UTC).getDurationField().getUnitMillis();
} else {
TimeValue timeValue = TimeValue.parseTimeValue(units, null, getClass().getSimpleName() + ".unit");
if (timeValue != null) {
xAxisUnits = timeValue.getMillis();
}
}
}
return new DerivativePipelineAggregator(name, bucketsPaths, formatter, gapPolicy, xAxisUnits, metaData);
}
示例5: createTestInstance
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; //导入依赖的package包/类
@Override
protected InternalHistogram createTestInstance(String name, List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metaData) {
final boolean keyed = randomBoolean();
final DocValueFormat format = DocValueFormat.RAW;
final int base = randomInt(50) - 30;
final int numBuckets = randomInt(10);
final int interval = randomIntBetween(1, 3);
List<InternalHistogram.Bucket> buckets = new ArrayList<>();
for (int i = 0; i < numBuckets; ++i) {
final int docCount = TestUtil.nextInt(random(), 1, 50);
buckets.add(new InternalHistogram.Bucket(base + i * interval, docCount, keyed, format, InternalAggregations.EMPTY));
}
return new InternalHistogram(name, buckets, (InternalOrder) InternalHistogram.Order.KEY_ASC,
1, null, format, keyed, pipelineAggregators, metaData);
}
示例6: reduce
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; //导入依赖的package包/类
@Override
public InternalAggregation reduce(InternalAggregation aggregation, ReduceContext reduceContext) {
InternalHistogram histo = (InternalHistogram) aggregation;
List<? extends InternalHistogram.Bucket> buckets = histo.getBuckets();
InternalHistogram.Factory<? extends InternalHistogram.Bucket> factory = histo.getFactory();
List newBuckets = new ArrayList<>();
double sum = 0;
for (InternalHistogram.Bucket bucket : buckets) {
Double thisBucketValue = resolveBucketValue(histo, bucket, bucketsPaths()[0], GapPolicy.INSERT_ZEROS);
sum += thisBucketValue;
List<InternalAggregation> aggs = new ArrayList<>(eagerTransform(bucket.getAggregations().asList(),
AGGREGATION_TRANFORM_FUNCTION));
aggs.add(new InternalSimpleValue(name(), sum, formatter, new ArrayList<PipelineAggregator>(), metaData()));
InternalHistogram.Bucket newBucket = factory.createBucket(bucket.getKey(), bucket.getDocCount(),
new InternalAggregations(aggs), bucket.getKeyed(), bucket.getFormatter());
newBuckets.add(newBucket);
}
return factory.create(newBuckets, histo);
}
示例7: FiltersAggregator
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; //导入依赖的package包/类
public FiltersAggregator(String name, AggregatorFactories factories, String[] keys, Weight[] filters, boolean keyed, String otherBucketKey,
AggregationContext aggregationContext,
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData)
throws IOException {
super(name, factories, aggregationContext, parent, pipelineAggregators, metaData);
this.keyed = keyed;
this.keys = keys;
this.filters = filters;
this.showOtherBucket = otherBucketKey != null;
this.otherBucketKey = otherBucketKey;
if (showOtherBucket) {
this.totalNumKeys = keys.length + 1;
} else {
this.totalNumKeys = keys.length;
}
}
示例8: createInternal
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; //导入依赖的package包/类
@Override
public Aggregator createInternal(AggregationContext context, Aggregator parent, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException {
if (collectsFromSingleBucket == false) {
return asMultiBucketAggregator(this, context, parent);
}
Map<String, Object> params = this.params;
if (params != null) {
params = deepCopyParams(params, context.searchContext());
} else {
params = new HashMap<>();
params.put("_agg", new HashMap<String, Object>());
}
return new ScriptedMetricAggregator(name, insertParams(initScript, params), insertParams(mapScript, params), insertParams(
combineScript, params), deepCopyScript(reduceScript, context.searchContext()), params, context, parent, pipelineAggregators,
metaData);
}
示例9: InternalMatrixStats
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; //导入依赖的package包/类
/** per shard ctor */
protected InternalMatrixStats(String name, long count, RunningStats multiFieldStatsResults, MatrixStatsResults results,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) {
super(name, pipelineAggregators, metaData);
assert count >= 0;
this.stats = multiFieldStatsResults;
this.results = results;
}
示例10: GlobalOrdinalsStringTermsAggregator
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; //导入依赖的package包/类
public GlobalOrdinalsStringTermsAggregator(String name, AggregatorFactories factories, ValuesSource.Bytes.WithOrdinals valuesSource,
Terms.Order order, BucketCountThresholds bucketCountThresholds,
IncludeExclude.OrdinalsFilter includeExclude,
AggregationContext aggregationContext, Aggregator parent, SubAggCollectionMode collectionMode, boolean showTermDocCountError,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException {
super(name, factories, aggregationContext, parent, order, bucketCountThresholds, collectionMode, showTermDocCountError,
pipelineAggregators,
metaData);
this.valuesSource = valuesSource;
this.includeExclude = includeExclude;
}
示例11: ScriptedMetricAggregator
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; //导入依赖的package包/类
protected ScriptedMetricAggregator(String name, SearchScript mapScript, ExecutableScript combineScript,
Script reduceScript,
Map<String, Object> params, SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData)
throws IOException {
super(name, context, parent, pipelineAggregators, metaData);
this.params = params;
this.mapScript = mapScript;
this.combineScript = combineScript;
this.reduceScript = reduceScript;
}
示例12: create
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; //导入依赖的package包/类
@Override
Aggregator create(String name, AggregatorFactories factories, ValuesSource valuesSource, Terms.Order order,
DocValueFormat format, TermsAggregator.BucketCountThresholds bucketCountThresholds, IncludeExclude includeExclude,
SearchContext context, Aggregator parent, SubAggCollectionMode subAggCollectMode,
boolean showTermDocCountError, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData)
throws IOException {
final IncludeExclude.OrdinalsFilter filter = includeExclude == null ? null : includeExclude.convertToOrdinalsFilter(format);
return new GlobalOrdinalsStringTermsAggregator.WithHash(name, factories, (ValuesSource.Bytes.WithOrdinals) valuesSource,
order, format, bucketCountThresholds, filter, context, parent, subAggCollectMode, showTermDocCountError,
pipelineAggregators, metaData);
}
示例13: create
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; //导入依赖的package包/类
@Override
Aggregator create(String name, AggregatorFactories factories, ValuesSource valuesSource, Terms.Order order,
TermsAggregator.BucketCountThresholds bucketCountThresholds, IncludeExclude includeExclude,
AggregationContext aggregationContext, Aggregator parent, SubAggCollectionMode subAggCollectMode,
boolean showTermDocCountError, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData)
throws IOException {
final IncludeExclude.StringFilter filter = includeExclude == null ? null : includeExclude.convertToStringFilter();
return new StringTermsAggregator(name, factories, valuesSource, order, bucketCountThresholds, filter, aggregationContext,
parent, subAggCollectMode, showTermDocCountError, pipelineAggregators, metaData);
}
示例14: LongTerms
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; //导入依赖的package包/类
public LongTerms(String name, Terms.Order order, ValueFormatter formatter, int requiredSize, int shardSize, long minDocCount,
List<? extends InternalTerms.Bucket> buckets, boolean showTermDocCountError, long docCountError, long otherDocCount,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) {
super(name, order, requiredSize, shardSize, minDocCount, buckets, showTermDocCountError, docCountError, otherDocCount, pipelineAggregators,
metaData);
this.formatter = formatter;
}
示例15: InternalGeoBounds
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; //导入依赖的package包/类
InternalGeoBounds(String name, double top, double bottom, double posLeft, double posRight,
double negLeft, double negRight, boolean wrapLongitude,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) {
super(name, pipelineAggregators, metaData);
this.top = top;
this.bottom = bottom;
this.posLeft = posLeft;
this.posRight = posRight;
this.negLeft = negLeft;
this.negRight = negRight;
this.wrapLongitude = wrapLongitude;
}