-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get-templates APIs don't support lists (#78989)
We document that `GET /_index_template/...` accepts a comma-separated list of template names but in fact today this API accepts only a single name or pattern. Likewise `GET /_cat/templates/...` (at least it didn't until #78829 but that's not released yet). This commit fixes the docs to indicate these APIs accept only a single template name and also adds some extra validation to reject requests containing a `,` since such a request cannot match any actual templates. It also adjusts `GET /_cat/templates` to use the filtering built into `TransportGetComposableIndexTemplateAction` rather than retrieving all templates and then filtering them on the coordinating node.
- Loading branch information
1 parent
6d2a899
commit d2bb6eb
Showing
9 changed files
with
118 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 31 additions & 5 deletions
36
...c/yamlRestTest/resources/rest-api-spec/test/indices.get_index_template/20_get_missing.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,46 @@ | ||
setup: | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: "index template v2 API has not been backported" | ||
version: " - 7.7.99" | ||
reason: "index template v2 API unavailable before 7.8" | ||
|
||
- do: | ||
indices.delete_index_template: | ||
name: '*' | ||
ignore: 404 | ||
|
||
--- | ||
"Get missing template": | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: "index template v2 API has not been backported" | ||
version: " - 7.7.99" | ||
reason: "index template v2 API unavailable before 7.8" | ||
|
||
- do: | ||
catch: missing | ||
indices.get_index_template: | ||
name: test | ||
name: nonexistent | ||
|
||
- match: { error.reason: "index template matching [nonexistent] not found" } | ||
|
||
--- | ||
"Get non-matching wildcard": | ||
- skip: | ||
version: " - 7.7.99" | ||
reason: "index template v2 API unavailable before 7.8" | ||
|
||
- do: | ||
catch: missing | ||
indices.get_index_template: | ||
name: "non-matching-wildcard*" | ||
|
||
- is_false: error | ||
- is_true: index_templates | ||
|
||
--- | ||
"Reject request containing comma": | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: "validation only added in 8.0.0" | ||
- do: | ||
catch: bad_request | ||
indices.get_index_template: | ||
name: test1,test2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.