使用 Elasticsearch Bulk API /_bulk批量 update
movie type 的名词列表到 wordbank index 索引。index, create, delete and update 中的一个。
接下来准备这样的数据:
{"index": {"_index": "wordbank", "_type": "movie", "_id": 1}} {"doc": {"name": "权力的游戏"}} {"index": {"_index": "wordbank", "_type": "movie", "_id": 2}} {"doc": {"name": "熊出没"}}
\n结尾,也就是需要一个空行。-H 'Content-Type: application/json' "doc" 字典下,另外 update 在这里就只是 update,如果文档不存在会报错。{ "field1" : "value1", "field2" : "value2" } --> { "doc" : { "field1" : "value1", "field2" : "value2" } }
-s 也silent 模式是不会把这个结果去掉的,因为 -s 是 curl 的参数,会屏蔽掉 curl 的 log,但 Elasticsearch 的返回 json 是不会被屏蔽掉的。