# "Cannot write to a field alias \[...\]" on reindex

**URL:** <https://discuss.elastic.co/t/cannot-write-to-a-field-alias-on-reindex/327162>\
**Category:** Elasticsearch\
**Created:** [March 7, 2023, 9:14am UTC](https://discuss.elastic.co/t/cannot-write-to-a-field-alias-on-reindex/327162 "2023-03-07T09:14:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adrien](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@Adrien](https://discuss.elastic.co/u/Adrien)\
**Post date:** [March 7, 2023, 9:14am UTC](https://discuss.elastic.co/t/cannot-write-to-a-field-alias-on-reindex/327162/1 "2023-03-07T09:14:59Z")

</div>

Hi,

I'm trying to migrate an Elasticsearch index from 6.8 to 7.10 using the `_reindex` route API.

Unfortunately during the index migration I get the error `Cannot write to a field alias [gl2_message_id].`

The mapping, copied from source index to destination index, is the following:

```json
"properties": {
  "gl2_message_id": {
    "type": "alias",
    "path": "id"
  },
  "id": {
    "type": "keyword"
  },
  [...]

```

> FYI, these index and data have been generated by Graylog

For what I understand, the `_reindex` process tries to write to `gl2_message_id` which is forbidden as it is an alias.

What I don't understand is how is it possible that in the source index a concrete value exists in `gl2_message_id`.

So I tried to recreate this situation to understand it. But I failed to reproduce it:

- First try on a new index, I create a document `{ "field1": true, "field1Alias": true }`.  
Then I update mapping and declare the field `field1Alias` as `{ "type": "alias", "path": "field1" }`.

- Second try on a new index, I create a document `{ "field1": true }`.  
Then I update mapping and declare the field `field1Alias` as `{ "type": "alias", "path": "field1" }`.  
Finally I try to index a document `{ "field1Alias": true }`.

I have 2 questions:

1. How is it possible that I get data returned from field `gl2_message_id` during `_reindex` while it's an alias?
2. How can I reindex these data?

I tried a lot of things, read the documentations multiple time but I'm stuck right now and I asking myself if there is a bug which allowed to put data to `gl2_message_id` or a bug in `_reindex`.

Thanks,  
Adrien

---

<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:** [April 4, 2023, 9:15am UTC](https://discuss.elastic.co/t/cannot-write-to-a-field-alias-on-reindex/327162/2 "2023-04-04T09:15:17Z")

</div>

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