Make sure to validate the type before attempting to merge a new mapping.#45157
Merged
jtibshirani merged 5 commits intoelastic:masterfrom Aug 12, 2019
Merged
Make sure to validate the type before attempting to merge a new mapping.#45157jtibshirani merged 5 commits intoelastic:masterfrom
jtibshirani merged 5 commits intoelastic:masterfrom
Conversation
Collaborator
|
Pinging @elastic/es-search |
4c6c09f to
e637ea8
Compare
e637ea8 to
40f319f
Compare
Contributor
Author
|
@elasticmachine run elasticsearch-ci/2 |
mayya-sharipova
approved these changes
Aug 6, 2019
Contributor
mayya-sharipova
left a comment
There was a problem hiding this comment.
Thanks @jtibshirani, makes sense
Contributor
Author
|
Thanks for the review @mayya-sharipova ! |
Contributor
Author
|
@elasticmachine run elasticsearch-ci/1 |
jtibshirani
added a commit
that referenced
this pull request
Aug 12, 2019
…ng. (#45157) Currently, when adding a new mapping, we attempt to parse + merge it before checking whether its top-level document type matches the existing type. So when a user attempts to introduce a new mapping type, we may give a confusing error message around merging instead of complaining that it's not possible to add more than one type ("Rejecting mapping update to [my-index] as the final mapping would have more than 1 type..."). This PR moves the type validation to the start of `MetaDataMappingService#applyRequest` so that we make sure the type matches before performing any mapper merging. We already partially addressed this issue in #29316, but the tests there focused on `MapperService` and did not catch this problem with end-to-end mapping updates. Addresses #43012.
jtibshirani
added a commit
that referenced
this pull request
Aug 12, 2019
…ng. (#45157) Currently, when adding a new mapping, we attempt to parse + merge it before checking whether its top-level document type matches the existing type. So when a user attempts to introduce a new mapping type, we may give a confusing error message around merging instead of complaining that it's not possible to add more than one type ("Rejecting mapping update to [my-index] as the final mapping would have more than 1 type..."). This PR moves the type validation to the start of `MetaDataMappingService#applyRequest` so that we make sure the type matches before performing any mapper merging. We already partially addressed this issue in #29316, but the tests there focused on `MapperService` and did not catch this problem with end-to-end mapping updates. Addresses #43012.
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.
Currently, when adding a new mapping, we attempt to parse + merge it before
checking whether its top-level document type matches the existing type. So when
a user attempts to introduce a new mapping type, we may give a confusing error
message around merging instead of complaining that it's not possible to add
more than one type ("Rejecting mapping update to [my-index] as the final
mapping would have more than 1 type...").
This PR moves the type validation to the start of
MetaDataMappingService#applyRequestso that we make sure the type matchesbefore performing any mapper merging.
We already partially addressed this issue in #29316, but the tests there
focused on
MapperServiceand did not catch this problem with end-to-endmapping updates.
Addresses #43012.