"_doc" mapping type name not accepted in ElasticSearch 5.6 "_doc" mapping type name not accepted in ElasticSearch 5.6 elasticsearch elasticsearch

"_doc" mapping type name not accepted in ElasticSearch 5.6


The document I linked to is the master version. In the 6.1 or 5.6 versions of that same document, there is no mention of _doc being the preferred name; which likely means that the ability to use _doc as a mapping type name will come with future 6.x versions.


I got the same issue while trying examples in the readme file from master branch https://github.com/elastic/elasticsearch/tree/master.

$ curl -XPUT 'elastic:@localhost:9200/twitter/_doc/1?pretty' -H 'Content-Type: application/json' -d '{    "user": "kimchy",    "post_date": "2009-11-15T13:12:00",    "message": "Trying out Elasticsearch, so far so good?"}'{  "error" : {    "root_cause" : [      {        "type" : "invalid_type_name_exception",        "reason" : "Document mapping type name can't start with '_', found: [_doc]"      }    ],    "type" : "invalid_type_name_exception",    "reason" : "Document mapping type name can't start with '_', found: [_doc]"  },  "status" : 400}

Just checkout to the branch for version 5.6 https://github.com/elastic/elasticsearch/tree/5.6 and it looks everything is fine.

$ curl -XPUT 'http://localhost:9200/twitter/user/kimchy?pretty' -H 'Content-Type: application/json' -d '{ "name" : "Shay Banon" }'{  "_index" : "twitter",  "_type" : "user",  "_id" : "kimchy",  "_version" : 1,  "result" : "created",  "_shards" : {    "total" : 2,    "successful" : 1,    "failed" : 0  },  "created" : true}