[7.x] Add warnings/errors when V2 templates would match same indices… (#54367)#54449
Merged
dakrone merged 2 commits intoelastic:7.xfrom Mar 30, 2020
Merged
[7.x] Add warnings/errors when V2 templates would match same indices… (#54367)#54449dakrone merged 2 commits intoelastic:7.xfrom
dakrone merged 2 commits intoelastic:7.xfrom
Conversation
…tic#54367) * Add warnings/errors when V2 templates would match same indices as V1 With the introduction of V2 index templates, we want to warn users that templates they put in place might not take precedence (because v2 templates are going to "win"). This adds this validation at `PUT` time for both V1 and V2 templates with the following rules: ** When creating or updating a V2 template - If the v2 template would match indices for an existing v1 template or templates, provide a warning (through the deprecation logging so it shows up to the client) as well as logging the warning The v2 warning looks like: ``` index template [my-v2-template] has index patterns [foo-*] matching patterns from existing older templates [old-v1-template,match-all-template] with patterns (old-v1-template => [foo*],match-all-template => [*]); this template [my-v2-template] will take precedence during new index creation ``` ** When creating a V1 template - If the v1 template is for index patterns of `"*"` and a v2 template exists, warn that the v2 template may take precedence - If the v1 template is for index patterns other than all indices, and a v2 template exists that would match, throw an error preventing creation of the v1 template ** When updating a V1 template (without changing its existing `index_patterns`!) - If the v1 template is for index patterns that would match an existing v2 template, warn that the v2 template may take precedence. The v1 warning looks like: ``` template [my-v1-template] has index patterns [*] matching patterns from existing index templates [existing-v2-template] with patterns (existing-v2-template => [foo*]); this template [my-v1-template] may be ignored in favor of an index template at index creation time ``` And the v1 error looks like: ``` template [my-v1-template] has index patterns [foo*] matching patterns from existing index templates [existing-v2-template] with patterns (existing-v2-template => [f*]), use index templates (/_index_template) instead ``` Relates to elastic#53101 * Remove v2 index and component templates when cleaning up tests * Finish half-finished comment sentence * Guard template removal and ignore for earlier versions of ES Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Collaborator
|
Pinging @elastic/es-core-features (:Core/Features/Indices APIs) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backports the following commits to 7.x: