SDK
SDK Javascript v5.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

createIndex #

Create a new empty index, with no associated mapping.


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

Arguments Type Description
index string Optional index to query. If no set, defaults to Kuzzle.defaultIndex
options JSON object Optional parameters
callback function Callback handling the response

Options #

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

Callback Response #

Returns an object with the index creation status.

Usage #

Copied to clipboard!
// 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
  });

Callback response:

Copied to clipboard!
{
  "acknowledged": true,
  "shards_acknowledged": true
}