当前位置: 首页>>代码示例>>Java>>正文


Java Aggregator类代码示例

本文整理汇总了Java中org.elasticsearch.search.aggregations.Aggregator的典型用法代码示例。如果您正苦于以下问题:Java Aggregator类的具体用法?Java Aggregator怎么用?Java Aggregator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Aggregator类属于org.elasticsearch.search.aggregations包,在下文中一共展示了Aggregator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GeoBoundsAggregator

import org.elasticsearch.search.aggregations.Aggregator; //导入依赖的package包/类
protected GeoBoundsAggregator(String name, SearchContext aggregationContext, Aggregator parent,
        ValuesSource.GeoPoint valuesSource, boolean wrapLongitude, List<PipelineAggregator> pipelineAggregators,
        Map<String, Object> metaData) throws IOException {
    super(name, aggregationContext, parent, pipelineAggregators, metaData);
    this.valuesSource = valuesSource;
    this.wrapLongitude = wrapLongitude;
    if (valuesSource != null) {
        final BigArrays bigArrays = context.bigArrays();
        tops = bigArrays.newDoubleArray(1, false);
        tops.fill(0, tops.size(), Double.NEGATIVE_INFINITY);
        bottoms = bigArrays.newDoubleArray(1, false);
        bottoms.fill(0, bottoms.size(), Double.POSITIVE_INFINITY);
        posLefts = bigArrays.newDoubleArray(1, false);
        posLefts.fill(0, posLefts.size(), Double.POSITIVE_INFINITY);
        posRights = bigArrays.newDoubleArray(1, false);
        posRights.fill(0, posRights.size(), Double.NEGATIVE_INFINITY);
        negLefts = bigArrays.newDoubleArray(1, false);
        negLefts.fill(0, negLefts.size(), Double.POSITIVE_INFINITY);
        negRights = bigArrays.newDoubleArray(1, false);
        negRights.fill(0, negRights.size(), Double.NEGATIVE_INFINITY);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:GeoBoundsAggregator.java

示例2: StatsAggregator

import org.elasticsearch.search.aggregations.Aggregator; //导入依赖的package包/类
public StatsAggregator(String name, ValuesSource.Numeric valuesSource, ValueFormatter formatter,
                       AggregationContext context,
                       Aggregator parent, List<PipelineAggregator> pipelineAggregators,
                       Map<String, Object> metaData) throws IOException {
    super(name, context, parent, pipelineAggregators, metaData);
    this.valuesSource = valuesSource;
    if (valuesSource != null) {
        final BigArrays bigArrays = context.bigArrays();
        counts = bigArrays.newLongArray(1, true);
        sums = bigArrays.newDoubleArray(1, true);
        mins = bigArrays.newDoubleArray(1, false);
        mins.fill(0, mins.size(), Double.POSITIVE_INFINITY);
        maxes = bigArrays.newDoubleArray(1, false);
        maxes.fill(0, maxes.size(), Double.NEGATIVE_INFINITY);
    }
    this.formatter = formatter;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:18,代码来源:StatsAggregator.java

示例3: doCreateInternal

import org.elasticsearch.search.aggregations.Aggregator; //导入依赖的package包/类
@Override
protected Aggregator doCreateInternal(ValuesSource.Numeric valuesSource, AggregationContext aggregationContext, Aggregator parent,
        boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException {
    if (collectsFromSingleBucket == false) {
        return asMultiBucketAggregator(this, aggregationContext, parent);
    }
    // we need to round the bounds given by the user and we have to do it for every aggregator we crate
    // as the rounding is not necessarily an idempotent operation.
    // todo we need to think of a better structure to the factory/agtor code so we won't need to do that
    ExtendedBounds roundedBounds = null;
    if (extendedBounds != null) {
        // we need to process & validate here using the parser
        extendedBounds.processAndValidate(name, aggregationContext.searchContext(), config.parser());
        roundedBounds = extendedBounds.round(rounding);
    }
    return new HistogramAggregator(name, factories, rounding, order, keyed, minDocCount, roundedBounds, valuesSource,
            config.formatter(), histogramFactory, aggregationContext, parent, pipelineAggregators, metaData);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:19,代码来源:HistogramAggregator.java

示例4: ExtendedStatsAggregator

import org.elasticsearch.search.aggregations.Aggregator; //导入依赖的package包/类
public ExtendedStatsAggregator(String name, ValuesSource.Numeric valuesSource, ValueFormatter formatter,
        AggregationContext context, Aggregator parent, double sigma, List<PipelineAggregator> pipelineAggregators,
        Map<String, Object> metaData)
        throws IOException {
    super(name, context, parent, pipelineAggregators, metaData);
    this.valuesSource = valuesSource;
    this.formatter = formatter;
    this.sigma = sigma;
    if (valuesSource != null) {
        final BigArrays bigArrays = context.bigArrays();
        counts = bigArrays.newLongArray(1, true);
        sums = bigArrays.newDoubleArray(1, true);
        mins = bigArrays.newDoubleArray(1, false);
        mins.fill(0, mins.size(), Double.POSITIVE_INFINITY);
        maxes = bigArrays.newDoubleArray(1, false);
        maxes.fill(0, maxes.size(), Double.NEGATIVE_INFINITY);
        sumOfSqrs = bigArrays.newDoubleArray(1, true);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:20,代码来源:ExtendedStatsAggregator.java

示例5: RangeAggregator

import org.elasticsearch.search.aggregations.Aggregator; //导入依赖的package包/类
public RangeAggregator(String name, AggregatorFactories factories, ValuesSource.Numeric valuesSource, ValueFormat format,
        InternalRange.Factory rangeFactory, List<Range> ranges, boolean keyed, AggregationContext aggregationContext,
        Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException {

    super(name, factories, aggregationContext, parent, pipelineAggregators, metaData);
    assert valuesSource != null;
    this.valuesSource = valuesSource;
    this.formatter = format.formatter();
    this.keyed = keyed;
    this.rangeFactory = rangeFactory;
    this.ranges = ranges.toArray(new Range[ranges.size()]);

    ValueParser parser = format != null ? format.parser() : ValueParser.RAW;
    for (int i = 0; i < this.ranges.length; i++) {
        this.ranges[i].process(parser, context.searchContext());
    }
    sortRanges(this.ranges);

    maxTo = new double[this.ranges.length];
    maxTo[0] = this.ranges[0].to;
    for (int i = 1; i < this.ranges.length; ++i) {
        maxTo[i] = Math.max(this.ranges[i].to,maxTo[i-1]);
    }

}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:26,代码来源:RangeAggregator.java

示例6: testSubAggCollectMode

import org.elasticsearch.search.aggregations.Aggregator; //导入依赖的package包/类
public void testSubAggCollectMode() throws Exception {
    assertThat(TermsAggregatorFactory.subAggCollectionMode(Integer.MAX_VALUE, -1),
        equalTo(Aggregator.SubAggCollectionMode.DEPTH_FIRST));
    assertThat(TermsAggregatorFactory.subAggCollectionMode(10, -1),
        equalTo(Aggregator.SubAggCollectionMode.BREADTH_FIRST));
    assertThat(TermsAggregatorFactory.subAggCollectionMode(10, 5),
        equalTo(Aggregator.SubAggCollectionMode.DEPTH_FIRST));
    assertThat(TermsAggregatorFactory.subAggCollectionMode(10, 10),
        equalTo(Aggregator.SubAggCollectionMode.DEPTH_FIRST));
    assertThat(TermsAggregatorFactory.subAggCollectionMode(10, 100),
        equalTo(Aggregator.SubAggCollectionMode.BREADTH_FIRST));
    assertThat(TermsAggregatorFactory.subAggCollectionMode(1, 2),
        equalTo(Aggregator.SubAggCollectionMode.BREADTH_FIRST));
    assertThat(TermsAggregatorFactory.subAggCollectionMode(1, 100),
        equalTo(Aggregator.SubAggCollectionMode.BREADTH_FIRST));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:TermsAggregatorFactoryTests.java

示例7: MaxAggregator

import org.elasticsearch.search.aggregations.Aggregator; //导入依赖的package包/类
public MaxAggregator(String name, ValuesSource.Numeric valuesSource, ValueFormatter formatter,
AggregationContext context,
           Aggregator parent, List<PipelineAggregator> pipelineAggregators,
           Map<String, Object> metaData) throws IOException {
       super(name, context, parent, pipelineAggregators, metaData);
       this.valuesSource = valuesSource;
       this.formatter = formatter;
       if (valuesSource != null) {
           maxes = context.bigArrays().newDoubleArray(1, false);
           maxes.fill(0, maxes.size(), Double.NEGATIVE_INFINITY);
       }
   }
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:MaxAggregator.java

示例8: doCreateInternal

import org.elasticsearch.search.aggregations.Aggregator; //导入依赖的package包/类
@Override
protected Aggregator doCreateInternal(final ValuesSource.GeoPoint valuesSource, AggregationContext aggregationContext,
        Aggregator parent, boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData)
        throws IOException {
    if (collectsFromSingleBucket == false) {
        return asMultiBucketAggregator(this, aggregationContext, parent);
    }
    CellIdSource cellIdSource = new CellIdSource(valuesSource, precision);
    return new GeoHashGridAggregator(name, factories, cellIdSource, requiredSize, shardSize, aggregationContext, parent, pipelineAggregators,
            metaData);

}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:GeoHashGridParser.java

示例9: createInternal

import org.elasticsearch.search.aggregations.Aggregator; //导入依赖的package包/类
@Override
public Aggregator createInternal(AggregationContext context, Aggregator parent, boolean collectsFromSingleBucket,
        List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException {
    IndexSearcher contextSearcher = context.searchContext().searcher();
    if (searcher != contextSearcher) {
        searcher = contextSearcher;
        weights = new Weight[filters.size()];
        for (int i = 0; i < filters.size(); ++i) {
            KeyedFilter keyedFilter = filters.get(i);
            this.weights[i] = contextSearcher.createNormalizedWeight(keyedFilter.filter, false);
        }
    }
    return new FiltersAggregator(name, factories, keys, weights, keyed, otherBucketKey, context, parent, pipelineAggregators, metaData);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:FiltersAggregator.java

示例10: validate

import org.elasticsearch.search.aggregations.Aggregator; //导入依赖的package包/类
public static Terms.Order validate(Terms.Order order, Aggregator termsAggregator) {
    if (order instanceof CompoundOrder) {
        for (Terms.Order innerOrder : ((CompoundOrder)order).orderElements) {
            validate(innerOrder, termsAggregator);
        }
        return order;
    } else if (!(order instanceof Aggregation)) {
        return order;
    }
    AggregationPath path = ((Aggregation) order).path();
    path.validate(termsAggregator);
    return order;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:InternalOrder.java

示例11: StringTermsAggregator

import org.elasticsearch.search.aggregations.Aggregator; //导入依赖的package包/类
public StringTermsAggregator(String name, AggregatorFactories factories, ValuesSource valuesSource,
        Terms.Order order, BucketCountThresholds bucketCountThresholds,
        IncludeExclude.StringFilter 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;
    bucketOrds = new BytesRefHash(1, aggregationContext.bigArrays());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:StringTermsAggregator.java

示例12: createInternal

import org.elasticsearch.search.aggregations.Aggregator; //导入依赖的package包/类
@Override
public Aggregator createInternal(Aggregator parent, boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators,
        Map<String, Object> metaData) throws IOException {
    SubSearchContext subSearchContext = new SubSearchContext(context);
    subSearchContext.parsedQuery(context.parsedQuery());
    subSearchContext.explain(explain);
    subSearchContext.version(version);
    subSearchContext.trackScores(trackScores);
    subSearchContext.from(from);
    subSearchContext.size(size);
    if (sort.isPresent()) {
        subSearchContext.sort(sort.get());
    }
    if (storedFieldsContext != null) {
        subSearchContext.storedFieldsContext(storedFieldsContext);
    }
    if (docValueFields != null) {
        subSearchContext.docValueFieldsContext(new DocValueFieldsContext(docValueFields));
    }
    for (ScriptFieldsContext.ScriptField field : scriptFields) {
        subSearchContext.scriptFields().add(field);
        }
    if (fetchSourceContext != null) {
        subSearchContext.fetchSourceContext(fetchSourceContext);
    }
    if (highlightBuilder != null) {
        subSearchContext.highlight(highlightBuilder.build(context.getQueryShardContext()));
    }
    return new TopHitsAggregator(context.fetchPhase(), subSearchContext, name, context, parent,
            pipelineAggregators, metaData);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:32,代码来源:TopHitsAggregatorFactory.java

示例13: findClosestNestedPath

import org.elasticsearch.search.aggregations.Aggregator; //导入依赖的package包/类
private static Query findClosestNestedPath(Aggregator parent) {
    for (; parent != null; parent = parent.parent()) {
        if (parent instanceof NestedAggregator) {
            return ((NestedAggregator) parent).childFilter;
        } else if (parent instanceof ReverseNestedAggregator) {
            return ((ReverseNestedAggregator) parent).getParentFilter();
        }
    }
    return null;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:NestedAggregator.java

示例14: doCreateInternal

import org.elasticsearch.search.aggregations.Aggregator; //导入依赖的package包/类
@Override
protected Aggregator doCreateInternal(ValuesSource.Bytes.WithOrdinals.ParentChild valuesSource,
        AggregationContext aggregationContext, Aggregator parent, boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators,
        Map<String, Object> metaData) throws IOException {
    long maxOrd = valuesSource.globalMaxOrd(aggregationContext.searchContext().searcher(), parentType);
    return new ParentToChildrenAggregator(name, factories, aggregationContext, parent, parentType, childFilter, parentFilter,
            valuesSource, maxOrd, pipelineAggregators, metaData);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:ParentToChildrenAggregator.java

示例15: doCreateInternal

import org.elasticsearch.search.aggregations.Aggregator; //导入依赖的package包/类
@Override
protected Aggregator doCreateInternal(VS valuesSource, AggregationContext aggregationContext, Aggregator parent,
        boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData)
        throws IOException {
    return new ValueCountAggregator(name, valuesSource, config.formatter(), aggregationContext, parent, pipelineAggregators,
            metaData);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:ValueCountAggregator.java


注:本文中的org.elasticsearch.search.aggregations.Aggregator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。