Skip to content

Delete documents

Delete documents identified by an array of their IDs.

POST /indexes/{index_name}/documents/delete-batch

Path parameters

Name Type Description
index_name String name of the index


An array of document IDs, to be deleted.

[ "article_591", "article_602" ]


curl -XPOST  http://localhost:8882/indexes/my-first-index/documents/delete-batch -H 'Content-type:application/json' -d '[
  "article_591", "article_602"
mq.index("my-first-index").delete_documents(ids=["article_591", "article_602"])

Response 200 OK

    "index_name": "my-first-index",
    "status": "succeeded",
    "type": "documentDeletion",
    "details": {"receivedDocumentIds": 2, "deletedDocuments": 1},
    "items": [
            "_id": "article_591",
            "_shards": {"total": 1, "successful": 1, "failed": 0},
            "status": 200,
            "result": "deleted",
            "_id": "article_602",
            "_shards": {"total": 1, "successful": 1, "failed": 0},
            "status": 404,
            "result": "not_found",
    "duration": "PT0.084367S",
    "startedAt": "2022-09-01T05:11:31.790986Z",
    "finishedAt": "2022-09-01T05:11:31.875353Z",
In this example, one of the articles didn't exist in the index. Therefore, only one document was deleted.

Each result in the items list contains the document _id, status code, result (failure reason will be here, if any), and _shards information (inclusive of both primaries and replicas).