# Creating template : Validation Failed: 1: template is missing;

**URL:** <https://discuss.elastic.co/t/creating-template-validation-failed-1-template-is-missing/119663>\
**Category:** Elasticsearch\
**Created:** [February 13, 2018, 3:12pm UTC](https://discuss.elastic.co/t/creating-template-validation-failed-1-template-is-missing/119663 "2018-02-13T15:12:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yoavsradware](https://avatars.discourse-cdn.com/v4/letter/y/e9c0ed/32.png) [@yoavsradware](https://discuss.elastic.co/u/yoavsradware)\
**Post date:** [February 13, 2018, 3:12pm UTC](https://discuss.elastic.co/t/creating-template-validation-failed-1-template-is-missing/119663/1 "2018-02-13T15:12:11Z")

</div>

Hi all  
I am new to ES , I am trying to create a basic template so when I am creating and indx start with the prefix ff\* it will have my mapping  
for example ff-first-index ff1-second-index will have the same index

I done  
PUT \_template/ff\_template  
{  
"index\_patterns": ["ff\*"],  
"settings": {  
"number\_of\_shards": 5  
},

```
  "dynamic": "false",
  "mappings": {
    "certificatecache": {
      "properties": {
        "device_ip": {
          "type": "keyword"
        },
        "device_name": {
          "type": "keyword"
        },
        "@timestamp": {
          "type": "date"
        },
        "device_id": {
          "type": "keyword"
        },
        "int64gap": {
          "type": "long"
        },
        "ingest_timestamp": {
          "type": "date"
        },
        "type": {
          "type": "keyword"
        },
        "delta_count": {
          "type": "long"
        },
        "int32value": {
          "type": "long"
        }
      }
    }
}

```

I also tried to do  
PUT \_template/template\_1

but allways fail on this :

```
{
  "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
}

```

Note that if I am not writing \_template and mentioning index (Put xxxx works for index x )it works but I would like this to be the template for all the indexs with the same start , any thoughts ?

---

<div class="post-metadata">

**Author:** ![johtani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johtani/32/44956_2.png) [@johtani](https://discuss.elastic.co/u/johtani)\
**Post date:** [February 13, 2018, 3:30pm UTC](https://discuss.elastic.co/t/creating-template-validation-failed-1-template-is-missing/119663/2 "2018-02-13T15:30:45Z")

</div>

What version of Es are you using? I assume you use before 6.0.  
There is changes in 6.0.  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking\_60\_indices\_changes.html#\_index\_templates\_use\_literal\_index\_patterns\_literal\_instead\_of\_literal\_template\_literal](https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal)

BTW, please format your code using \</\> icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

---

<div class="post-metadata">

**Author:** ![yoavsradware](https://avatars.discourse-cdn.com/v4/letter/y/e9c0ed/32.png) [@yoavsradware](https://discuss.elastic.co/u/yoavsradware)\
**Post date:** [February 13, 2018, 3:43pm UTC](https://discuss.elastic.co/t/creating-template-validation-failed-1-template-is-missing/119663/3 "2018-02-13T15:43:00Z")

</div>

I found the issue :  
apparently I weren't using the template field .... and therefore I fall on schema validation ...

---

<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:** [March 13, 2018, 3:43pm UTC](https://discuss.elastic.co/t/creating-template-validation-failed-1-template-is-missing/119663/4 "2018-03-13T15:43:17Z")

</div>

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