var collection = kuzzle.collection('collection', 'index');

// or using a default index:
  kuzzle = new Kuzzle('localhost', {defaultIndex: 'index'});

collection = kuzzle.collection('collection');
Collection collection = kuzzle.collection("collection", "index");

// or using a default index:
Collection collection = kuzzle.collection("collection");
use \Kuzzle\Kuzzle;

$kuzzle = new Kuzzle('localhost');
$dataCollection = $kuzzle->collection('collection', 'index');

// or using a default index:
$kuzzle = new Kuzzle('localhost', [
  'defaultIndex' => 'some index'
$dataCollection = $kuzzle->collection('collection', 'index');

Instantiates a new Collection object.

collection(collection, [index])

collectionstringThe name of the data collection you want to manipulate
indexstringThe name of the index containing the data collection

If no index is provided, the factory will take the default index set in the main Kuzzle instance. If no default index has been set, an error is thrown.

The index argument takes precedence over the default index.

Return value

Returns a Collection object.