elasticsearch7.2.0版本,在kibnan操作的
执行如下操作就会报错
PUT myindex/_doc/18
{
"name": "pipeline",
"dat3":"测试",
"msg": "123",
"ab":{
"content":{
"c":"564654123"
}
},
"newFile2":{
"name":{
"id":"564654123"
}
},
"newFile1":"111"
}```
报错信息
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to parse field [newFile2] of type [text] in document with id '18'"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to parse field [newFile2] of type [text] in document with id '18'",
"caused_by": {
"type": "illegal_state_exception",
"reason": "Can't get text on a START_OBJECT at 10:14"
}
},
"status": 400
}
但是吧newFile2变成newFile3,newFile1变成newFile5就正常添加了,没有问题
PUT myindex/_doc/18
{
"name": "pipeline",
"dat3":"测试",
"msg": "123",
"ab":{
"content":{
"c":"564654123"
}
},
"newFile3":{
"name":{
"id":"564654123"
}
},
"newFile5":"111"
}
这是什么原因呢
执行如下操作就会报错
PUT myindex/_doc/18
{
"name": "pipeline",
"dat3":"测试",
"msg": "123",
"ab":{
"content":{
"c":"564654123"
}
},
"newFile2":{
"name":{
"id":"564654123"
}
},
"newFile1":"111"
}```
报错信息
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to parse field [newFile2] of type [text] in document with id '18'"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to parse field [newFile2] of type [text] in document with id '18'",
"caused_by": {
"type": "illegal_state_exception",
"reason": "Can't get text on a START_OBJECT at 10:14"
}
},
"status": 400
}
但是吧newFile2变成newFile3,newFile1变成newFile5就正常添加了,没有问题
PUT myindex/_doc/18
{
"name": "pipeline",
"dat3":"测试",
"msg": "123",
"ab":{
"content":{
"c":"564654123"
}
},
"newFile3":{
"name":{
"id":"564654123"
}
},
"newFile5":"111"
}
这是什么原因呢
1 个回复
liuxg - Elastic
赞同来自:
PUT myindex/_doc/18
{
"name": "pipeline",
"dat3": "测试",
"msg": "123",
"ab": {
"content": {
"c": "564654123"
}
},
"newFile2": {
"name": {
"id": "564654123"
}
},
"newFile1": "111"
}
这个返回是没有任何问题的:
我觉得你可以先做如下的操作:
GET myindex/_mapping
看看一下newFile2字段的数据类型。如果是这次传入的类型和之前的不同,也会报错。
另外,可以做如下的操作:
DELETE myindex
然后在运行上面的PUT指令