Remove redundant methods from DocumentMapper#69803
Merged
javanna merged 2 commits intoelastic:masterfrom Mar 2, 2021
Merged
Conversation
DocumentMapper exposes root() and meta() methods, which can be accessed through the mapping() method which exposes the entire Mapping instance. This commit removes such redundant methods in favour of accessing mapping and retrieving root and meta from them. Additionally, access to Mapping's members is made consistent through getters rather than package private fields in some cases and getters is some other case.
DocumentMapper exposes root() and meta() methods, which can be accessed through the mapping() method which exposes the entire Mapping instance. This commit removes such redundant methods in favour of accessing mapping and retrieving root and meta from them. Additionally, access to Mapping's members is made consistent through getters rather than package private fields in some cases and getters is some other case.
Collaborator
|
Pinging @elastic/es-search (Team:Search) |
28 tasks
romseygeek
approved these changes
Mar 2, 2021
Contributor
romseygeek
left a comment
There was a problem hiding this comment.
LGTM! I think we can rationalise access to metadata mappers some more as well, but that can wait for later.
| VersionFieldMapper.NAME, SeqNoFieldMapper.NAME, SeqNoFieldMapper.PRIMARY_TERM_NAME, SeqNoFieldMapper.TOMBSTONE_NAME); | ||
| this.noopTombstoneMetadataFieldMappers = Stream.of(mapping.metadataMappers) | ||
| this.noopTombstoneMetadataFieldMappers = Stream.of(mapping.getSortedMetadataMappers()) | ||
| .filter(field -> noopTombstoneMetadataFields.contains(field.name())).toArray(MetadataFieldMapper[]::new); |
Contributor
There was a problem hiding this comment.
I'm pretty sure all this can just be replaced with a static set of an IdFieldMapper, SeqNoFieldMapper and VersionFieldMapper, but that can be done in a followup.
Contributor
Author
There was a problem hiding this comment.
yes this is all a bit confusing, it seems very delicate too as in some places we need them sorted, in others we need the map by class, in others we retrieve them by name. I also wonder if we can further clean up DocumentMapper around retrieving metadata mappers.
javanna
added a commit
to javanna/elasticsearch
that referenced
this pull request
Mar 2, 2021
DocumentMapper exposes root() and meta() methods, which can be accessed through the mapping() method which exposes the entire Mapping instance. This commit removes such redundant methods in favour of accessing mapping and retrieving root and meta from them. Additionally, access to Mapping's members is made consistent through getters rather than package private fields in some cases and getters is some other case.
javanna
added a commit
that referenced
this pull request
Mar 2, 2021
DocumentMapper exposes root() and meta() methods, which can be accessed through the mapping() method which exposes the entire Mapping instance. This commit removes such redundant methods in favour of accessing mapping and retrieving root and meta from them. Additionally, access to Mapping's members is made consistent through getters rather than package private fields in some cases and getters is some other case.
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.
DocumentMapper exposes root() and meta() methods, which can be accessed through the mapping() method that exposes the entire Mapping instance.
This commit removes such redundant methods in favour of accessing mapping and retrieving root and meta from them. Additionally, access to Mapping's members is made consistent through getters rather than package private fields in some cases and getters is some other case.