是时候用 ES 拯救发际线啦

es5.2.2 为什么 不能修改mapping

Elasticsearch | 作者 65725738 | 发布于2017年03月12日 | 阅读数:5856

本来的mapping是这样

{
"test1": {
"mappings": {
"user": {
"properties": {
"name": {
"type": "text"
}
}
},
"tweet": {
"properties": {
"message": {
"type": "text"
}
}
}
}
}
}


现在
PUT test1
{
"mappings": {
"user": {
"properties": {
"user_id": {
"type": "keyword"
}
}
}
}
}

报错
{
"error": {
"root_cause": [
{
"type": "index_already_exists_exception",
"reason": "index [test1/ltOHE8krQX2Tb0hMfGVaQg] already exists",
"index_uuid": "ltOHE8krQX2Tb0hMfGVaQg",
"index": "test1"
}
],
"type": "index_already_exists_exception",
"reason": "index [test1/ltOHE8krQX2Tb0hMfGVaQg] already exists",
"index_uuid": "ltOHE8krQX2Tb0hMfGVaQg",
"index": "test1"
},
"status": 400
}



网上说可以在一个类型里面增加新字段。不能修改原有字段。 我现在是新增一个字段,也报错呀。
已邀请:

65725738

赞同来自:

没人知道?

medcl - 今晚打老虎。

赞同来自:

修改 mapping 的方式不对
PUT test1/类型/_mapping
{
该类型的mapping 内容
}
 

要回复问题请先登录注册