全部產品
Search
文件中心

Tablestore:查詢多元索引描述資訊

更新時間:Sep 19, 2026

建立多元索引後,您可以查詢多元索引的描述資訊,例如多元索引的欄位資訊、索引預排序等。

介面

查詢多元索引描述資訊的介面為DescribeSearchIndex。

參數

參數

說明

tableName

資料表名稱。

indexName

多元索引名稱。

使用方式

您可以使用控制台、命令列工具或者SDK進行查詢多元索引描述資訊的操作。

進行查詢多元索引描述資訊操作之前,您需要完成如下準備工作。

使用控制台

通過控制台查看多元索引的描述資訊,例如索引基本資料、索引計量、路由鍵、索引欄位和預排序等資訊。

  1. 進入索引管理頁簽。

    1. 登入Table Store控制台。

    2. 在頁面上方,選擇資源群組和地區。

    3. 在概覽頁面,單擊執行個體名稱或在操作列單擊執行個體管理。

    4. 在執行個體詳情頁簽下的資料表列表頁簽,單擊資料表名稱或在操作列單擊索引管理。

  2. 在索引管理頁簽,單擊目標多元索引操作列的索引詳情。

  3. 在索引詳情對話方塊,即可查看索引基本資料、索引計量、路由鍵、索引欄位和預排序等資訊。

使用命令列工具

通過命令列工具執行describe_search_index命令查詢多元索引描述資訊。更多資訊,請參見多元索引。

以下樣本用於查看search_index多元索引的資訊。

describe_search_index -n search_index

返回結果樣本如下所示。其中為Index schema多元索引的Schema,TimeToLive為多元索引的資料生命週期。

Index schema:
{
    "IndexSetting": {
        "RoutingFields": null
    },
    "FieldSchemas": [
        {
            "FieldName": "id",
            "FieldType": "KEYWORD",
            "Index": true,
            "IndexOptions": null,
            "Analyzer": null,
            "AnalyzerParameter": null,
            "EnableSortAndAgg": true,
            "EnableHighlighting": null,
            "Store": false,
            "IsArray": false,
            "FieldSchemas": null,
            "IsVirtualField": false,
            "SourceFieldNames": null,
            "DateFormats": null
        },
        {
            "FieldName": "Col_Keyword",
            "FieldType": "KEYWORD",
            "Index": true,
            "IndexOptions": null,
            "Analyzer": null,
            "AnalyzerParameter": null,
            "EnableSortAndAgg": true,
            "EnableHighlighting": null,
            "Store": false,
            "IsArray": false,
            "FieldSchemas": null,
            "IsVirtualField": false,
            "SourceFieldNames": null,
            "DateFormats": null
        },
        {
            "FieldName": "Col_Long",
            "FieldType": "LONG",
            "Index": true,
            "IndexOptions": null,
            "Analyzer": null,
            "AnalyzerParameter": null,
            "EnableSortAndAgg": true,
            "EnableHighlighting": null,
            "Store": false,
            "IsArray": false,
            "FieldSchemas": null,
            "IsVirtualField": false,
            "SourceFieldNames": null,
            "DateFormats": null
        },
        {
            "FieldName": "Col_Text",
            "FieldType": "TEXT",
            "Index": true,
            "IndexOptions": null,
            "Analyzer": "single_word",
            "AnalyzerParameter": {
                "CaseSensitive": null,
                "DelimitWord": null
            },
            "EnableSortAndAgg": false,
            "EnableHighlighting": null,
            "Store": false,
            "IsArray": false,
            "FieldSchemas": null,
            "IsVirtualField": false,
            "SourceFieldNames": null,
            "DateFormats": null
        },
        {
            "FieldName": "Timestamp",
            "FieldType": "LONG",
            "Index": true,
            "IndexOptions": null,
            "Analyzer": null,
            "AnalyzerParameter": null,
            "EnableSortAndAgg": true,
            "EnableHighlighting": null,
            "Store": false,
            "IsArray": false,
            "FieldSchemas": null,
            "IsVirtualField": false,
            "SourceFieldNames": null,
            "DateFormats": null
        }
    ],
    "IndexSort": {
        "Sorters": [
            {
                "Name": "PrimaryKeySort",
                "Sorter": {
                    "Order": "ASC"
                }
            }
        ]
    }
}
TimeToLive: -1

使用SDK

您可以通過Java SDK、Go SDK、Python SDK、Node.js SDK、.NET SDK和PHP SDK查詢多元索引描述資訊。此處以Java SDK為例介紹查詢多元索引描述資訊的操作。

以下樣本查詢 example_table 中 example_index 的資訊,並輸出索引狀態、同步階段、生命週期和欄位名稱。

String tableName = "example_table";
String indexName = "example_index";
DescribeSearchIndexRequest request = new DescribeSearchIndexRequest();
request.setTableName(tableName);
request.setIndexName(indexName);
request.setIncludeSyncStat(true);

DescribeSearchIndexResponse response = client.describeSearchIndex(request);
System.out.println(response.getIndexStatus().indexStatusEnum);
System.out.println(response.getSyncStat().getSyncPhase());
System.out.println(response.getTimeToLive());
for (FieldSchema fieldSchema : response.getSchema().getFieldSchemas()) {
    System.out.println(fieldSchema.getFieldName());
}

相關文檔

如果已有多元索引不滿足使用需求,您可以建立新的多元索引、通過修改多元索引的Schema來增刪改多元索引欄位或者根據需要調整多元索引的TTL。具體操作,請參見建立多元索引、動態修改schema和生命週期管理。