SDK
SDK Java v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

This SDK has been deprecated because of stability issues. It is not advised to use it in a production environment.

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
)

ArgumentTypeDescription
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

OptionType
(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());
}