Index Templates - Differences between _template & _index_template

Hello everyone,

Need help to identify the differences between the subject mentioned endpoints usage.

_index_template endpoint

 POST _index_template/index-template-1
{
  "index_patterns": ["logs-2019*"],
  "template": {
    "mappings": {"properties":
    {
    "v1":{"type":"short"},
    "timestamp": {"type": "date","format": "strict_date"}}}
 }
}

_template endpoint

POST _template/i_master_template2
{
 "index_patterns":["logs-2020*"],
  "mappings": {"properties":
    {
    "v1":{"type":"short"},
    "timestamp": {"type": "date","format": "strict_date"}}}
  }
}   

Though the previous request were successful, when running GET _index_template it only returns one of the recently created index templates.

{
  "index_templates" : [
    {
      "name" : "index-template-1",
  "index_template" : {
    "index_patterns" : [
      "logs-2019*"
    ],
    "template" : {
      "mappings" : {
        "properties" : {
          "v1" : {
            "type" : "short"
          },
          "timestamp" : {
            "format" : "strict_date",
            "type" : "date"
          }
        }
      }
    },
    "composed_of" : [ ]
}
]
}

The _template is legacy. See

This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. For information about composable templates, Index templates .

Thanks David!

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