-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Rework FieldMapper and MappedFieldType #56814
Copy link
Copy link
Closed
Labels
:Search Foundations/MappingIndex mappings, including merging and defining field typesIndex mappings, including merging and defining field types>enhancementMetaTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in Elasticsearch
Metadata
Metadata
Assignees
Labels
:Search Foundations/MappingIndex mappings, including merging and defining field typesIndex mappings, including merging and defining field types>enhancementMetaTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in Elasticsearch
Type
Fields
Give feedbackNo fields configured for issues without a type.
We currently have two abstractions that encapsulate different mapping types within elasticsearch.
FieldMapperdefines how a particular field from a json document should be indexed into lucene, whileMappedFieldTypedefines factory methods for building queries against those fields. However,MappedFieldTypealso extends lucene'sFieldTypeand so holds some index structure configuration, which really belongs onFieldMapper. As a result, it also handles some merging and consistency checking logic dealing with mapping updates, which again only really effect index-time structures.We should rework the relationship here, decoupling
MappedFieldTypefromFieldTypeand keeping it as a simple source of query factory methods. This would also make it easier to generate field types that point to other fields, adding functionality on the way. For example, if we reworked field aliases to be a simple pointer field type, then we could remove a lot of special-casing logic in MapperService that has to handle normal fields and aliases separately.Because of the fairly complex coupling already involved here, this will need to be done in several steps:
eager_global_ordinalsonly applies to keyword and joinindex,doc_valuesandstorewon't apply to search-time only mappers, so maybe move them as well?MappedFieldTypeto be passed to the base class constructor. This will allow for late-binding of search fields, so that they can reference other field mappers.