SDK
SDK Javascript v6.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.

create #

Creates a new index.


create(index, [options]);

ArgumentsTypeDescription
index
string
Index name
options
object
Query options

options #

Additional query options

PropertyType
(default)
Description
queuable
boolean

(true)
If true, queues the request during downtime, until connected to Kuzzle again

Resolves #

Resolves to an object containing the index creation status

NameTypeDescription
acknowledged
boolean
Indicates whether the index was successfully created in the Elastic cluster
shards_acknowledged
boolean
Indicates whether the requisite number of shard copies were started for each shard in the index before timing out

Usage #

try {
  const response = await kuzzle.index.create('nyc-open-data');
  console.log(response);
  /*
    { acknowledged: true,
      shards_acknowledged: true }
  */
  console.log('Index created');
} catch (error) {
  console.error(error.message);
}