Search in sources :

Example 1 with ProfilingAggregator

use of org.elasticsearch.search.profile.aggregation.ProfilingAggregator in project elasticsearch by elastic.

the class AggregatorFactories method createSubAggregators.

/**
     * Create all aggregators so that they can be consumed with multiple
     * buckets.
     */
public Aggregator[] createSubAggregators(Aggregator parent) throws IOException {
    Aggregator[] aggregators = new Aggregator[countAggregators()];
    for (int i = 0; i < factories.length; ++i) {
        // TODO: sometimes even sub aggregations always get called with bucket 0, eg. if
        // you have a terms agg under a top-level filter agg. We should have a way to
        // propagate the fact that only bucket 0 will be collected with single-bucket
        // aggs
        final boolean collectsFromSingleBucket = false;
        Aggregator factory = factories[i].create(parent, collectsFromSingleBucket);
        Profilers profilers = factory.context().getProfilers();
        if (profilers != null) {
            factory = new ProfilingAggregator(factory, profilers.getAggregationProfiler());
        }
        aggregators[i] = factory;
    }
    return aggregators;
}
Also used : ProfilingAggregator(org.elasticsearch.search.profile.aggregation.ProfilingAggregator) PipelineAggregator(org.elasticsearch.search.aggregations.pipeline.PipelineAggregator) Profilers(org.elasticsearch.search.profile.Profilers) ProfilingAggregator(org.elasticsearch.search.profile.aggregation.ProfilingAggregator)

Example 2 with ProfilingAggregator

use of org.elasticsearch.search.profile.aggregation.ProfilingAggregator in project elasticsearch by elastic.

the class AggregatorFactories method createTopLevelAggregators.

public Aggregator[] createTopLevelAggregators() throws IOException {
    // These aggregators are going to be used with a single bucket ordinal, no need to wrap the PER_BUCKET ones
    Aggregator[] aggregators = new Aggregator[factories.length];
    for (int i = 0; i < factories.length; i++) {
        // top-level aggs only get called with bucket 0
        final boolean collectsFromSingleBucket = true;
        Aggregator factory = factories[i].create(null, collectsFromSingleBucket);
        Profilers profilers = factory.context().getProfilers();
        if (profilers != null) {
            factory = new ProfilingAggregator(factory, profilers.getAggregationProfiler());
        }
        aggregators[i] = factory;
    }
    return aggregators;
}
Also used : ProfilingAggregator(org.elasticsearch.search.profile.aggregation.ProfilingAggregator) PipelineAggregator(org.elasticsearch.search.aggregations.pipeline.PipelineAggregator) Profilers(org.elasticsearch.search.profile.Profilers) ProfilingAggregator(org.elasticsearch.search.profile.aggregation.ProfilingAggregator)

Aggregations

PipelineAggregator (org.elasticsearch.search.aggregations.pipeline.PipelineAggregator)2 Profilers (org.elasticsearch.search.profile.Profilers)2 ProfilingAggregator (org.elasticsearch.search.profile.aggregation.ProfilingAggregator)2