# Template for new attributes of an index

**URL:** <https://discuss.elastic.co/t/template-for-new-attributes-of-an-index/87977>\
**Category:** Elasticsearch\
**Created:** [June 1, 2017, 8:02pm UTC](https://discuss.elastic.co/t/template-for-new-attributes-of-an-index/87977 "2017-06-01T20:02:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rory](https://avatars.discourse-cdn.com/v4/letter/r/a183cd/32.png) [@Rory](https://discuss.elastic.co/u/Rory)\
**Post date:** [June 1, 2017, 8:02pm UTC](https://discuss.elastic.co/t/template-for-new-attributes-of-an-index/87977/1 "2017-06-01T20:02:08Z")

</div>

Hi All,

I wanted to know if there is a feature in ElasticSearch that allows you to create a template for column names. If I wanted to define something like: All column names beginning with AAA\_ should be a keyword. For example if I already had 3 columns AAA\_1, AAA\_2, AAA\_3 defined as keyword. Is there a way for me to create a template that would make any new column that starts with AAA\_ to be a keyword?

Thanks.

---

<div class="post-metadata">

**Author:** ![dakrone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dakrone/32/23351_2.png) [@dakrone](https://discuss.elastic.co/u/dakrone)\
**Post date:** [June 1, 2017, 10:27pm UTC](https://discuss.elastic.co/t/template-for-new-attributes-of-an-index/87977/2 "2017-06-01T22:27:22Z")

</div>

You can do this with a dynamic mapping template, check out [https://www.elastic.co/guide/en/elasticsearch/reference/5.4/dynamic-templates.html#match-unmatch](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/dynamic-templates.html#match-unmatch)

Here's an example:

```
PUT my_index
{
  "mappings": {
    "my_type": {
      "dynamic_templates": [
        {
          "triple-a-keywords": {
            "match_mapping_type": "string",
            "match": "AAA_*",
            "mapping": {
              "type": "keyword"
            }
          }
        }
      ]
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![Rory](https://avatars.discourse-cdn.com/v4/letter/r/a183cd/32.png) [@Rory](https://discuss.elastic.co/u/Rory)\
**Post date:** [June 2, 2017, 4:36pm UTC](https://discuss.elastic.co/t/template-for-new-attributes-of-an-index/87977/3 "2017-06-02T16:36:41Z")

</div>

Thanks. This is what I was looking for!

---

<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:** [June 30, 2017, 4:36pm UTC](https://discuss.elastic.co/t/template-for-new-attributes-of-an-index/87977/4 "2017-06-30T16:36:45Z")

</div>

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