Skip to content

Field aliases #23714

Closed
Closed
@clintongormley

Description

@clintongormley

It is hard to rename a field when using time-based indices - search and especially aggregations will only work on either the new or the old version, but there is a transition period where not all data will be seen.

We can introduce a new field type called alias which simply points to another field, eg:

PUT my_index
{
  "mappings": {
    "my_type": {
      "properties": {
        "host": {
          "properties": {
            "source_ip": {
              "type": "ip"
            }
          }
        },
        "sourceIP": {
          "type": "alias",
          "path": "host.source_ip"
        }
      }
    }
  }
}

This field type would work as follows:

  • Attempts to index into the alias field would result in an exception - it is read only
  • Queries, aggs, suggestions, scripts (using doc[]), highlighting, fielddata_fields, docvalue_fields, stored_fields would just get the data (and mapping) from the specified path
  • Source filtering would not work with the aliased field

This also works for users who want to expose a nicer name for fields in Kibana

Metadata

Metadata

Assignees

Labels

:Search Foundations/MappingIndex mappings, including merging and defining field types>featureTeam:Search FoundationsMeta label for the Search Foundations team in Elasticsearch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions