delete

Deletes a document.

The optional parameter refresh can be used with the value wait_for in order to wait for the document to be indexed (and to no longer be available in search).

Arguments

Copied to clipboard!
String delete(
  String index,
  String collection,
  String id,
  io.kuzzle.sdk.QueryOptions options
)
String delete(
  String index,
  String collection,
  String id
)

Argument Type Description
index
String
Index name
collection
String
Collection name
id
String
Document ID
options
io.kuzzle.sdk.QueryOptions
Query options

options

Additional query options

Option Type
(default)
Description
queuable
boolean

(true)
If true, queues the request during downtime, until connected to Kuzzle again
refresh
String

("")
If set to wait_for, waits for the change to be reflected for search (up to 1s)

Return

Returns the id of the deleted document.

Exceptions

Throws a io.kuzzle.sdk.KuzzleException if there is an error. See how to handle error.

Usage

Copied to clipboard!
try {
  String id = kuzzle.getDocument().delete("nyc-open-data", "yellow-taxi", "some-id");

  if (id.equals("some-id")) {
    System.out.println("Success");
  }
} catch (KuzzleException e) {
  System.err.println(e.getMessage());
}