我尝试进行批量更新
方法:发布 网址:/ customer / external / _bulk
Json Body:
{"index":{"_id":"1"}}
{"name": "John Doe" }
{"index":{"_id":"2"}}
{"name": "Jane Doe" }
Id 1已更新,但ID 2未更新。我不知道为什么?
回应在这里:
{
"took": 138,
"errors": false,
"items": [
{
"index": {
"_index": "customer",
"_type": "external",
"_id": "1",
"_version": 15,
"result": "updated",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"created": false,
"status": 200
}
}
]
}
答案 0 :(得分:1)
正如@Val所提到的,您应该在\n
正文的最后一行末尾添加换行符json
:
{"index":{"_id":"1"}}
{"name": "John Doe" }
{"index":{"_id":"2"}}
{"name": "Jane Doe" }\n
按照bulk_api中的提及。希望它有所帮助!