SDK
SDK Android v3.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.

save #

Saves this document into Kuzzle.

If this is a new document, this function will create it in Kuzzle and the id property will be made available.
Otherwise, this method will replace the latest version of the document in Kuzzle with the content of this current object.


save([options], [callback]) #

ArgumentsTypeDescription
optionsJSON ObjectOptional parameters
callbackfunctionOptional callback

Options #

OptionTypeDescriptionDefault
volatileJSON ObjectAdditional information passed to notifications to other usersnull
queuablebooleanMake this request queuable or nottrue
refreshstringIf set to wait_for, Kuzzle will wait for the persistence layer to finish indexing (available with Elasticsearch 5.x and above)undefined

Return Value #

Returns this Document object to allow chaining.


Callback Response #

Return this Document object once the document has been saved.

Usage #

document.save(new ResponseListener<Document>() {
  @Override
  public void onSuccess(Document object) {
    // called once the save action has been completed
  }
  @Override
  public void onError(JSONObject error) {
    // Handle error
  }
});