# How to create a mapping that apply to index with dynamic name like "index-%{YYYYMMDD}"

**URL:** <https://discuss.elastic.co/t/how-to-create-a-mapping-that-apply-to-index-with-dynamic-name-like-index-yyyymmdd/159345>\
**Category:** Elasticsearch\
**Created:** [December 4, 2018, 11:19am UTC](https://discuss.elastic.co/t/how-to-create-a-mapping-that-apply-to-index-with-dynamic-name-like-index-yyyymmdd/159345 "2018-12-04T11:19:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![guibarati](https://avatars.discourse-cdn.com/v4/letter/g/848f3c/32.png) [@guibarati](https://discuss.elastic.co/u/guibarati)\
**Post date:** [December 4, 2018, 11:19am UTC](https://discuss.elastic.co/t/how-to-create-a-mapping-that-apply-to-index-with-dynamic-name-like-index-yyyymmdd/159345/1 "2018-12-04T11:19:36Z")

</div>

I'm using logstash to create new indices every day using the current date, but every time it does, the new index create new fields considering everything as "string".  
How can I configure my mapping, so when a new index is created it configure the fields with the right data type?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [December 4, 2018, 11:32am UTC](https://discuss.elastic.co/t/how-to-create-a-mapping-that-apply-to-index-with-dynamic-name-like-index-yyyymmdd/159345/2 "2018-12-04T11:32:29Z")

</div>

Create an [index template](https://www.elastic.co/guide/en/elasticsearch/reference/6.5/indices-templates.html) that applies to all indices matching e.g. the `index*` pattern.

---

<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:** [January 1, 2019, 11:32am UTC](https://discuss.elastic.co/t/how-to-create-a-mapping-that-apply-to-index-with-dynamic-name-like-index-yyyymmdd/159345/3 "2019-01-01T11:32:29Z")

</div>

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