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