I am looking at examples of single-type indices on ElasticSearch 5.6 to prepare for the removal of mapping types. Specifically, I am running the first example from the ElasticSearch page about the removal of types, on a fresh cluster running locally in Docker using the docker.elastic.co/elasticsearch/elasticsearch:5.6.5
image
Running the first example from section I linked to:
PUT localhost:9200/users
{
"settings": {
"index.mapping.single_type": true
},
"mappings": {
"_doc": {
"properties": {
"name": {
"type": "text"
},
"user_name": {
"type": "keyword"
},
"email": {
"type": "keyword"
}
}
}
}
}
I get the following error:
{
"error": {
"root_cause": [
{
"type": "invalid_type_name_exception",
"reason": "mapping type name [_doc] can't start with '_'"
}
],
"type": "invalid_type_name_exception",
"reason": "mapping type name [_doc] can't start with '_'"
},
"status": 400
}
I understand that fields with a leading underscore in the name are generally considered as reserved for ES internals; but I was assuming that _doc
would be considered a special case starting with version 5.6
, since the linked guide mentions:
Indices created in 6.x only allow a single-type per index. Any name can be used for the type, but there can be only one. The preferred type name is _doc so that index APIs have the same path as they will have in 7.0
Am I missing something, such as a cluster setting?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With