document.setMeta({metaAttribute: 'metaValue'}, true);
JSONObject metadata = new JSONObject().put("metaAttribute", "metaValue");

document.setMeta(metadata, true);

use \Kuzzle\Document;

// ...

$metadata = [
  'metaAttribute' => 'metaValue'

 * @var $document Document

Replaces or updates the current document metadata with provided ones.
This is a helper function returning itself, allowing to easily chain calls.

setMeta(meta, [replace])

metaJSON ObjectNew metadata
replacebooleantrue: replaces the current metadata with the provided ones, otherwise merges it

Note: by default, the replace argument is set to false

Return value

Returns this Document object to allow chaining.