# Global template for all indices and types

**URL:** <https://discuss.elastic.co/t/global-template-for-all-indices-and-types/6346>\
**Category:** Elasticsearch\
**Created:** [January 11, 2012, 1:45pm UTC](https://discuss.elastic.co/t/global-template-for-all-indices-and-types/6346 "2012-01-11T13:45:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wojciech\_Durczynski](https://avatars.discourse-cdn.com/v4/letter/w/fbc32d/32.png) [@Wojciech\_Durczynski](https://discuss.elastic.co/u/Wojciech_Durczynski)\
**Post date:** [January 11, 2012, 1:45pm UTC](https://discuss.elastic.co/t/global-template-for-all-indices-and-types/6346/1 "2012-01-11T13:45:22Z")

</div>

Hello.

Is there a possibility to create a template such that all new types in all  
new indices will have a specific mapping?

I'd like to disable analyzing of all string fields.  
For particular index/type it's easy to put mapping:  
{ "typeName" : {  
"dynamic\_templates" : [  
{  
"no\_analyze\_strings" : {  
"match\_mapping\_type" : "string",  
"match" : "\*",  
"mapping" : {  
"type" : "string",  
"index" : "not\_analyzed"  
}  
}  
}]  
}}

But how to define a template cluster-wide that will apply this mapping to  
all new types?

Regards  
Wojciech Durczyński

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 11, 2012, 6:08pm UTC](https://discuss.elastic.co/t/global-template-for-all-indices-and-types/6346/2 "2012-01-11T18:08:03Z")

</div>

Create an index template (  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-templates.html))  
matching \*, with a single mapping, of type _default_, with the below  
dynamic templates. Should work.

2012/1/11 Wojciech Durczyński [wojciech.durczynski@comarch.com](mailto:wojciech.durczynski@comarch.com)

> Hello.
> 
> Is there a possibility to create a template such that all new types in all  
> new indices will have a specific mapping?
> 
> I'd like to disable analyzing of all string fields.  
> For particular index/type it's easy to put mapping:  
> { "typeName" : {  
> "dynamic\_templates" : [  
> {  
> "no\_analyze\_strings" : {  
> "match\_mapping\_type" : "string",  
> "match" : "\*",  
> "mapping" : {  
> "type" : "string",  
> "index" : "not\_analyzed"  
> }  
> }  
> }]  
> }}
> 
> But how to define a template cluster-wide that will apply this mapping to  
> all new types?
> 
> Regards  
> Wojciech Durczyński

---

<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 6, 2017, 3:43am UTC](https://discuss.elastic.co/t/global-template-for-all-indices-and-types/6346/3 "2017-07-06T03:43:03Z")

</div>


