*/
public Aggregator resolveAggregator(Aggregator root) {
Aggregator aggregator = root;
for (int i = 0; i < tokens.length; i++) {
OrderPath.Token token = tokens[i];
aggregator = aggregator.subAggregator(token.name);
assert (aggregator instanceof SingleBucketAggregator && i <= tokens.length - 1) ||
(aggregator instanceof NumericMetricsAggregator && i == tokens.length - 1) :
"this should be picked up before aggregation execution - on validate";
}
return aggregator;