-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Remove QueryShardContext#getMapperService #63998
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
Remove QueryShardContext#getMapperService #63998
Conversation
We have been removing usages of getMapperService with the purpose of removing the method at some point. This is so we don't have to expose the entire MapperService to all of the users of QueryShardContext, but rather only specific methods so we can better control its usages, especially around resolving field types. This commit removes the last few usages and adds the missing methods to QueryShardContext. They all revolve around retrieving DocumentMapper from MapperService, yet we can expose specific methods without even exposing DocumentMapper, which would also cause issues.
Pinging @elastic/es-search (:Search/Mapping) |
|
||
public boolean hasMappings() { | ||
return mapperService.documentMapper() != null; | ||
} |
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.
This is only used for the RandomScoreFunctionBuilder, correct? Do we need to add it, or can we just remove that 'no mappings' special case?
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.
yes that is surprisingly the only usage. but I don't feel comfortable removing that no mappings special case. I think it's legit, although annoying to support, and we test it.
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.
@romseygeek are you ok with this or maybe do you have other ideas?
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.
Let's leave it in for now, if we decide to go with a no-op mapper by default in MapperService we can remove it then.
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.
true, I will try that idea very soon.
run elasticsearch-ci/1 |
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.
Awesome!
We have been removing usages of getMapperService with the purpose of removing the method at some point. This is so we don't have to expose the entire MapperService to all of the users of QueryShardContext, but rather only specific methods so we can better control its usages, especially around resolving field types. This commit removes the last few usages and adds the missing methods to QueryShardContext. They all revolve around retrieving DocumentMapper from MapperService, yet we can expose specific methods without even exposing DocumentMapper, which would also cause issues.
We have been removing usages of getMapperService with the purpose of removing the method at some point. This is so we don't have to expose the entire MapperService to all of the users of QueryShardContext, but rather only specific methods so we can better control its usages, especially around resolving field types. This commit removes the last few usages and adds the missing methods to QueryShardContext. They all revolve around retrieving DocumentMapper from MapperService, yet we can expose specific methods without even exposing DocumentMapper, which would also cause issues.
We have been removing usages of getMapperService with the purpose of removing the method at some point. This is so we don't have to expose the entire MapperService to all of the users of QueryShardContext, but rather only specific methods so we can better control its usages, especially around resolving field types.
This commit removes the last few usages and adds the missing methods to QueryShardContext. They all revolve around retrieving DocumentMapper from MapperService, yet we can expose specific methods without even exposing DocumentMapper, which would also cause issues.