# Type template

**URL:** https://discuss.elastic.co/t/type-template/55996
**Category:** Elasticsearch
**Created:** [July 20, 2016, 2:36pm UTC](https://discuss.elastic.co/t/type-template/55996 "2016-07-20T14:36:55Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![muhamadli302](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@muhamadli302](https://discuss.elastic.co/u/muhamadli302)
#### Post date: [July 20, 2016, 2:36pm UTC](https://discuss.elastic.co/t/type-template/55996/1 "2016-07-20T14:36:55Z")

</div>

Hi,

is it possible to create a template for a type, not an index?  
for example, I have 2 indexes:

1. House, with types stairs and floors
2. Building, with types elevator and floors.  
And I want the floor mapping to have the same template...

Thanks for your help!

---

<div class="post-metadata">

### Author: ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)
#### Post date: [July 20, 2016, 2:59pm UTC](https://discuss.elastic.co/t/type-template/55996/2 "2016-07-20T14:59:18Z")

</div>

Hi @muhamadli302,

there is no such thing as a type template but depending on your requirements you may be able to use the [multi template matching](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html#multiple-templates) feature for that. I'd only do this if your match pattern is really simple (e.g. you can match all indices).

Daniel

---

<div class="post-metadata">

### Author: ![muhamadli302](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@muhamadli302](https://discuss.elastic.co/u/muhamadli302)
#### Post date: [July 20, 2016, 3:23pm UTC](https://discuss.elastic.co/t/type-template/55996/3 "2016-07-20T15:23:53Z")

</div>

Thanks, that sounds like a pretty good solution.  
But I have a question, what if the template for "\*" will have some definitions for "floors" type, but then I'll have an index with no "floor" type? what will happen to the mappings defined for "floors" when there is no such type in the index?

---

<div class="post-metadata">

### Author: ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)
#### Post date: [July 20, 2016, 3:27pm UTC](https://discuss.elastic.co/t/type-template/55996/4 "2016-07-20T15:27:37Z")

</div>

Hi @muhamadli302,

if you have a template that matches "\*" and it contains a mapping for the type "floor", all indices will have a mapping for this type.

If you don't want this, you need a more restrictive match than "\*". 🙂

Daniel

---

<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, 10:34pm UTC](https://discuss.elastic.co/t/type-template/55996/5 "2017-07-05T22:34:00Z")

</div>


