// Using callbacks (NodeJS or Web Browser) (error, result) {
  // called once the save action has been completed

// Using promises (NodeJS)
document.savePromise().then(result => {
  // called once the save action has been completed
}); ResponseListener<Document>() {
    public void onSuccess(Document object) {
      // called once the save action has been completed

    public void onError(JSONObject error) {
      // Handle error

use \Kuzzle\Document;

// ...

 * @var $document Document

try {
} catch (ErrorException $e) {


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 this document in Kuzzle by the current content of this object.

save([options], [callback])

optionsJSON ObjectOptional parameters
callbackfunctionOptional callback


volatileJSON ObjectAdditional information passed to notifications to other usersnull
queuablebooleanMark this request as (not) queuabletrue
refreshstringIf set to wait_for, Kuzzle will wait the persistence layer indexation to return (available with Elasticsearch 5.x and above)undefined

Return value

Returns this Document object to allow chaining.

Callback response

Resolves to this Document object once the document has been saved.