All Products
Search
Document Center

Tablestore:Delete a search index

Last Updated:Apr 17, 2025

This topic describes how to delete a search index by using Tablestore SDK for Java.

Usage notes

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

Prerequisites

A Tablestore client is initialized. For more information, see Initialize a Tablestore client.

Method

public DeleteSearchIndexResponse deleteSearchIndex(DeleteSearchIndexRequest request) throws TableStoreException, ClientException

DeleteSearchIndexRequest parameters

tableName String (Required): the name of the data table for which the search index that you want to delete is created.

indexName String (Required): the name of the search index that you want to delete.

Sample code

The following sample code provides an example on how to delete a search index that is created for a table named test_table:

Before you run the code, replace the table name and search index name with the actual names.
public static void deleteSearchIndexExample(SyncClient client) {
    DeleteSearchIndexRequest request = new DeleteSearchIndexRequest();
    // Specify the name of the data table.
    request.setTableName("test_table");
    // Specify the name of the search index that you want to delete.
    request.setIndexName("index_name");
    // Delete the search index.
    client.deleteSearchIndex(request);
}