Skip to content

Backport: Add validation for dynamic templates#52890

Merged
martijnvg merged 2 commits intoelastic:7.xfrom
martijnvg:backport_51233
Feb 28, 2020
Merged

Backport: Add validation for dynamic templates#52890
martijnvg merged 2 commits intoelastic:7.xfrom
martijnvg:backport_51233

Conversation

@martijnvg
Copy link
Copy Markdown
Member

Backport of #51233 to 7 dot x branch.

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 #17411
Closes #24419

Co-authored-by: Adrien Grand jpountz@gmail.com

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>
@martijnvg martijnvg added :Search Foundations/Mapping Index mappings, including merging and defining field types :Data Management/Indices APIs DO NOT USE. Use ":Distributed/Indices APIs" or ":StorageEngine/Templates" instead. backport v7.7.0 labels Feb 27, 2020
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Indices APIs)

@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-search (:Search/Mapping)

@martijnvg
Copy link
Copy Markdown
Member Author

@elasticmachine run elasticsearch-ci/packaging-sample-matrix-unix

@martijnvg martijnvg merged commit 6aa9aaa into elastic:7.x Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport :Data Management/Indices APIs DO NOT USE. Use ":Distributed/Indices APIs" or ":StorageEngine/Templates" instead. :Search Foundations/Mapping Index mappings, including merging and defining field types v7.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants