deleteByQuery #
Deletes documents matching the provided search query.
Kuzzle uses the ElasticSearch Query DSL syntax.
Arguments #
io.kuzzle.sdk.StringVector deleteByQuery(
String index,
String collection,
String query,
io.kuzzle.sdk.QueryOptions options
)
io.kuzzle.sdk.StringVector deleteByQuery(
String index,
String collection,
String query
)
Argument | Type | Description |
---|---|---|
index | String | Index name |
collection | String | Collection name |
query | String | A JSON string containing query to match |
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 an 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 #
try {
StringVector deleted = kuzzle.getDocument().deleteByQuery(
"nyc-open-data",
"yellow-taxi",
"{\"query\": {\"term\": {\"capacity\": 7}}}"
);
System.out.println(String.format("Successfully deleted %d documents", deleted.size()));
} catch (KuzzleException e) {
System.err.println(e.getMessage());
}
Edit this page on Github(opens new window)