我正在尝试进行批量更新
Method: Post Url: /customer/external/_bulk
Json 正文:
{"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
}
}
]
}
最佳答案
正如 @Val 提到的,您应该在 json
正文最后一行的末尾添加新行字符 \n
:
{"index":{"_id":"1"}}
{"name": "John Doe" }
{"index":{"_id":"2"}}
{"name": "Jane Doe" }\n
如 bulk_api 中所述。希望对您有帮助!
关于java - Elasticsearch 5.1 批量操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41443440/