create #
Creates a new index.
create(index, [options]);
Arguments | Type | Description |
---|---|---|
index | string | Index name |
options | object | Query options |
options #
Additional query options
Property | Type (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
Name | Type | Description |
---|---|---|
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);
}
Edit this page on Github(opens new window)