-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Handle merging dotted object names when merging V2 template mappings #55982
Merged
Conversation
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
When merging component template, index template, and request mappings, we now treat any declaration of a top-level field the same as replacing all sub-objects. For example, assuming two component templates with mappings and template B taking precedence: ``` A: {foo: {...}} B: {foo.bar: {...}} Result: {foo.bar: {...}} A: {foo.bar: {...}} B: {foo: {...}} Result: {foo: {...}} A: {foo.bar: {...}} B: {foo.baz: {...}} Result: {foo.baz: {...}} ``` Relates to elastic#53101
dakrone
added
:Data Management/Indices APIs
APIs to create and manage indices and templates
v8.0.0
v7.8.0
labels
Apr 29, 2020
Pinging @elastic/es-core-features (:Core/Features/Indices APIs) |
elasticmachine
added
the
Team:Data Management
Meta label for data/management team
label
Apr 29, 2020
probakowski
suggested changes
Apr 30, 2020
server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexService.java
Show resolved
Hide resolved
probakowski
approved these changes
Apr 30, 2020
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.
LGTM 👍 thanks @dakrone!
dakrone
added a commit
to dakrone/elasticsearch
that referenced
this pull request
Apr 30, 2020
…lastic#55982) When merging component template, index template, and request mappings, we now treat any declaration of a top-level field the same as replacing all sub-objects. For example, assuming two component templates with mappings and template B taking precedence: ``` A: {foo: {...}} B: {foo.bar: {...}} Result: {foo.bar: {...}} A: {foo.bar: {...}} B: {foo: {...}} Result: {foo: {...}} A: {foo.bar: {...}} B: {foo.baz: {...}} Result: {foo.baz: {...}} ``` Relates to elastic#53101
dakrone
added a commit
to dakrone/elasticsearch
that referenced
this pull request
Jun 4, 2020
This commit changes the merge strategy introduced in elastic#55607 and elastic#55982. Instead of overwriting these fields, we now prevent them from being merged with an exception when a user attempts to overwrite a field. As part of this, a more robust validation has been added. The existing validation checked whether templates (composable and component) were valid on their own, this new validation now checks that the composite template (mappings/settings/aliases) is valid. This means that when a composable template is added or updated, we confirm that it is valid with its component pieces. When a component template is updated we ensure that all composable templates that make use of the component template continue to be valid before allowing the component template to be updated. This change also necessitated changes in the tests, however, I have left tests that exercise mapping merging with nested object fields as `@AwaitsFix`, as we intend to change the behavior soon to allow merging in a recursive-with-replacement fashion (see: elastic#57393). I have added tests that check the new disallowing behavior in the meantime.
dakrone
added a commit
that referenced
this pull request
Jun 8, 2020
) * Disallow merging existing mapping field definitions in templates This commit changes the merge strategy introduced in #55607 and #55982. Instead of overwriting these fields, we now prevent them from being merged with an exception when a user attempts to overwrite a field. As part of this, a more robust validation has been added. The existing validation checked whether templates (composable and component) were valid on their own, this new validation now checks that the composite template (mappings/settings/aliases) is valid. This means that when a composable template is added or updated, we confirm that it is valid with its component pieces. When a component template is updated we ensure that all composable templates that make use of the component template continue to be valid before allowing the component template to be updated. This change also necessitated changes in the tests, however, I have left tests that exercise mapping merging with nested object fields as `@AwaitsFix`, as we intend to change the behavior soon to allow merging in a recursive-with-replacement fashion (see: #57393). I have added tests that check the new disallowing behavior in the meantime. * Use functional instead of imperative prefix collection * Use IndexService.withTempIndexService * Rename tests * Fix tests Co-authored-by: Elastic Machine <[email protected]>
dakrone
added a commit
to dakrone/elasticsearch
that referenced
this pull request
Jun 8, 2020
…stic#57701) * Disallow merging existing mapping field definitions in templates This commit changes the merge strategy introduced in elastic#55607 and elastic#55982. Instead of overwriting these fields, we now prevent them from being merged with an exception when a user attempts to overwrite a field. As part of this, a more robust validation has been added. The existing validation checked whether templates (composable and component) were valid on their own, this new validation now checks that the composite template (mappings/settings/aliases) is valid. This means that when a composable template is added or updated, we confirm that it is valid with its component pieces. When a component template is updated we ensure that all composable templates that make use of the component template continue to be valid before allowing the component template to be updated. This change also necessitated changes in the tests, however, I have left tests that exercise mapping merging with nested object fields as `@AwaitsFix`, as we intend to change the behavior soon to allow merging in a recursive-with-replacement fashion (see: elastic#57393). I have added tests that check the new disallowing behavior in the meantime. * Use functional instead of imperative prefix collection * Use IndexService.withTempIndexService * Rename tests * Fix tests Co-authored-by: Elastic Machine <[email protected]>
dakrone
added a commit
to dakrone/elasticsearch
that referenced
this pull request
Jun 8, 2020
…stic#57701) * Disallow merging existing mapping field definitions in templates This commit changes the merge strategy introduced in elastic#55607 and elastic#55982. Instead of overwriting these fields, we now prevent them from being merged with an exception when a user attempts to overwrite a field. As part of this, a more robust validation has been added. The existing validation checked whether templates (composable and component) were valid on their own, this new validation now checks that the composite template (mappings/settings/aliases) is valid. This means that when a composable template is added or updated, we confirm that it is valid with its component pieces. When a component template is updated we ensure that all composable templates that make use of the component template continue to be valid before allowing the component template to be updated. This change also necessitated changes in the tests, however, I have left tests that exercise mapping merging with nested object fields as `@AwaitsFix`, as we intend to change the behavior soon to allow merging in a recursive-with-replacement fashion (see: elastic#57393). I have added tests that check the new disallowing behavior in the meantime. * Use functional instead of imperative prefix collection * Use IndexService.withTempIndexService * Rename tests * Fix tests Co-authored-by: Elastic Machine <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
:Data Management/Indices APIs
APIs to create and manage indices and templates
>enhancement
Team:Data Management
Meta label for data/management team
v7.8.0
v8.0.0-alpha1
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.
When merging component template, index template, and request mappings, we now treat any declaration
of a top-level field the same as replacing all sub-objects. For example, assuming two component
templates with mappings and template B taking precedence:
Relates to #53101