[TOC]
## **更新文件**
索引存在則覆蓋,不存在則新建
~~~
PUT /indexName/type/id
PUT /customer/_doc/1?pretty
{
"name": "John Doe"
}
~~~
## **刪除文件**
```
DELETE /customer/_doc/2?pretty
```
## **批處理**
**批量創建索引**
```
POST /customer/_doc/_bulk?pretty
{"index":{"_id":"1"}}
{"name": "John Doe" }
{"index":{"_id":"2"}}
{"name": "Jane Doe" }
```
本示例在一個批量操作中更新第一個文檔(ID為1),然后刪除第二個文檔(ID為2):
```
POST /customer/_doc/_bulk?pretty
{"update":{"_id":"1"}}
{"doc": { "name": "John Doe becomes Jane Doe" } }
{"delete":{"_id":"2"}}
```