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

Prerequisites

  • The TableStoreClient is initialized. For more information, see Initialization.
  • 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.

Parameters

ParameterDescription
TableNameThe name of the table.
IndexNameThe name of the search index.

Examples


func DeleteSearchIndex(client *tablestore.TableStoreClient, tableName string, indexName string) {
    request := &tablestore.DeleteSearchIndexRequest{}
    request.TableName = tableName // Set the name of the table.
    request.IndexName = indexName // Set the name of the search index.
    resp, err := client.DeleteSearchIndex(request) // Call a client to delete the search index.

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