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
Refactor core index/query time properties into FieldType #11422
Conversation
Mappers are currently used at both index and query time for deciding how to "use" a field. For elastic#8871, we need the index wide view of mappings to have a unified set of settings for each field of a given name within the index. This change moves all the current settings (and methods defining query time behavior) into subclasses of FieldType. In a future PR, this will allow storing the field type at the index level, instead of mappers (which can still have settings that differ per document type). The change is quite large (I'm sorry). I could not see a way to migrate to this in a more piecemeal way. I did leave out cutting over callers of the query methods to using the field type, as that can be done in a follow up.
I should clarify, this moves all settings that affects query time behavior. So if something affects only indexing (eg coerce setting for numeric fields), it is left in the mapper. |
LGTM I like where this is going |
/** | ||
* This defines the core properties and functions to operate on a field. | ||
*/ | ||
public class MappedFieldType extends FieldType { |
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.
should this class somehow validate if all required members are set when it's frozen. IE we need analyzer and names to work no?
it's a pretty big change and hard to review but I second @jpountz here this looks good and goes into the right direction. I left some minor comments regarding tests and assertions... otehr than that LGTM |
Mappings: Refactor core index/query time properties into FieldType
Mappers are currently used at both index and query time for deciding
how to "use" a field. For #8871, we need the index wide view of
mappings to have a unified set of settings for each field of a given
name within the index.
This change moves all the current settings (and methods defining
query time behavior) into subclasses of FieldType. In a future
PR, this will allow storing the field type at the index level,
instead of mappers (which can still have settings that differ
per document type).
The change is quite large (I'm sorry). I could not see a way to
migrate to this in a more piecemeal way. I did leave out cutting
over callers of the query methods to using the field type, as
that can be done in a follow up.