(十二)Deleting Documents
Deleting a document is fairly straightforward. This example shows how to delete our previous customer with the ID of 2:
删除文档非常简单。此示例显示如何删除ID为2的以前的客户:
DELETE /customer/_doc/2?pretty
See the _delete_by_query
API to delete all documents matching a specific query. It is worth noting that it is much more efficient to delete a whole index instead of deleting all documents with the Delete By Query API.
请参阅_delete_by_query API以删除与特定查询匹配的所有文档。值得注意的是,删除整个索引而不是使用Delete By Query API删除所有文档会更有效。