在 elasticsearch 中,/doc/_mapping 和 /doc {"mappings"...} 有什么不同
In elasticsearch, what's different between /doc/_mapping and /doc {"mappings"...}
我对 elasticsearch 映射感到困惑
首先,我创建了一个带有映射请求的文档
PUT /person
{
"mappings":{
"properties":{
"firstname":{
"type":"text"
}
}
}
}
然后,我想添加新的 属性 “lastname”,为此我 PUT
PUT /person
{
"mappings":{
"properties":{
"lastname":{
"type":"text"
}
}
}
}
不幸的是,异常阻止了我
{
"error": {
"root_cause": [
{
"type": "resource_already_exists_exception",
"reason": "index [person/5TWopRJaQ3Clam2TiteuHg] already exists",
"index_uuid": "5TWopRJaQ3Clam2TiteuHg",
"index": "person"
}
],
"type": "resource_already_exists_exception",
"reason": "index [person/5TWopRJaQ3Clam2TiteuHg] already exists",
"index_uuid": "5TWopRJaQ3Clam2TiteuHg",
"index": "person"
},
"status": 400
}
它试图告诉我索引存在,我无法更新它。
但如果我使用,
PUT /person/_mapping
{
"properties":{
"lastname":{
"type":"text"
}
}
}
有效,“lastname”被添加到映射中。
/person/ {mappings:...}
和/person/_mapping {...}
有什么区别?
都是PUT方法,难道不应该一样吗?
或者/person/ {mappings:...}
只能在创建时使用,而/person/_mapping {...}
只能更新已有的?
不是很有道理。这里有什么技巧?
https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html
Indices created in Elasticsearch 7.0.0 or later no longer accept a _default_ mapping. Indices created in 6.x will continue to function as before in Elasticsearch 6.x. Types are deprecated in APIs in 7.0, with breaking changes to the index creation, put mapping, get mapping, put template, get template and get field mappings APIs.
因此,映射支持在 ES 7 中已弃用,并将在 ES 8 中删除
我对 elasticsearch 映射感到困惑
首先,我创建了一个带有映射请求的文档
PUT /person
{
"mappings":{
"properties":{
"firstname":{
"type":"text"
}
}
}
}
然后,我想添加新的 属性 “lastname”,为此我 PUT
PUT /person
{
"mappings":{
"properties":{
"lastname":{
"type":"text"
}
}
}
}
不幸的是,异常阻止了我
{
"error": {
"root_cause": [
{
"type": "resource_already_exists_exception",
"reason": "index [person/5TWopRJaQ3Clam2TiteuHg] already exists",
"index_uuid": "5TWopRJaQ3Clam2TiteuHg",
"index": "person"
}
],
"type": "resource_already_exists_exception",
"reason": "index [person/5TWopRJaQ3Clam2TiteuHg] already exists",
"index_uuid": "5TWopRJaQ3Clam2TiteuHg",
"index": "person"
},
"status": 400
}
它试图告诉我索引存在,我无法更新它。
但如果我使用,
PUT /person/_mapping
{
"properties":{
"lastname":{
"type":"text"
}
}
}
有效,“lastname”被添加到映射中。
/person/ {mappings:...}
和/person/_mapping {...}
有什么区别?
都是PUT方法,难道不应该一样吗?
或者/person/ {mappings:...}
只能在创建时使用,而/person/_mapping {...}
只能更新已有的?
不是很有道理。这里有什么技巧?
https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html
Indices created in Elasticsearch 7.0.0 or later no longer accept a _default_ mapping. Indices created in 6.x will continue to function as before in Elasticsearch 6.x. Types are deprecated in APIs in 7.0, with breaking changes to the index creation, put mapping, get mapping, put template, get template and get field mappings APIs.
因此,映射支持在 ES 7 中已弃用,并将在 ES 8 中删除