createIndex

// Using callbacks (node.js or browser)
kuzzle.createIndex('myIndex', function (err, res) {
  // callback called once the create operation has completed
  // => the result is a JSON object containing the raw Kuzzle response
});

// Using promises (node.js)
kuzzle
  .createIndexPromise('myIndex')
  .then(res => {
    // promise resolved once the create operation has completed
    // => the result is a JSON object containing the raw Kuzzle response
  });
kuzzle.createIndex("myIndex", new ResponseListener<Boolean>() {
  @Override
  public void onSuccess(JSONObject result) {
    // result var contains the creation status of myIndex.
  }

  @Override
  public void onError(JSONObject error) {
    // Handle error
  }
}
<?php
use \Kuzzle\Kuzzle;

$kuzzle = new Kuzzle('localhost');
$result = $kuzzle->createIndex('myIndex');

Create a new empty data index, with no associated mapping.

Callback response:

{
  "acknowledged": true,
  "shards_acknowledged": true

}

createIndex([index], [options], callback)

ArgumentsTypeDescription
indexstringOptional index to query. If no set, defaults to Kuzzle.defaultIndex
optionsJSON objectOptional parameters
callbackfunctionCallback handling the response

Options

OptionTypeDescriptionDefault
queuablebooleanMark this request as (not) queuabletrue

Callback response

The response is a an object reflecting the index creation status.