# Does creating a Field Alias requires reindexing?

**URL:** <https://discuss.elastic.co/t/does-creating-a-field-alias-requires-reindexing/349820>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [December 21, 2023, 6:55pm UTC](https://discuss.elastic.co/t/does-creating-a-field-alias-requires-reindexing/349820 "2023-12-21T18:55:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HotPocket](https://avatars.discourse-cdn.com/v4/letter/h/bb73d2/32.png) [@HotPocket](https://discuss.elastic.co/u/HotPocket)\
**Post date:** [December 21, 2023, 6:55pm UTC](https://discuss.elastic.co/t/does-creating-a-field-alias-requires-reindexing/349820/1 "2023-12-21T18:55:05Z")

</div>

Typically modifying the index mapping requires reindexing existing data. I'm look at reference in the documentation whether creating Field Alias does or does not require reindexing. Is it confirmed that if I modify the index mapping with new field aliases, I'll be able to subsequently use search API with the new field aliases to refer to existing fields?

Thanks

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [December 21, 2023, 11:35pm UTC](https://discuss.elastic.co/t/does-creating-a-field-alias-requires-reindexing/349820/2 "2023-12-21T23:35:36Z")

</div>

Hi @HotPocket Welcome to the community.

No adding an alias does not require re-indexing

See this example

```auto
PUT discuss-test
{
  "mappings": {
    "properties": {
      "foo" : {"type": "keyword"}
    }
  }
}

POST discuss-test/_doc
{
  "foo" : "bar"
}

POST discuss-test/_doc
{
  "foo" : "bah"
}

POST discuss-test/_doc
{
  "foo" : "baz"
}

POST discuss-test/_mapping
{
  "properties": {
    "new-foo": {
      "type": "alias",
      "path": "foo"
    }
  }
}

GET discuss-test/_search
{
  "fields": ["*"], 
  "query": {
    "term": {
      "new-foo": {
        "value": "bar"
      }
    }
  }
}

#Results

# GET discuss-test/_search 200 OK
{
  "took": 1,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 1,
      "relation": "eq"
    },
    "max_score": 0.9808291,
    "hits": [
      {
        "_index": "discuss-test",
        "_id": "H-24jowBVM3tgE6xNJBp",
        "_score": 0.9808291,
        "_source": {
          "foo": "bar"
        },
        "fields": {
          "new-foo": [
            "bar"
          ],
          "foo": [
            "bar"
          ]
        }
      }
    ]
  }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 18, 2024, 11:35pm UTC](https://discuss.elastic.co/t/does-creating-a-field-alias-requires-reindexing/349820/3 "2024-01-18T23:35:39Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
