# Datatype accidentally changed from keyword to text

**URL:** <https://discuss.elastic.co/t/datatype-accidentally-changed-from-keyword-to-text/149220>\
**Category:** Elasticsearch\
**Created:** [September 20, 2018, 5:03am UTC](https://discuss.elastic.co/t/datatype-accidentally-changed-from-keyword-to-text/149220 "2018-09-20T05:03:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hiwjd](https://avatars.discourse-cdn.com/v4/letter/h/91b2a8/32.png) [@hiwjd](https://discuss.elastic.co/u/hiwjd)\
**Post date:** [September 20, 2018, 5:03am UTC](https://discuss.elastic.co/t/datatype-accidentally-changed-from-keyword-to-text/149220/1 "2018-09-20T05:03:20Z")

</div>

hi there.

here is my issue. i init a index with field `attrs` which its datatype is keyword. but the datatype of `attrs` will accidentally be changed to text.

here is the initial datatype from Get Mapping API:

```auto
{
    album: {
        mappings: {
            album: {
                attrs: {
                    full_name: "attrs",
                    mapping: {
                        attrs: {
                            type: "keyword"
                        }
                    }
                }
            }
        }
    }
}

```

and after changed:

```auto
{
    album: {
        mappings: {
            album: {
                attrs: {
                    full_name: "attrs",
                    mapping: {
                        attrs: {
                            type: "text",
                            fields: {
                                keyword: {
                                    type: "keyword",
                                    ignore_above: 256
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

```

thanks for help!

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [September 21, 2018, 9:15am UTC](https://discuss.elastic.co/t/datatype-accidentally-changed-from-keyword-to-text/149220/2 "2018-09-21T09:15:46Z")

</div>

> [@hiwjd](#):
>
> but the datatype of `attrs` will accidentally be changed to text.

What causes this change? Your application? Re-creation of the index? You don't know?  
You cannot really change the mapping of a field in an existing index, and it doesn't change by itself (at least to my knowledge, that would be an interesting bug).

So if you can add something to re-create the issues you are having or provide some additional context that would be incredibly helpful.

---

<div class="post-metadata">

**Author:** ![hiwjd](https://avatars.discourse-cdn.com/v4/letter/h/91b2a8/32.png) [@hiwjd](https://discuss.elastic.co/u/hiwjd)\
**Post date:** [September 22, 2018, 6:55am UTC](https://discuss.elastic.co/t/datatype-accidentally-changed-from-keyword-to-text/149220/3 "2018-09-22T06:55:42Z")

</div>

for now I don't know what case the change. I`m still tracing on this.

---

<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:** [October 20, 2018, 6:55am UTC](https://discuss.elastic.co/t/datatype-accidentally-changed-from-keyword-to-text/149220/4 "2018-10-20T06:55:52Z")

</div>

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