Unknown SDK


Create the input Documents.

mCreateDocument(documents, [options], [callback])

Arguments Type Description
documents Document[] Array of Document to create
options JSON Object Optional parameters
callback function Optional callback


Option Type Description Default
queuable boolean Make this request queuable or not true

Return Value

Returns the Collection object to allow chaining.

Callback Response

Returns a JSON object containing the raw Kuzzle response. Can return a 206 partial error in cases where some documents could not be created.


Copied to clipboard!
use \Kuzzle\Kuzzle;
use \Kuzzle\Document;
$kuzzle = new Kuzzle('localhost');
$dataCollection = $kuzzle->collection('collection', 'index');
$firstDocument = new Document($dataCollection, 'doc1', ['title' => 'foo', 'content' => 'bar']);
$secondDocument = new Document($dataCollection, 'doc2', ['title' => 'foo', 'content' => 'bar']);
try {
  $result = $dataCollection->mCreateDocument([$firstDocument, $secondDocument]);
catch (ErrorException $e) {

Callback response:

Copied to clipboard!
  "hits": [{ "first": "document" }, { "second": "document" }],
  "total": 2