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/main/java/org/elasticsearch/search/aggregations/support/AggregationPath.java
}
                    tokens.add(
                        new PathElement(
                            element,
                            element.substring(0, keyIndex),
                            element.substring(keyIndex + 1, endKeyIndex),
                            
                            metricIndex < endKeyIndex ? null : element.substring(metricIndex + 1)
                        )
                    );
                    continue;
                }
                if (metricIndex < 0) {
                    tokens.add(new PathElement(element, element, null, null));
                    continue;
                }
                if (metricIndex == 0 || metricIndex > element.length() - 2) {
                    throw new AggregationExecutionException("Invalid path element [" + element + "] in path [" + path + "]");
                }
                tuple = split(element, metricIndex, tuple);
                tokens.add(new PathElement(element, tuple[0], null, tuple[1]));
            } else {
                int keyIndex = element.lastIndexOf('[');
                if (keyIndex >= 0) {
                    if (keyIndex == 0 || keyIndex > element.length() - 3) {
                        throw new AggregationExecutionException("Invalid path element [" + element + "] in path [" + path + "]");
                    }
                    if (element.charAt(element.length() - 1) != ']') {
                        throw new AggregationExecutionException("Invalid path element [" + element + "] in path [" + path + "]");
                    }