You can call the DeleteSearchIndex operation to delete a search index that is created for a data table.
Prerequisites
The OTSClient is initialized. For more information, see Initialize an OTSClient instance.
A data table is created. Data is written to the table.
A search index is created for the data table. For more information, see Create search indexes.
Usage notes
A search index cannot be restored after it is deleted. Exercise caution when you call this operation.
Parameters
Parameter | Description |
tableName | The name of the table. |
indexName | The name of the search index. |
Example
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 indexed columns. For more information, see Create a search index and Dynamically modify the schema of a search index.