All Products
Search
Document Center

Tablestore:List search indexes

Last Updated:Jul 23, 2024

After you create search indexes for a data table, you can call the ListSearchIndex operation to list the search indexes that are created for the data table.

Prerequisites

Parameters

Parameter

Description

TableName

The name of the data table. This parameter cannot be left empty.

Examples

The following sample code provides an example on how to list search indexes that are created for a table:

func ListSearchIndex(client *tablestore.TableStoreClient, tableName string) {
    request := &tablestore.ListSearchIndexRequest{}
    request.TableName = tableName // Specify the name of the data table. 
    resp, err := client.ListSearchIndex(request) // Query all search indexes that are created for the data table. 
    if err != nil {
        fmt.Println("error: ", err)
        return
    }
    for _, info := range resp.IndexInfo {
        fmt.Printf("%#v\n", info) // Display the information about the search indexes. 
    }
    fmt.Println("ListSearchIndex finished, requestId:", resp.ResponseInfo.RequestId)
}

References

  • If you want to query details about a search index, such as the fields and schema of the search index, you can query the description of the search index. For more information, see Query the description of a search index.

  • If you no longer use a search index, you can delete the search index. For more information, see Delete a search index.