# Elasticsearch fields

**URL:** <https://discuss.elastic.co/t/elasticsearch-fields/110696>\
**Category:** Elasticsearch\
**Created:** [December 7, 2017, 2:54pm UTC](https://discuss.elastic.co/t/elasticsearch-fields/110696 "2017-12-07T14:54:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![baiesi](https://avatars.discourse-cdn.com/v4/letter/b/b782af/32.png) [@baiesi](https://discuss.elastic.co/u/baiesi)\
**Post date:** [December 7, 2017, 2:54pm UTC](https://discuss.elastic.co/t/elasticsearch-fields/110696/1 "2017-12-07T14:54:39Z")

</div>

Is there a default setting in E5.5 that will set any newly created doc fields as not-analyzed / keyword by default?

---

<div class="post-metadata">

**Author:** ![luiz.santos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luiz.santos/32/24664_2.png) [@luiz.santos](https://discuss.elastic.co/u/luiz.santos)\
**Post date:** [December 8, 2017, 8:04pm UTC](https://discuss.elastic.co/t/elasticsearch-fields/110696/2 "2017-12-08T20:04:00Z")

</div>

Hi @baiesi,

You can [dynamic templates](https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-templates.html) for that. Here an example where all fields of type string will receive a custom mapping:

```
PUT index_name
{
  "mappings": {
    "my_type": {
      "dynamic_templates": [
        {
          "strings": {
            "match_mapping_type": "string",
            "mapping": {
              "type": "text",
              "fields": {
                "raw": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            }
          }
        }
      ]
    }
  }
} 

```

Best.  
LG

---

<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 5, 2018, 8:04pm UTC](https://discuss.elastic.co/t/elasticsearch-fields/110696/3 "2018-01-05T20:04:09Z")

</div>

Closed on January 5, 2018, 8:04pm UTC

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