# Create type for using in different indexes

**URL:** <https://discuss.elastic.co/t/create-type-for-using-in-different-indexes/38480>\
**Category:** Elasticsearch\
**Created:** [January 6, 2016, 8:50am UTC](https://discuss.elastic.co/t/create-type-for-using-in-different-indexes/38480 "2016-01-06T08:50:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Igor\_Samusenko](https://avatars.discourse-cdn.com/v4/letter/i/13edae/32.png) [@Igor\_Samusenko](https://discuss.elastic.co/u/Igor_Samusenko)\
**Post date:** [January 6, 2016, 8:50am UTC](https://discuss.elastic.co/t/create-type-for-using-in-different-indexes/38480/1 "2016-01-06T08:50:45Z")

</div>

Hi everybody,  
We're gonna use logstash + elasticsearch to store logs.  
Indexes gonna be created as "name-%{+[YYYY.MM](http://YYYY.MM)}". I have custom mapping for log type.  
Do I have to create mapping for type before creating index every new month, or there is easer way to map type only once and use the same type within every new index ?

---

<div class="post-metadata">

**Author:** ![drixen](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@drixen](https://discuss.elastic.co/u/drixen)\
**Post date:** [January 6, 2016, 9:50am UTC](https://discuss.elastic.co/t/create-type-for-using-in-different-indexes/38480/2 "2016-01-06T09:50:29Z")

</div>

Hello,

I think the best thing to do is to create an index template.  
You set your mapping once and it will be applied each time a new index is created.

[https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html)

Antoine

---

<div class="post-metadata">

**Author:** ![Igor\_Samusenko](https://avatars.discourse-cdn.com/v4/letter/i/13edae/32.png) [@Igor\_Samusenko](https://discuss.elastic.co/u/Igor_Samusenko)\
**Post date:** [January 6, 2016, 10:06am UTC](https://discuss.elastic.co/t/create-type-for-using-in-different-indexes/38480/3 "2016-01-06T10:06:35Z")

</div>

Yeah! Thank you, I am already looking to that.

---

<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:26pm UTC](https://discuss.elastic.co/t/create-type-for-using-in-different-indexes/38480/4 "2017-07-05T23:26:46Z")

</div>


