Call the DeleteSearchIndex operation to delete a search index from a data table.
This operation is irreversible. Before you delete a search index, confirm that your application no longer depends on it. Save the index schema definition if you need to recreate the index later.
Prerequisites
An OTSClient instance is initialized. For more information, see Initialize an OTSClient instance.
A data table is created and data is written to the data table. For more information, see Create data tables and Write data.
A search index is created for the data table. For more information, see Create search indexes.
Notes
A search index cannot be recovered after it is deleted. Proceed with caution.
Parameters
Parameter | Description |
TableName | The name of the data table. |
IndexName | The name of the search index. |
Example
/// <summary>
/// Delete a search index.
/// </summary>
/// <param name="otsClient"></param>
public static void DeleteSearchIndex(OTSClient otsClient)
{
// Specify the names of the data table and the search index.
DeleteSearchIndexRequest request = new DeleteSearchIndexRequest(TableName, IndexName);
// Delete the search index.
DeleteSearchIndexResponse response = otsClient.DeleteSearchIndex(request);
}
References
If an existing search index does not meet your requirements, you can create a new search index or modify the schema of the search index to add, delete, or modify indexed fields. For more information, see Create a search index and Dynamically modify a schema.
Create search indexes: Create a search index for a data table.
Dynamically modify the schema of a search index: Add, remove, or modify index fields in an existing search index.