public Aggregator resolveAggregator(Aggregator root){
  Aggregator aggregator=root;
  for (int i=0; i < pathElements.size(); i++) {
    AggregationPath.PathElement token=pathElements.get(i);
    aggregator=aggregator.subAggregator(token.name);
    assert (aggregator instanceof SingleBucketAggregator && i <= pathElements.size() - 1) || (aggregator instanceof NumericMetricsAggregator && i == pathElements.size() - 1) : "this should be picked up before aggregation execution - on validate";
  }
  return aggregator;
}

public Aggregator resolveAggregator ( Aggregator root ) { Aggregator aggregator = root ; for ( int i = 0 ; i < pathElements . size ( ) ; i ++ ) { AggregationPath . PathElement token = pathElements . get ( i ) ; aggregator = aggregator . subAggregator ( token . name ) ; assert ( aggregator instanceof SingleBucketAggregator && i <= pathElements . size ( ) - 1 ) || ( aggregator instanceof NumericMetricsAggregator && i == pathElements . size ( ) - 1 ) : "this should be picked up before aggregation execution - on validate" ; } return aggregator ; }
resolves the aggregator pointed by this path using the given root as a point of reference .
