mDelete #
Deletes multiple documents.
Throws a partial error (error code 206) if one or more document deletions fail.
The optional parameter refresh
can be used with the value wait_for
in order to wait for the document indexation (indexed documents are available for search
).
Arguments #
io.kuzzle.sdk.StringVector mDelete(
String index,
String collection,
io.kuzzle.sdk.StringVector ids,
io.kuzzle.sdk.QueryOptions options
)
io.kuzzle.sdk.StringVector mDelete(
String index,
String collection,
io.kuzzle.sdk.StringVector ids
)
Argument | Type | Description |
---|---|---|
index | String | Index name |
collection | String | Collection name |
ids | io.kuzzle.sdk.StringVector | The ids of the documents to delete |
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 a io.kuzzle.sdk.StringVector
containing the list of the deleted document ids.
Exceptions #
Throws a io.kuzzle.sdk.KuzzleException
if there is an error. See how to handle error.
Usage #
StringVector ids = new StringVector();
ids.add("some-id");
ids.add("some-other-id");
try {
kuzzle.getDocument().create("nyc-open-data", "yellow-taxi", "some-id", "{}");
kuzzle.getDocument().create("nyc-open-data", "yellow-taxi", "some-other-id", "{}");
StringVector deleted = kuzzle.getDocument().mDelete("nyc-open-data", "yellow-taxi", ids);
System.out.println(String.format("Successfully deleted %d documents", deleted.size()));
} catch (KuzzleException e) {
System.err.println(e.getMessage());
}