一、操作
进行文档更新操作
POST test_001/1
{
"id": "1",
"goodsName": "testa",
"goodsInfo": "xian",
"shopId": 1,
"putSaleTime": "2020-09-08 14:29:06",
"isDelete": false,
"couponIds": "1,2"
}
二、现象(错误信息)
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "mapper [goodsName.keyword] of different type, current_type [text], merged_type [keyword]"
}
],
"type" : "illegal_argument_exception",
"reason" : "mapper [goodsName.keyword] of different type, current_type [text], merged_type [keyword]"
},
"status" : 400
}
三、原因
引起这个错误的原因可能有多个,但此次我的原因是,进行文档更新的时候,没有_doc关键字
四、解决
进行文档更新的时候,加上_doc关键字
POST test_001/_doc/1
{
"id": "1",
"goodsName": "testa",
"goodsInfo": "xian",
"shopId": 1,
"putSaleTime": "2020-09-08 14:29:06",
"isDelete": false,
"couponIds": "1,2"
}