You can call the ListSearchIndex operation to obtain indexes created in the current instance or associated with 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
Parameter | Description |
---|---|
TableName | Optional. The name of the table.
|
Examples
func ListSearchIndex(client *tablestore.TableStoreClient, tableName string) {
request := &tablestore.ListSearchIndexRequest{}
request.TableName = tableName // Set the name of the table.
resp, err := client.ListSearchIndex(request) // Obtain all search indexes associated with the table.
if err != nil {
fmt.Println("error: ", err)
return
}
for _, info := range resp.IndexInfo {
fmt.Printf("%#v\n", info) // Display the information of the search indexes.
}
fmt.Println("ListSearchIndex finished, requestId:", resp.ResponseInfo.RequestId)
}