Search in sources :

Example 1 with SingleBucketAggregator

use of org.opensearch.search.aggregations.bucket.SingleBucketAggregator in project OpenSearch by opensearch-project.

the class AggregationPath method resolveTopmostAggregator.

/**
 * Resolves the {@linkplain Aggregator} pointed to by the first element
 * of this path against the given root {@linkplain Aggregator}.
 */
public Aggregator resolveTopmostAggregator(Aggregator root) {
    AggregationPath.PathElement token = pathElements.get(0);
    // TODO both unwrap and subAggregator are only used here!
    Aggregator aggregator = ProfilingAggregator.unwrap(root.subAggregator(token.name));
    assert (aggregator instanceof SingleBucketAggregator) || (aggregator instanceof NumericMetricsAggregator) : "this should be picked up before aggregation execution - on validate";
    return aggregator;
}
Also used : NumericMetricsAggregator(org.opensearch.search.aggregations.metrics.NumericMetricsAggregator) SingleBucketAggregator(org.opensearch.search.aggregations.bucket.SingleBucketAggregator) NumericMetricsAggregator(org.opensearch.search.aggregations.metrics.NumericMetricsAggregator) ProfilingAggregator(org.opensearch.search.profile.aggregation.ProfilingAggregator) Aggregator(org.opensearch.search.aggregations.Aggregator) SingleBucketAggregator(org.opensearch.search.aggregations.bucket.SingleBucketAggregator)

Aggregations

Aggregator (org.opensearch.search.aggregations.Aggregator)1 SingleBucketAggregator (org.opensearch.search.aggregations.bucket.SingleBucketAggregator)1 NumericMetricsAggregator (org.opensearch.search.aggregations.metrics.NumericMetricsAggregator)1 ProfilingAggregator (org.opensearch.search.profile.aggregation.ProfilingAggregator)1