Skip to content

Remove direct dependency between ParserContext and MapperService #63741

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

Merged

Conversation

javanna
Copy link
Member

@javanna javanna commented Oct 15, 2020

ParserContext only needs some small portions of MapperService, and certainly does not need to expose MapperService through its current getter method.

With this change we address this by keeping references to the needed components rather than the whole MapperService.

ParserContext only needs some small portions of MapperService, and certainly does not need to expose MapperService through its current getter method.

With this change we address this by keeping references to the needed components rather than the whole MapperService
@javanna javanna added :Search Foundations/Mapping Index mappings, including merging and defining field types >refactoring v8.0.0 v7.11.0 labels Oct 15, 2020
@javanna javanna requested a review from romseygeek October 15, 2020 13:12
@elasticmachine
Copy link
Collaborator

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

@elasticmachine elasticmachine added the Team:Search Meta label for search team label Oct 15, 2020
Copy link
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 can already see some further cleanups opened up by this!

@@ -68,7 +68,7 @@ public static Field field(Settings settings, String path) {
}

public static final TypeParser PARSER = new FixedTypeParser(c -> {
final IndexSettings indexSettings = c.mapperService().getIndexSettings();
final IndexSettings indexSettings = c.getIndexSettings();
Copy link
Contributor

Choose a reason for hiding this comment

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

We can probably change this to use the Version directly as a follow-up

@@ -99,7 +99,7 @@ public Builder put(MetadataFieldMapper.Builder mapper) {
return this;
}

public DocumentMapper build(IndexSettings indexSettings, DocumentMapperParser documentMapperParser, IndexAnalyzers indexAnalyzers) {
public DocumentMapper build() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hah, I'm getting whiplash now.

Copy link
Member Author

Choose a reason for hiding this comment

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

haha I had a deja vu making this change, and I did not mean for any of this to happen just two days ago. but I am lucky, I guess :)

@javanna
Copy link
Member Author

javanna commented Oct 15, 2020

LGTM - I can already see some further cleanups opened up by this!

Yes, for instance we can remove the need for MapperService higher up in callers, follow-up will come soon.

@javanna javanna merged commit d126afb into elastic:master Oct 15, 2020
javanna added a commit to javanna/elasticsearch that referenced this pull request Oct 15, 2020
…stic#63741)

ParserContext only needs some small portions of MapperService, and certainly does not need to expose MapperService through its current getter method.

With this change we address this by keeping references to the needed components rather than the whole MapperService
javanna added a commit that referenced this pull request Oct 16, 2020
)

ParserContext only needs some small portions of MapperService, and certainly does not need to expose MapperService through its current getter method.

With this change we address this by keeping references to the needed components rather than the whole MapperService
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.11.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants