Elasticsearch 5.1 批量操作
Elasticsearch 5.1 Bulk Action
我正在尝试进行批量更新
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 所述。希望对您有所帮助!
我正在尝试进行批量更新
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 所述。希望对您有所帮助!