【发布时间】:2020-01-27 14:15:58
【问题描述】:
'{"error":{"root_cause":[{"type":"invalid_type_name_exception","reason":"Document mapping type name can\'t start with \'_\', found: [_update]"}],"type":"invalid_type_name_exception","reason":"Document mapping type name can\'t start with \'_\', found: [_update]"},"status":400}',
在使用elasticsearch更新索引时在elasticsearch中发出更新请求时收到上述错误,而下面是我正在传递的JSON数据。
{ name: 'TESTIN ONE (3)',
id: 'PUZb8739273HD83DGE',
titles:
[ { id: 21, title: 'FALSELY ACCUSED' },
{ id: 21, title: 'FALSELY ACCUSED' },
{ id: 23, title: undefined } ] }
这也是我正在通过的函数
updateProjectIndex = async (project) => {
try {
const result = await client.update({
index: "updatedproject",
type: "_doc",
id: project.id,
refresh: 'true',
body: project,
});
return result;
}
catch (e) {
console.log(e);
}
}
在这个函数的参数中,我在 JSON 之上传递。
错误
"error": {
"root_cause": [
{
"type": "document_missing_exception",
"reason": "[_doc][5d8de6a0806590a27895f971]: document missing",
"index_uuid": "j26lRI1UTJuJmHw_GuPSxg",
"shard": "0",
"index": "docprojectnew"
}
],
"type": "document_missing_exception",
"reason": "[_doc][5d8de6a0806590a27895f971]: document missing",
"index_uuid": "j26lRI1UTJuJmHw_GuPSxg",
"shard": "0",
"index": "docprojectnew"
},
"status": 404 }
project的值
{ projectName:
'NEW UPDATE DATA (3)',
id: '5d8de6a0806590a27895f971',
titles:
[ { id: 5d88afc8e9896c1ca7f2c065, title: 'FALSELY ACCUSED' },
{ id: 5d88afc8e9896c1ca7f2c065, title: 'FALSELY ACCUSED' },
{ id: 5d5eeb2ec300364d48764f78, title: undefined } ] }
【问题讨论】:
-
类型:“_doc”。你可以试试 doc 代替 _doc 看看它是否有效
-
@jaspreetchahal 相同问题
-
@Farhan,你能不能试试把更新函数中的“type”参数去掉试试?
-
@AbhilashBolla 也这样做了,但没有运气
-
@jaspreetchahal
[UpdateRequest] unknown field [name], parser not found最近遇到了这个错误
标签: javascript node.js json elasticsearch