Set _id field when creating index template

I want to use index template when creating index in elasticsearch.
I saw that we can set _id field with specific field when creating index.
(https://www.elastic.co/guide/en/elasticsearch/reference/1.4/mapping-id-field.html)

Is it possible to set _id field when creating index template like this way?
For example, suppose that I want to set _id as "tag_seq" field when creating index template..

PUT _template/template_1
{
  "index_patterns": ["te*", "bar*"],
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
    "_source": {
      "enabled": false
    },
    "properties": {
      "host_name": {
        "type": "keyword"
      },
      "tag_seq" : {
        "type" : "integer"
      },
      "created_at": {
        "type": "date",
        "format": "EEE MMM dd HH:mm:ss Z yyyy"
      },
      "_id" : {
        "path" : "tag_seq",
        "type" : "integer"
      }
       
    }
  }
}

I tried to use the script above, but it gives me an error...

What version of the elasticsearch stack are you using and what error are you getting?

My elasticsearch version is 7.3.2 and
I've got the error below.

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "No type specified for field [_id]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping [_doc]: No type specified for field [_id]",
    "caused_by": {
      "type": "mapper_parsing_exception",
      "reason": "No type specified for field [_id]"
    }
  },
  "status": 400
}

Without the _id setting part

"_id" : {
        "path" : "tag_seq",
        "type" : "integer"
      }

it works fine. Any Ideas?

Sorry I missed your response, did you resolve this?

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