소스 검색

Allow leading `/` in AUTOSENSE path

Relates to #18160
Nik Everett 9 년 전
부모
커밋
cb40b986d1

+ 2 - 4
buildSrc/src/main/groovy/org/elasticsearch/gradle/RestTestsFromSnippetsTask.groovy

@@ -176,10 +176,8 @@ public class RestTestsFromSnippetsTask extends SnippetsTask {
                 String body = matcher.group("body")
                 String catchPart = last ? snippet.catchPart : null
                 if (pathAndQuery.startsWith('/')) {
-                    // Why not do some light linting while we're here?
-                    throw new InvalidUserDataException(
-                        "Path shouldn't start with a '/': $snippet\n"
-                        + snippet.contents)
+                    // Leading '/'s break the generated paths
+                    pathAndQuery = pathAndQuery.substring(1)
                 }
                 emitDo(method, pathAndQuery, body, catchPart)
             }

+ 1 - 1
docs/reference/mapping/params/analyzer.asciidoc

@@ -41,7 +41,7 @@ in the field mapping, as follows:
 
 [source,js]
 --------------------------------------------------
-PUT my_index
+PUT /my_index
 {
   "mappings": {
     "my_type": {