When parsing `AggregationPath` strings, if we hit an error, we throw `AggregationExecutionException`, which is a 500 class error.  But 500 class errors usually mean that retrying the request might improve the situation, where in this case we want to indicate that the user should not retry with the same request (they need to fix the path expression).  
server/src/test/java/org/elasticsearch/search/aggregations/support/AggregationPathTests.java
assertThat(t1, equalTo(t2));
        }
    }
    private static Tokens tokens() {
        return new Tokens();
    }
    private static class Tokens {
        private final List<AggregationPath.PathElement> tokens = new ArrayList<>();
        Tokens add(String name) {
            tokens.add(new AggregationPath.PathElement(name, name, null, null));
            return this;
        }
        Tokens addKey(String name, String key) {
            tokens.add(new AggregationPath.PathElement(name + "[" + key + "]", name, key, null));
            return this;
        }
        Tokens addMetric(String name, String metric) {
            tokens.add(new AggregationPath.PathElement(name + "." + metric, name, null, metric));
            return this;
        }
        Tokens addKeyAndMetric(String name, String key, String metric) {
            tokens.add(new AggregationPath.PathElement(name + "[" + key + "]." + metric, name, key, metric));
            return this;
        }
        AggregationPath.PathElement[] toArray() {
            return tokens.toArray(new AggregationPath.PathElement[0]);
        }
    }
}