# "Validation Failed: 1: template is missing;

**URL:** https://discuss.elastic.co/t/validation-failed-1-template-is-missing/70180
**Category:** Elasticsearch
**Created:** [December 29, 2016, 4:27am UTC](https://discuss.elastic.co/t/validation-failed-1-template-is-missing/70180 "2016-12-29T04:27:15Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![aliahsan81](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@aliahsan81](https://discuss.elastic.co/u/aliahsan81)
#### Post date: [December 29, 2016, 4:27am UTC](https://discuss.elastic.co/t/validation-failed-1-template-is-missing/70180/1 "2016-12-29T04:27:15Z")

</div>

I am new to ELK, I am copying existing logstash-\* template and making new one with an other name. After changing template name when i PUT template back it give me following error

I am using ELK 5.1.1

curl -XPUT localhost:9200/\_template/example.com?pretty -d @logstash.json  
{  
"[example.com](http://example.com)" : {  
"order" : 0,  
"version" : 50001,  
"template" : "example.com-_",  
"settings" : {  
"index" : {  
"refresh\_interval" : "5s"  
}  
},  
"mappings" : {  
"default" : {  
"dynamic\_templates" : [  
{  
"message\_field" : {  
"path\_match" : "message",  
"mapping" : {  
"norms" : false,  
"type" : "text"  
},  
"match\_mapping\_type" : "string"  
}  
},  
{  
"string\_fields" : {  
"mapping" : {  
"norms" : false,  
"type" : "text",  
"fields" : {  
"keyword" : {  
"type" : "keyword"  
}  
}  
},  
"match\_mapping\_type" : "string",  
"match" : "_"  
}  
}  
],  
"\_all" : {  
"norms" : false,  
"enabled" : true  
},  
"properties" : {  
"@timestamp" : {  
"include\_in\_all" : false,  
"type" : "date"  
},  
"geoip" : {  
"dynamic" : true,  
"properties" : {  
"ip" : {  
"type" : "ip"  
},  
"latitude" : {  
"type" : "half\_float"  
},  
"location" : {  
"type" : "geo\_point"  
},  
"longitude" : {  
"type" : "half\_float"  
}  
}  
},  
"@version" : {  
"include\_in\_all" : false,  
"type" : "keyword"  
}  
}  
}  
},  
"aliases" : { }  
}  
}

# Error

{  
"error" : {  
"root\_cause" : [  
{  
"type" : "action\_request\_validation\_exception",  
"reason" : "Validation Failed: 1: template is missing;"  
}  
],  
"type" : "action\_request\_validation\_exception",  
"reason" : "Validation Failed: 1: template is missing;"  
},  
"status" : 400  
}

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [December 29, 2016, 9:07am UTC](https://discuss.elastic.co/t/validation-failed-1-template-is-missing/70180/2 "2016-12-29T09:07:24Z")

</div>

Hey,

please use proper formatting in your messages. This is pretty hard to read.

When you compare your JSON with the one mentioned in [the documentation](https://www.elastic.co/guide/en/elasticsearch/reference/5.1/indices-templates.html#getting), you will notice, that yours is missing a field called `template`, which defines the indices this template should be assigned to. That's what is meant with the failed validation.

--Alex

---

<div class="post-metadata">

### Author: ![aliahsan81](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@aliahsan81](https://discuss.elastic.co/u/aliahsan81)
#### Post date: [December 29, 2016, 9:34am UTC](https://discuss.elastic.co/t/validation-failed-1-template-is-missing/70180/3 "2016-12-29T09:34:30Z")

</div>

Thanks I have removed this part that fixed the issue

\<  
{  
"[example.com](http://example.com)" : {  
"order" : 0,  
"version" : 50001,  
/\>

---

<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 26, 2017, 9:34am UTC](https://discuss.elastic.co/t/validation-failed-1-template-is-missing/70180/4 "2017-01-26T09:34:49Z")

</div>

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