elasticsearch 使用_idelasticsearch更新文档
我试图用
elasticsearch 使用_idelasticsearch更新文档,
elasticsearch,
elasticsearch,我试图用\u id更新文档 POST http://example.org/testrest/_update/X3flr2oB9Don9XlKX05E 这是文档的一部分: "hits": [ { "_index": "testrest", "_type": "testrest", "_id": "X3flr2oB9Don9XlKX05E", "_score": 0,
\u id
更新文档
POST http://example.org/testrest/_update/X3flr2oB9Don9XlKX05E
这是文档的一部分:
"hits": [
{
"_index": "testrest",
"_type": "testrest",
"_id": "X3flr2oB9Don9XlKX05E",
"_score": 0,
"_source": {
"price_diff_per_sys": "199.8999",
"specs": "",
"gtin_match": "0",
"human_verdict": "Awaiting",
以下是请求主体:
{
"doc": {
"human_verdict": "Match"
}
}
但是我得到了这个错误:
{
"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
}
如何使用
\u id
更新文档?URL格式没有错误,请求正文需要是有效的JSON,如下所示:
POST http://example.org/testrest/testrest/X3flr2oB9Don9XlKX05E/_update
{
"doc": {
"human_verdict": "Match"
}
}
错误消息清楚地表明您传递了错误的
\u type
名称,在您的情况下,它是\u update
,正如错误消息中所说,简而言之,它不能以\u
开头。把它换成别的东西,它应该会工作
原因“:”文档映射类型名称不能以“\u1”开头,找到:
[_更新]”
POST应该可以工作,正如我在您的负载中注意到的,indexname和type都是相同的
"_index": "testrest",
"_type": "testrest",
您正在使用哪个es版本他仍然需要点击URL末尾的
\u update
端点