Delete a document #
Delete a specific document from the specified collection by specifying its unique identifier.
Examples #
Delete the document 0,0 from collection my-collection:
DELETE /my-collection/_doc/0,0
The API returns the following result:
{
"_id": "0,0",
"_version": 0,
"result": "deleted",
...
}
Deleting a document again (or fetching it after deletion) answers
404 with "result": "not_found" — the delete itself still succeeds
and reports "result": "deleted" only for a document that was live.
Key mappings survive deletion: creating a new document with the key of a
deleted document succeeds (result: "created") and reuses that document’s
original _id, instead of allocating a new one.
Request #
DELETE /<target>/_doc/<doc_id>
Path parameters #
<target>
(Required, string) Name of the collection to target.<doc_id>
(Required, string) Unique identifier for the document, support both_keyor_id.
Query parameters #
routing
(Required for a key-addressed delete on a routed collection) — the routing VALUE that places the document (hash(<value>)— or its salted partition set, see salting). A bare key has no home partition there and answers400.