# Index template

**URL:** <https://discuss.elastic.co/t/index-template/5818>\
**Category:** Elasticsearch\
**Created:** [November 8, 2011, 8:52pm UTC](https://discuss.elastic.co/t/index-template/5818 "2011-11-08T20:52:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mehtryx](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@Mehtryx](https://discuss.elastic.co/u/Mehtryx)\
**Post date:** [November 8, 2011, 8:52pm UTC](https://discuss.elastic.co/t/index-template/5818/1 "2011-11-08T20:52:37Z")

</div>

I've created the following template:

$ curl '[http://myserver:9200/\_template/template\_1](http://myserver:9200/_template/template_1)' -d '  
{  
"template" : "\*",  
"order" : 0,  
"settings" : {  
"number\_of\_shards" : 5,  
"number\_of\_replicas" : 1  
},  
"analysis" : {  
"analyzer" : {  
"default" : {  
"type" : "keyword"  
}  
}  
},  
"mappings" : {  
"content" : {  
"Abstract" : {  
"type" : "string",  
"index" : "analyzed"  
},  
"Title" : {  
"type" : "string",  
"index" : "analyzed"  
},  
"SubTitle" : {  
"type" : "string",  
"index" : "analyzed"  
},  
"Body" : {  
"type" : "string",  
"index" : "analyzed"  
},  
"CreatedOn" : { "type" : "date" },  
"AvailableOn" : { "type" : "date" },  
"PubDate" : { "type" : "date" },  
"PublishedOn" : { "type" : "date" }  
}  
}  
}}'

2 Questions.....

#1 is this an appropriate spot to define the analyzer (assuming its  
want I want as default in my indexes) ?

#2 When I create a new index the mapping doesnt seem to apply, I try  
the following:

$ curl -XPUT '[http://myserver:9200/testthetemplate](http://myserver:9200/testthetemplate)'  
{"ok":true,"acknowledged":true}

$ curl '[http://ec2-107-22-54-249.compute-1.amazonaws.com:9200/](http://ec2-107-22-54-249.compute-1.amazonaws.com:9200/)  
testthetemplate/\_mapping'  
{"testthetemplate":{"content":{"properties":{}}}}

My template is blank...it sees the content type there but none of the  
fields are defined....further (in case it needed me to populate...)  
when I add data the mappings do not apply.

I'm using ES 0.18.2

Any help appreciated.

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [November 9, 2011, 8:36am UTC](https://discuss.elastic.co/t/index-template/5818/2 "2011-11-09T08:36:24Z")

</div>

Hi Mehtryx

On Tue, 2011-11-08 at 12:52 -0800, Mehtryx wrote:

> I've created the following template:

Please gist these curl statements instead of pasting into the email.  
See [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)

> $ curl '[http://myserver:9200/\_template/template\_1](http://myserver:9200/_template/template_1)' -d '  
> {  
> "template" : "\*",  
> "order" : 0,  
> "settings" : {  
> "number\_of\_shards" : 5,  
> "number\_of\_replicas" : 1  
> },  
> "analysis" : {  
> "analyzer" : {  
> "default" : {  
> "type" : "keyword"  
> }  
> }  
> },

The analysis section should be part of 'settings' - that's probably  
throwing the mapping off.

clint

---

<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:49am UTC](https://discuss.elastic.co/t/index-template/5818/5 "2017-07-06T03:49:16Z")

</div>


