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;
}
Aggregations