# ElasticSearch - create template to match entity by an entity name pattern?

**URL:** <https://discuss.elastic.co/t/elasticsearch-create-template-to-match-entity-by-an-entity-name-pattern/28742>\
**Category:** Elasticsearch\
**Created:** [September 6, 2015, 1:43pm UTC](https://discuss.elastic.co/t/elasticsearch-create-template-to-match-entity-by-an-entity-name-pattern/28742 "2015-09-06T13:43:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stam585](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@stam585](https://discuss.elastic.co/u/stam585)\
**Post date:** [September 6, 2015, 1:43pm UTC](https://discuss.elastic.co/t/elasticsearch-create-template-to-match-entity-by-an-entity-name-pattern/28742/1 "2015-09-06T13:43:30Z")

</div>

Lets say I have this template

```
{
    "template" : "te*",
    "settings" : {
        "number_of_shards" : 1
    },
    "mappings" : {
        "type1" : {
            properties":{"TemplateField":{"enabled": false },.... }
        }
    }
}

```

It matches indices that match the pattern te\*.

I want inside the indice to match only entity type that there name is eqaul to TypeA, TypeB, TypeF

something that will look like

```
{
    "template" : "te*",
    "settings" : {
        "number_of_shards" : 1
    },
    "mappings" : {
        "typeA, TypeB, TypeC" : {
              properties":{"TemplateField":{"enabled": false },.... }
        }
    }
}
```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 7, 2015, 12:23am UTC](https://discuss.elastic.co/t/elasticsearch-create-template-to-match-entity-by-an-entity-name-pattern/28742/2 "2015-09-07T00:23:06Z")

</div>

You should be able to do that if you do it per field, or alternatively you can use a dynamic template - [https://www.elastic.co/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html#dynamic-templates](https://www.elastic.co/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html#dynamic-templates)

---

<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:** [July 5, 2017, 11:51pm UTC](https://discuss.elastic.co/t/elasticsearch-create-template-to-match-entity-by-an-entity-name-pattern/28742/3 "2017-07-05T23:51:53Z")

</div>


