# Index templates not working

**URL:** https://discuss.elastic.co/t/index-templates-not-working/4390
**Category:** Elasticsearch
**Created:** [May 12, 2011, 1:36pm UTC](https://discuss.elastic.co/t/index-templates-not-working/4390 "2011-05-12T13:36:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Univ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/univ/32/3230_2.png) [@Univ](https://discuss.elastic.co/u/Univ)
#### Post date: [May 12, 2011, 1:36pm UTC](https://discuss.elastic.co/t/index-templates-not-working/4390/1 "2011-05-12T13:36:32Z")

</div>

Hello,

I have a few problems getting started with index templates, which  
don't seem to be working for me. I can't find where I made a mistake,  
and a little help would be very welcome :

# Index template

{  
'template': 'cy-data-w\*',  
'mappings': {  
'gitem': {  
'propreties': {  
'name': {  
'index': 'analyzed',  
'term\_vector': 'with\_position\_offset',  
'type': 'string'  
},  
'desc': {  
'index': 'analyzed',  
'term\_vector': 'with\_position\_offset',  
'type': 'string'  
},  
'location': {  
'type': 'geo\_point'  
},  
'language': {  
'type': 'string',  
'index': 'not\_analyzed'  
},  
'visibility': {  
'type': 'string',  
'index': 'not\_analyzed'  
},  
'policy': {  
'type': 'string',  
'index': 'not\_analyzed'  
},  
'owner': {  
'type': 'string',  
'index': 'not\_analyzed'  
},  
'created': {  
'type': 'date',  
'format': 'date\_optional\_time'  
},  
'status': {  
'type': 'string',  
'index': 'not\_analyzed'  
},  
'type': {  
'type': 'string',  
'index': 'not\_analyzed'  
},  
'item\_count': {  
'type': 'integer'  
}  
}  
}  
}  
}

# Sample indexed object in index cy-data-w2157

{  
'status': 'n',  
'visibility': 'v',  
'language': 'fr',  
'item\_count': 0,  
'owner': '4d122c9e777c577643000000',  
'desc': null,  
'name': 'AJS Ouistreham Handball',  
'created': '2011-05-11T16:36:20.237000',  
'location': [40.847059999999999, -111.884766],  
'policy': 'o',  
'type': 'g'  
}

# Command to add the template

> curl -XPUT localhost:9200/\_template/cy-data -d [mapping]  
> {"ok":true,"acknowledged":true}

# After indexing an object, I get the mapping

> curl -XGET '[http://localhost:9200/cy-data-w2157/gitem/\_mapping?pretty=true](http://localhost:9200/cy-data-w2157/gitem/_mapping?pretty=true)'  
> {  
> "gitem" : {  
> "properties" : {  
> "type" : {  
> "type" : "string"  
> },  
> "item\_count" : {  
> "type" : "long"  
> },  
> "location" : {  
> "type" : "double"  
> },  
> "status" : {  
> "type" : "string"  
> },  
> "visibility" : {  
> "type" : "string"  
> },  
> "created" : {  
> "format" : "dateOptionalTime",  
> "type" : "date"  
> },  
> "name" : {  
> "type" : "string"  
> },  
> "owner" : {  
> "type" : "string"  
> },  
> "policy" : {  
> "type" : "string"  
> },  
> "language" : {  
> "type" : "string"  
> }  
> }  
> }  
> }

Thanks for your help!

--  
Pierre

---

<div class="post-metadata">

### Author: ![Univ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/univ/32/3230_2.png) [@Univ](https://discuss.elastic.co/u/Univ)
#### Post date: [May 12, 2011, 8:42pm UTC](https://discuss.elastic.co/t/index-templates-not-working/4390/2 "2011-05-12T20:42:11Z")

</div>

Update: I posted the full commands used here : [http://paste.ofcode.org/37kruLNZ6jxTZUF464iMB2J](http://paste.ofcode.org/37kruLNZ6jxTZUF464iMB2J)  
Still not working, can't understand why.

On May 12, 3:36 pm, Univ [pierre.ma...@gmail.com](mailto:pierre.ma...@gmail.com) wrote:

> Hello,
> 
> I have a few problems getting started with index templates, which  
> don't seem to be working for me. I can't find where I made a mistake,  
> and a little help would be very welcome :
> 
> # Index template
> 
> {  
> 'template': 'cy-data-w\*',  
> 'mappings': {  
> 'gitem': {  
> 'propreties': {  
> 'name': {  
> 'index': 'analyzed',  
> 'term\_vector': 'with\_position\_offset',  
> 'type': 'string'  
> },  
> 'desc': {  
> 'index': 'analyzed',  
> 'term\_vector': 'with\_position\_offset',  
> 'type': 'string'  
> },  
> 'location': {  
> 'type': 'geo\_point'  
> },  
> 'language': {  
> 'type': 'string',  
> 'index': 'not\_analyzed'  
> },  
> 'visibility': {  
> 'type': 'string',  
> 'index': 'not\_analyzed'  
> },  
> 'policy': {  
> 'type': 'string',  
> 'index': 'not\_analyzed'  
> },  
> 'owner': {  
> 'type': 'string',  
> 'index': 'not\_analyzed'  
> },  
> 'created': {  
> 'type': 'date',  
> 'format': 'date\_optional\_time'  
> },  
> 'status': {  
> 'type': 'string',  
> 'index': 'not\_analyzed'  
> },  
> 'type': {  
> 'type': 'string',  
> 'index': 'not\_analyzed'  
> },  
> 'item\_count': {  
> 'type': 'integer'  
> }  
> }  
> }  
> }
> 
> }
> 
> # Sample indexed object in index cy-data-w2157
> 
> {  
> 'status': 'n',  
> 'visibility': 'v',  
> 'language': 'fr',  
> 'item\_count': 0,  
> 'owner': '4d122c9e777c577643000000',  
> 'desc': null,  
> 'name': 'AJS Ouistreham Handball',  
> 'created': '2011-05-11T16:36:20.237000',  
> 'location': [40.847059999999999, -111.884766],  
> 'policy': 'o',  
> 'type': 'g'
> 
> }
> 
> # Command to add the template\> curl -XPUT localhost:9200/\_template/cy-data -d [mapping]
> 
> {"ok":true,"acknowledged":true}
> 
> # After indexing an object, I get the mapping\> curl -XGET '[http://localhost:9200/cy-data-w2157/gitem/\_mapping?pretty=true](http://localhost:9200/cy-data-w2157/gitem/_mapping?pretty=true)'
> 
> {  
> "gitem" : {  
> "properties" : {  
> "type" : {  
> "type" : "string"  
> },  
> "item\_count" : {  
> "type" : "long"  
> },  
> "location" : {  
> "type" : "double"  
> },  
> "status" : {  
> "type" : "string"  
> },  
> "visibility" : {  
> "type" : "string"  
> },  
> "created" : {  
> "format" : "dateOptionalTime",  
> "type" : "date"  
> },  
> "name" : {  
> "type" : "string"  
> },  
> "owner" : {  
> "type" : "string"  
> },  
> "policy" : {  
> "type" : "string"  
> },  
> "language" : {  
> "type" : "string"  
> }  
> }  
> }
> 
> }
> 
> Thanks for your help!
> 
> --  
> Pierre

---

<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: [May 13, 2011, 11:02am UTC](https://discuss.elastic.co/t/index-templates-not-working/4390/3 "2011-05-13T11:02:22Z")

</div>

After a discussion on the mailing list, the two problems were typo in the properties name, and term\_vector value.  
On Thursday, May 12, 2011 at 11:42 PM, [pierre.matri@gmail.com](mailto:pierre.matri@gmail.com) wrote:

> Update: I posted the full commands used here : [http://paste.ofcode.org/37kruLNZ6jxTZUF464iMB2J](http://paste.ofcode.org/37kruLNZ6jxTZUF464iMB2J)  
> Still not working, can't understand why.
> 
> On May 12, 3:36 pm, Univ [pierre.ma...@gmail.com](mailto:pierre.ma...@gmail.com) wrote:
> 
> > Hello,
> > 
> > I have a few problems getting started with index templates, which  
> > don't seem to be working for me. I can't find where I made a mistake,  
> > and a little help would be very welcome :
> > 
> > # Index template
> > 
> > {  
> > 'template': 'cy-data-w\*',  
> > 'mappings': {  
> > 'gitem': {  
> > 'propreties': {  
> > 'name': {  
> > 'index': 'analyzed',  
> > 'term\_vector': 'with\_position\_offset',  
> > 'type': 'string'  
> > },  
> > 'desc': {  
> > 'index': 'analyzed',  
> > 'term\_vector': 'with\_position\_offset',  
> > 'type': 'string'  
> > },  
> > 'location': {  
> > 'type': 'geo\_point'  
> > },  
> > 'language': {  
> > 'type': 'string',  
> > 'index': 'not\_analyzed'  
> > },  
> > 'visibility': {  
> > 'type': 'string',  
> > 'index': 'not\_analyzed'  
> > },  
> > 'policy': {  
> > 'type': 'string',  
> > 'index': 'not\_analyzed'  
> > },  
> > 'owner': {  
> > 'type': 'string',  
> > 'index': 'not\_analyzed'  
> > },  
> > 'created': {  
> > 'type': 'date',  
> > 'format': 'date\_optional\_time'  
> > },  
> > 'status': {  
> > 'type': 'string',  
> > 'index': 'not\_analyzed'  
> > },  
> > 'type': {  
> > 'type': 'string',  
> > 'index': 'not\_analyzed'  
> > },  
> > 'item\_count': {  
> > 'type': 'integer'  
> > }  
> > }  
> > }  
> > }
> > 
> > }
> > 
> > # Sample indexed object in index cy-data-w2157
> > 
> > {  
> > 'status': 'n',  
> > 'visibility': 'v',  
> > 'language': 'fr',  
> > 'item\_count': 0,  
> > 'owner': '4d122c9e777c577643000000',  
> > 'desc': null,  
> > 'name': 'AJS Ouistreham Handball',  
> > 'created': '2011-05-11T16:36:20.237000',  
> > 'location': [40.847059999999999, -111.884766],  
> > 'policy': 'o',  
> > 'type': 'g'
> > 
> > }
> > 
> > # Command to add the template\> curl -XPUT localhost:9200/\_template/cy-data -d [mapping]
> > 
> > {"ok":true,"acknowledged":true}
> > 
> > # After indexing an object, I get the mapping\> curl -XGET '[http://localhost:9200/cy-data-w2157/gitem/\_mapping?pretty=true](http://localhost:9200/cy-data-w2157/gitem/_mapping?pretty=true)'
> > 
> > {  
> > "gitem" : {  
> > "properties" : {  
> > "type" : {  
> > "type" : "string"  
> > },  
> > "item\_count" : {  
> > "type" : "long"  
> > },  
> > "location" : {  
> > "type" : "double"  
> > },  
> > "status" : {  
> > "type" : "string"  
> > },  
> > "visibility" : {  
> > "type" : "string"  
> > },  
> > "created" : {  
> > "format" : "dateOptionalTime",  
> > "type" : "date"  
> > },  
> > "name" : {  
> > "type" : "string"  
> > },  
> > "owner" : {  
> > "type" : "string"  
> > },  
> > "policy" : {  
> > "type" : "string"  
> > },  
> > "language" : {  
> > "type" : "string"  
> > }  
> > }  
> > }
> > 
> > }
> > 
> > Thanks for your help!
> > 
> > --  
> > Pierre

---

<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, 4:06am UTC](https://discuss.elastic.co/t/index-templates-not-working/4390/4 "2017-07-06T04:06:19Z")

</div>


