Backport: Add validation for dynamic templates#52890
Merged
martijnvg merged 2 commits intoelastic:7.xfrom Feb 28, 2020
Merged
Conversation
Tries to load a `Mapper` instance for the mapping snippet of a dynamic template.
This should catch things like using an analyzer that is undefined or mapping attributes that are unused.
This is best effort:
* If `{{name}}` placeholder is used in the mapping snippet then validation is skipped.
* If `match_mapping_type` is not specified then validation is performed for all mapping types.
If parsing succeeds with a single mapping type then this the dynamic mapping is considered valid.
If is detected that a dynamic template mapping snippet is invalid at mapping update time then the mapping update is failed for indices created on 8.0.0-alpha1 and later. For indices created on prior version a deprecation warning is omitted instead. In 7.x clusters the mapping update will never fail in case of an invalid dynamic template mapping snippet and a deprecation warning will always be omitted.
Closes elastic#17411
Closes elastic#24419
Co-authored-by: Adrien Grand <jpountz@gmail.com>
Collaborator
|
Pinging @elastic/es-core-features (:Core/Features/Indices APIs) |
Collaborator
|
Pinging @elastic/es-search (:Search/Mapping) |
Member
Author
|
@elasticmachine run elasticsearch-ci/packaging-sample-matrix-unix |
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.
Backport of #51233 to 7 dot x branch.
Tries to load a
Mapperinstance for the mapping snippet of a dynamic template.This should catch things like using an analyzer that is undefined or mapping attributes that are unused.
This is best effort:
{{name}}placeholder is used in the mapping snippet then validation is skipped.match_mapping_typeis not specified then validation is performed for all mapping types.If parsing succeeds with a single mapping type then this the dynamic mapping is considered valid.
If is detected that a dynamic template mapping snippet is invalid at mapping update time then the mapping update is failed for indices created on 8.0.0-alpha1 and later. For indices created on prior version a deprecation warning is omitted instead. In 7.x clusters the mapping update will never fail in case of an invalid dynamic template mapping snippet and a deprecation warning will always be omitted.
Closes #17411
Closes #24419
Co-authored-by: Adrien Grand jpountz@gmail.com