All Products
Search
Document Center

Tablestore:Delete a secondary index by using Tablestore SDK for Node.js

Last Updated:Feb 27, 2026

You can call the DeleteIndex operation to delete a secondary index that you no longer need for a data table. The dropIndex method of OTSClient corresponds to the DeleteIndex API operation.

Prerequisites

Usage notes

Deleted secondary indexes cannot be restored. If you need to use the secondary index after you delete it, you need to create the secondary index again.

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));
});