SDK
SDK PHP v3.x
1

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]) #

Arguments Type Description
options JSON Object Optional parameters
callback function Optional callback

Options #

Option Type Description Default
volatile JSON Object Additional information passed to notifications to other users null
queuable boolean Make this request queuable or not true
refresh string If 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 #

Copied to clipboard!
<?php
use \Kuzzle\Document;
// ...
/**
  * @var $document Document
  */
try {
  $document->save();
} catch (ErrorException $e) {
}