# Define one mapping for multiple indices

**URL:** https://discuss.elastic.co/t/define-one-mapping-for-multiple-indices/46591
**Category:** Elasticsearch
**Created:** [April 6, 2016, 7:52pm UTC](https://discuss.elastic.co/t/define-one-mapping-for-multiple-indices/46591 "2016-04-06T19:52:32Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sharon.c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharon.c/32/16076_2.png) [@sharon.c](https://discuss.elastic.co/u/sharon.c)
#### Post date: [April 6, 2016, 7:52pm UTC](https://discuss.elastic.co/t/define-one-mapping-for-multiple-indices/46591/1 "2016-04-06T19:52:32Z")

</div>

Hi I have logstash forwarding data to elasticsearch, it generates 1 index each day. How do I define one mapping for the all the indices ?

Currently, I am using the following mapping defined in sense script, just for one index  
PUT /elkstats\_record\_clicks  
{  
"settings": {  
"number\_of\_shards" : 8,  
"number\_of\_replicas" : 1  
},  
"mappings" : {  
"log" : {  
...  
}  
}  
}

But I plan to generate 1 index everyday, my logstash output will be like this:  
output {  
elasticsearch {  
hosts =\> "staging-elkstack:9200"  
index =\> "elkstats\_record\_clicks\_%{+YYYY.MM.dd}"  
template\_name =\> "log"  
manage\_template =\> false  
}  
}

Because the index name changes every day, how can I define a mapping which fits all the index files ?

---

<div class="post-metadata">

### Author: ![thn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thn/32/8061_2.png) [@thn](https://discuss.elastic.co/u/thn)
#### Post date: [April 6, 2016, 8:02pm UTC](https://discuss.elastic.co/t/define-one-mapping-for-multiple-indices/46591/2 "2016-04-06T20:02:00Z")

</div>

You can find the info at the link below, replace **"te"** with **"elkstats\_record\_clicks"**

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

---

<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:01pm UTC](https://discuss.elastic.co/t/define-one-mapping-for-multiple-indices/46591/3 "2017-07-05T23:01:44Z")

</div>


