Use Tablestore SDK for Node.js to delete a global or local secondary index without affecting the data table or its data.
Prerequisites
-
An OTSClient instance is initialized. For more information, see Initialize a Tablestore client.
-
A secondary index is created. For more information, see Create a secondary index.
Precautions
A deleted secondary index cannot be recovered. To use the index again, create a new secondary index.
Parameters
|
Parameter |
Description |
|
mainTableName |
The name of the data table. |
|
indexName |
The name of the index table. |
Examples
The following sample code shows how to delete a secondary index from a data table by calling the dropIndex method.
var client = require('./client');
client.dropIndex({
mainTableName: "<TABLE_NAME>", // Specify the name of the data table.
indexName: "<INDEX_NAME>" // Specify the name of the index table.
}, function (err, data) {
if (err) {
console.log('error:', err);
return;
}
console.log('success:', JSON.stringify(data, null, 2));
});