[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"}}
```