# How to set default mapping to “keyword” for dynamically added properties in Elasticsearch

**URL:** <https://discuss.elastic.co/t/how-to-set-default-mapping-to-keyword-for-dynamically-added-properties-in-elasticsearch/241485>\
**Category:** Elasticsearch\
**Created:** [July 16, 2020, 2:39pm UTC](https://discuss.elastic.co/t/how-to-set-default-mapping-to-keyword-for-dynamically-added-properties-in-elasticsearch/241485 "2020-07-16T14:39:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gitterhh](https://avatars.discourse-cdn.com/v4/letter/g/b19c9b/32.png) [@gitterhh](https://discuss.elastic.co/u/gitterhh)\
**Post date:** [July 16, 2020, 2:39pm UTC](https://discuss.elastic.co/t/how-to-set-default-mapping-to-keyword-for-dynamically-added-properties-in-elasticsearch/241485/1 "2020-07-16T14:39:06Z")

</div>

In our application we add new documents which can have new unknown properties.

Is it possible to set default mapping to "keyword" for dynamically added new properties in Elasticsearch?

---

<div class="post-metadata">

**Author:** ![Vinayak\_Sapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinayak_sapre/32/45939_2.png) [@Vinayak\_Sapre](https://discuss.elastic.co/u/Vinayak_Sapre)\
**Post date:** [July 17, 2020, 3:26am UTC](https://discuss.elastic.co/t/how-to-set-default-mapping-to-keyword-for-dynamically-added-properties-in-elasticsearch/241485/2 "2020-07-17T03:26:13Z")

</div>

@gitterhh  
You can do this by defining dynamic template

```auto
{
  "mappings": {
    "dynamic_templates": [
      {
        "strings": {
          "match_mapping_type": "string",
          "mapping": {
            "type": "keyword"
          }
        }
      }
    ]
  }
}

```

---

<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:** [August 14, 2020, 3:26am UTC](https://discuss.elastic.co/t/how-to-set-default-mapping-to-keyword-for-dynamically-added-properties-in-elasticsearch/241485/3 "2020-08-14T03:26:23Z")

</div>

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