Skip to content

Remove redundant methods from DocumentMapper#69803

Merged
javanna merged 2 commits intoelastic:masterfrom
javanna:refactoring/doc_mapper_remove_methods
Mar 2, 2021
Merged

Remove redundant methods from DocumentMapper#69803
javanna merged 2 commits intoelastic:masterfrom
javanna:refactoring/doc_mapper_remove_methods

Conversation

@javanna
Copy link
Copy Markdown
Contributor

@javanna javanna commented Mar 2, 2021

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.

javanna added 2 commits March 2, 2021 14:28
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.
@javanna javanna added :Search Foundations/Mapping Index mappings, including merging and defining field types >refactoring v8.0.0 v7.13.0 labels Mar 2, 2021
@javanna javanna requested a review from romseygeek March 2, 2021 13:37
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Mar 2, 2021
@elasticmachine
Copy link
Copy Markdown
Collaborator

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

@javanna javanna mentioned this pull request Mar 2, 2021
28 tasks
Copy link
Copy Markdown
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 javanna merged commit 8ac2436 into elastic:master Mar 2, 2021
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>refactoring :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team v7.13.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants