All Products
Search
Document Center

Tablestore:Delete a search index

Last Updated:Aug 02, 2024

If you no longer require a search index that is created for a data table, you can delete the search index.

API operation

You can call the DeleteSearchIndex operation to delete a search index.

Parameters

Parameter

Description

tableName

The name of the data table.

indexName

The name of the search index.

Usage notes

A deleted search index cannot be recovered. Proceed with caution.

Methods

You can use the Tablestore console, Tablestore CLI, or Tablestore SDKs to delete a search index.

Before you delete a search index, make sure that the following preparations are made:

Use the Tablestore console

You can use the Tablestore console to delete a search index that you no longer require.

  1. Go to the Indexes tab.

    1. Log on to the Tablestore console.

    2. In the top navigation bar, select a resource group and a region.

    3. On the Overview page, click the name of the instance that you want to manage or click Manage Instance in the Actions column of the instance.

    4. On the Tables tab of the Instance Details tab, click the name of the data table or click Indexes in the Actions column of the data table.

  2. On the Indexes tab, find the search index that you want to delete and click Delete in the Actions column.

  3. In the Delete Search Index message, confirm the names of the table and search index and click OK.

    Note

    If security verification is enabled for your Alibaba Cloud account, complete the verification as prompted.

Use the Tablestore CLI

You can run the drop_search_index command in the Tablestore CLI to delete a search index. For more information, see Search index.

The following sample code provides an example on how to delete a search index named search_index:

drop_search_index -n search_index -y

Use Tablestore SDKs

You can delete a search index by using the following Tablestore SDKs: Tablestore SDK for Java, Tablestore SDK for Go, Tablestore SDK for Python, Tablestore SDK for Node.js, Tablestore SDK for .NET, and Tablestore SDK for PHP. In this example, Tablestore SDK for Java is used.

The following sample code provides an example on how to delete a search index:

private static void deleteSearchIndex(SyncClient client) {
    DeleteSearchIndexRequest request = new DeleteSearchIndexRequest();
    request.setTableName("<TABLE_NAME>"); // Specify the name of the data table. 
    request.setIndexName("<SEARCH_INDEX_NAME>"); // Specify the name of the search index. 
    client.deleteSearchIndex(request); // Call the client to delete the search index. 
}

References

If existing search indexes do not meet your business requirements, you can create search indexes or modify the schemas of existing search indexes to add, remove, and modify index columns. For more information, see Create a search index and Dynamically modify the schema of a search index.