本来的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
}
网上说可以在一个类型里面增加新字段。不能修改原有字段。 我现在是新增一个字段,也报错呀。
{
"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
}
网上说可以在一个类型里面增加新字段。不能修改原有字段。 我现在是新增一个字段,也报错呀。
2 个回复
65725738
赞同来自:
medcl - 今晚打老虎。
赞同来自:
PUT test1/类型/_mapping
{
该类型的mapping 内容
}