ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[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"}} ```