ElasticSearch (2) – Bulk Document CRUD (批量)
批量创建
同时创建ID 4和5的数据
POST people/_bulk {"create": {"_id": 4}} {"name":"kiat","age":23} {"create": {"_id": 5}} {"name":"kia44t","age":23}
批量插入
使用index,如果id存在的话就会删除,然后重新创建新的,并且版本号是增加的
POST people/_bulk {"index": {"_id": 4}} {"name":"kiat","age":23} {"index": {"_id": 5}} {"name":"kia44t","age":23}
批量修改
POST people/_bulk {"update": {"_id": 4}} {"doc":{"age":9}} {"update": {"_id": 5}} {"doc":{"age":5}}
批量删除
POST people/_bulk {"delete": {"_id": 4}} {"delete": {"_id": 5}}
批量混合操作
POST people/_bulk {"index": {"_id": 4}} {"name":"kiat","age":99} {"update": {"_id": 4}} {"doc":{"age":1}} {"delete": {"_id": 4}}
Facebook评论