Delete a search index
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
The following example shows how to delete a search index.
/// <summary>
/// Deletes a search index.
/// </summary>
/// <param name="otsClient"></param>
public static void DeleteSearchIndex(OTSClient otsClient)
{
// Set the data table name and the search index name.
DeleteSearchIndexRequest request = new DeleteSearchIndexRequest(TableName, IndexName);
// Call otsClient to 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 Delete a search index and Dynamically modify a schema.
In addition to search indexes, Tablestore also provides an SQL engine, a table engine, and secondary indexes for data queries. You can choose a query method based on your query scenario. For more information, see Index overview and Index selection.