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

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 ?

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

BTW, please format your code using </> icon as explained in this guide and not the citation button. It will make your post more readable.

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

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