# How to stop text field to be 'keyword' in dynamic mapping

**URL:** <https://discuss.elastic.co/t/how-to-stop-text-field-to-be-keyword-in-dynamic-mapping/77009>\
**Category:** Elasticsearch\
**Created:** [March 1, 2017, 3:22pm UTC](https://discuss.elastic.co/t/how-to-stop-text-field-to-be-keyword-in-dynamic-mapping/77009 "2017-03-01T15:22:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vijaypalmanit](https://avatars.discourse-cdn.com/v4/letter/v/c77e96/32.png) [@vijaypalmanit](https://discuss.elastic.co/u/vijaypalmanit)\
**Post date:** [March 1, 2017, 3:22pm UTC](https://discuss.elastic.co/t/how-to-stop-text-field-to-be-keyword-in-dynamic-mapping/77009/1 "2017-03-01T15:22:06Z")

</div>

running the below piece of code :

```
PUT /data/row/1
{
"name":"vijay"
}

```

creates the index where "name" field is of type "text" and "keyword" both :

```
{
   "data": {
      "mappings": {
         "row": {
            "properties": {
               "name": {
                  "type": "text", <--------
                  "fields": {
                     "keyword": {
                        "type": "keyword", <--------
                        "ignore_above": 256
                     }
                  }
               }
            }
         }
      }
   }
}

```

How can I stop this behaviour of text field to automatically becoming keyword, using the same above code (1st)

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 1, 2017, 3:51pm UTC](https://discuss.elastic.co/t/how-to-stop-text-field-to-be-keyword-in-dynamic-mapping/77009/2 "2017-03-01T15:51:01Z")

</div>

The easiest way is to provide your mapping for this field instead of letting elasticsearch autoguessing.  
Then you can also define a dynamic template which will be applied to all String fields.

---

<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:** [March 29, 2017, 3:51pm UTC](https://discuss.elastic.co/t/how-to-stop-text-field-to-be-keyword-in-dynamic-mapping/77009/3 "2017-03-29T15:51:02Z")

</div>

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