-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Search Foundations/MappingIndex mappings, including merging and defining field typesIndex mappings, including merging and defining field typesMetaTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in Elasticsearch
Description
Main issue: #23714
Feature branch: field-aliases
Documentation: https://github.com/elastic/elasticsearch/blob/master/docs/reference/mapping/types/alias.asciidoc
Summary of technical approach:
- Introduce a new field mapping, with
type: alias. This mapping has largely the same structure and handling as a standard field mapping. In the code it corresponds to a new top-levelMappertype calledFieldAliasMapper, that does not inherit fromFieldMapper. - Resolve field aliases used in search and field capabilities APIs to their concrete fields before executing the requests. In general, this resolution occurs as the request is being translated to lucene. At a code level, we make sure to keep track of aliases in
MapperServiceso that when field aliases are supplied toMapperService#fullName, the correct concreteMappedFieldTypeis returned. This concrete field type is then used in creating queries, fetching doc values, etc. This PR attempts to remove other ways of accessing a field'sMappedFieldTypethat wouldn't handle aliases, as inDocumentFieldMappers#getMapper.
TODO:
- Merge initial PR to add basic support. Add basic support for field aliases in index mappings. #31287
- Perform validation on the field alias mapping. In particular, it should not reference an object field or another alias field. In addition, the alias and its concrete field should have the same nested scope. Add validation for field alias mappings. #31518
- Ensure that field aliases can be used when loading
stored_fields. Allow for aliases when fetching stored fields. #31411 - Make sure field aliases can be accessed from a script. Add tests around accessing field aliases in scripts. #31417
- Add documentation. Clearly document when aliases are supported vs. not (e.g. when filtering
_sourceor invalidating the indices cache for a field). Add documentation around field aliases. #31538 - Add comprehensive unit tests for the different query and aggregation types. Add more comprehensive tests for field aliases in queries + aggregations. #31565
- Make sure field alias mappings can be retrieved from the 'get field mappings' API. Note that we will return the original mapping for the alias, and not try to resolve the alias. Return both concrete fields and aliases in DocumentFieldMappers#getMapper. #31671
- Verify that field aliases interact correctly with field-level security. Make sure that field-level security is enforced when using field aliases. #31807
- Resolve technical debt before merging: remove deprecated calls to
DocumentFieldMappers#getFieldMapper. Remove the deprecated method DocumentFieldMappers#getFieldMapper. #32148
ruflin, clintongormley, sophiec20, josefschiefer and webmatwebmat
Metadata
Metadata
Assignees
Labels
:Search Foundations/MappingIndex mappings, including merging and defining field typesIndex mappings, including merging and defining field typesMetaTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in Elasticsearch