-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust /_cat/templates not to request all metadata #78812
Merged
DaveCTurner
merged 5 commits into
elastic:master
from
DaveCTurner:2021-10-07-cat-templates-without-cluster-state
Oct 7, 2021
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2029f47
Adjust /_cat/templates not to request all metadata
DaveCTurner e182ff2
Deal with extra templates created sometimes
DaveCTurner af780cd
bwc
DaveCTurner d5e2517
Merge branch 'master' into 2021-10-07-cat-templates-without-cluster-s…
DaveCTurner d71f295
Construct StepListeners later
DaveCTurner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
179 changes: 179 additions & 0 deletions
179
rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.templates/20_matching.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 |
---|---|---|
@@ -0,0 +1,179 @@ | ||
setup: | ||
- do: | ||
indices.put_template: | ||
name: test-legacy-1 | ||
body: | ||
order: 12 | ||
version: 3 | ||
index_patterns: foo* | ||
|
||
- do: | ||
indices.put_template: | ||
name: test-legacy-2 | ||
body: | ||
order: 45 | ||
version: 6 | ||
index_patterns: | ||
- bar* | ||
- baz* | ||
|
||
- do: | ||
cluster.put_component_template: | ||
name: test-component-template | ||
body: | ||
template: | ||
settings: | ||
number_of_shards: 1 | ||
number_of_replicas: 0 | ||
|
||
- do: | ||
indices.put_index_template: | ||
name: test-composable-1 | ||
body: | ||
index_patterns: | ||
- quux* | ||
priority: 78 | ||
version: 9 | ||
composed_of: | ||
- test-component-template | ||
|
||
- do: | ||
indices.put_index_template: | ||
name: test-composable-2 | ||
body: | ||
index_patterns: | ||
- gruly* | ||
priority: 99 | ||
version: 1 | ||
composed_of: | ||
- test-component-template | ||
|
||
--- | ||
"Matching all templates": | ||
|
||
- do: | ||
cat.templates: | ||
h: [name] | ||
s: [name] | ||
|
||
- match: | ||
$body: /test-composable-1\ntest-composable-2\ntest-legacy-1\ntest-legacy-2\n/ | ||
|
||
- do: | ||
cat.templates: | ||
name: "*" | ||
h: [name] | ||
s: [name] | ||
|
||
- match: | ||
$body: /test-composable-1\ntest-composable-2\ntest-legacy-1\ntest-legacy-2\n/ | ||
|
||
--- | ||
"Matching all templates with other patterns": | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: "support for multiple patterns added in 8.0.0" | ||
|
||
- do: | ||
cat.templates: | ||
name: "nonexistent*,*,other-name" | ||
h: [name] | ||
s: [name] | ||
|
||
- match: | ||
$body: /test-composable-1\ntest-composable-2\ntest-legacy-1\ntest-legacy-2\n/ | ||
|
||
--- | ||
"Matching no templates": | ||
|
||
- do: | ||
cat.templates: | ||
name: "nonexistent" | ||
h: [name] | ||
s: [name] | ||
|
||
- match: | ||
$body: /^$/ | ||
|
||
--- | ||
"Matching single names": | ||
|
||
- do: | ||
cat.templates: | ||
name: "test-legacy-1" | ||
h: [name] | ||
s: [name] | ||
|
||
- match: | ||
$body: /^test-legacy-1\n$/ | ||
|
||
|
||
- do: | ||
cat.templates: | ||
name: "test-composable-2" | ||
h: [name] | ||
s: [name] | ||
|
||
- match: | ||
$body: /^test-composable-2\n$/ | ||
|
||
--- | ||
"Matching single patterns": | ||
|
||
- do: | ||
cat.templates: | ||
name: "test-legacy-*" | ||
h: [name] | ||
s: [name] | ||
|
||
- match: | ||
$body: /^test-legacy-1\ntest-legacy-2\n$/ | ||
|
||
|
||
- do: | ||
cat.templates: | ||
name: "test-*-2" | ||
h: [name] | ||
s: [name] | ||
|
||
- match: | ||
$body: /^test-composable-2\ntest-legacy-2\n$/ | ||
|
||
--- | ||
"Matching lists of names": | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: "support for multiple patterns added in 8.0.0" | ||
|
||
- do: | ||
cat.templates: | ||
name: "test-legacy-1,test-composable-2" | ||
h: [name] | ||
s: [name] | ||
|
||
- match: | ||
$body: /^test-composable-2\ntest-legacy-1\n$/ | ||
|
||
--- | ||
"Matching names and wildcards": | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: "support for multiple patterns added in 8.0.0" | ||
|
||
- do: | ||
cat.templates: | ||
name: "test-legacy-1,test-composable-*" | ||
h: [name] | ||
s: [name] | ||
|
||
- match: | ||
$body: /^test-composable-1\ntest-composable-2\ntest-legacy-1\n$/ | ||
|
||
- do: | ||
cat.templates: | ||
name: "test-legacy-*,test-composable-2" | ||
h: [name] | ||
s: [name] | ||
|
||
- match: | ||
$body: /^test-composable-2\ntest-legacy-1\ntest-legacy-2\n$/ |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this, shouldn't we rely on the template request to only returns stuff matching our initial cat request since we pass on the index name? (I'm sure we do, but I can't really figure out why I must admit :))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TransportGetComponentTemplateAction
only accepts a single name or pattern and throws an exception if it's not found - it might be not found because it's a legacy template name or because it's really just not there but in any case this API doesn't return a 404 in that case, just an empty response. We could optimise for the one-argument case if we think the number of component templates will be ovewhelming otherwise, but I judge that it's ok to just get them all.