Core
API v2.x
2

deleteByQuery #

Deletes documents matching the provided search query.

This is a low level route intended to bypass Kuzzle actions on document deletion, notably:


Query Syntax #

HTTP #

Copied to clipboard!
URL: http://kuzzle:7512/<index>/<collection>/_bulk/_query[?refresh=wait_for]
Method: DELETE
Body:
Copied to clipboard!
{
  "query": {
    // ...
  }
}

Other protocols #

Copied to clipboard!
{
  "index": "<index>",
  "collection": "<collection>",
  "controller": "document",
  "action": "deleteByQuery",
  "refresh": "wait_for",
  "body": {
    "query": {
      // ...
    }
  }
}

Arguments #

  • collection: collection name
  • index: index name

Optional #

  • refresh: if set to wait_for, Kuzzle will not respond until the deleted documents are removed from the search indexes

Body properties #


Response #

Returns the number of deleted documents.

Copied to clipboard!
{
  "status": 200,
  "error": null,
  "index": "<index>",
  "collection": "<collection>",
  "controller": "bulk",
  "action": "deleteByQuery",
  "requestId": "<unique request identifier>",
  "result": {
    "deleted": 42
  }
}