创建多元索引后,使用DescribeSearchIndex接口可以查询多元索引的描述信息,包括多元索引的字段信息和索引配置等。
前提条件
参数
参数 | 说明 |
---|---|
TableName | 数据表名称。 |
IndexName | 多元索引名称。 |
示例
func DescribeSearchIndex(client *tablestore.TableStoreClient, tableName string, indexName string) {
request := &tablestore.DescribeSearchIndexRequest{}
request.TableName = tableName //设置数据表名称。
request.IndexName = indexName //设置多元索引名称。
resp, err := client.DescribeSearchIndex(request)
if err != nil {
fmt.Println("error: ", err)
return
}
fmt.Println("FieldSchemas:")
for _, schema := range resp.Schema.FieldSchemas {
fmt.Printf("%s\n", schema) //打印多元索引中字段的schema信息。
}
fmt.Println("DescribeSearchIndex finished, requestId: ", resp.ResponseInfo.RequestId)
}