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.

mReplace #

Replaces multiple documents.

Throws a partial error (error code 206) if one or more documents can not be replaced.

Arguments #

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

Argument Type Description
index
String
Index name
collection
String
Collection name
documents
String
A JSON string containing the documents to update
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 JSON string containing the updated documents.

Exceptions #

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

Usage #

Copied to clipboard!
try {
  kuzzle.getDocument().create("nyc-open-data", "yellow-taxi", "some-id", "{}");
  kuzzle.getDocument().create("nyc-open-data", "yellow-taxi", "some-other-id", "{}");
  String newDocuments = "["
    + "{"
    + "     \"_id\": \"some-id\","
    + "     \"body\": { \"capacity\": 4 }"
    + "},"
    + "{"
    + "     \"_id\": \"some-other-id\","
    + "     \"body\": { \"capacity\": 4 }"
    + "}"
    + "]";
  String response = kuzzle.getDocument().mReplace(
    "nyc-open-data",
    "yellow-taxi",
    newDocuments
  );
  System.out.println(response);
} catch (KuzzleException e) {
  System.err.println(e.getMessage());
}