All Products
Search
Document Center

Tablestore:Delete a search index

Last Updated:Jul 31, 2024

You can call the DeleteSearchIndex operation to delete a search index that is created for a data table.

Prerequisites

Usage notes

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

Parameters

Parameter

Description

TableName

The name of the data table.

IndexName

The name of the search index.

Examples

The following sample code provides an example on how to delete a search index:


func DeleteSearchIndex(client *tablestore.TableStoreClient, tableName string, indexName string) {
    request := &tablestore.DeleteSearchIndexRequest{}
    request.TableName = tableName // Specify the name of the data table. 
    request.IndexName = indexName // Specify the name of the search index. 
    resp, err := client.DeleteSearchIndex(request) // Delete the search index. 

    if err != nil {
        fmt.Println("error: ", err)
        return
    }
    fmt.Println("DeleteSearchIndex finished, requestId: ", resp.ResponseInfo.RequestId)
}

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 index columns. For more information, see Create a search index and Dynamically modify the schema of a search index.