文档

查询多元索引描述信息

更新时间:

创建多元索引后,您可以查询多元索引的描述信息,例如多元索引的字段信息、索引预排序等。

接口

查询多元索引描述信息的接口为DescribeSearchIndex

参数

参数

说明

tableName

数据表名称。

indexName

多元索引名称。

使用方式

您可以使用控制台、命令行工具或者SDK进行查询多元索引描述信息的操作。

进行查询多元索引描述信息操作之前,您需要完成如下准备工作。

  • 使用阿里云账号或者使用具有表格存储操作权限的RAM用户进行操作。如果需要为RAM用户授权表格存储操作权限,请参见通过RAM Policy为RAM用户授权进行配置。

    使用SDK方式和命令行工具方式进行操作时,如果当前无可用AccessKey,则需要为阿里云账号或者RAM用户创建AccessKey。具体操作,请参见创建AccessKey

  • 已创建数据表。具体操作,请参见数据表操作

  • 已为数据表创建多元索引。具体操作,请参见创建多元索引

  • 使用SDK方式进行操作时,还需要完成初始化Client。具体操作,请参见初始化OTSClient

  • 使用命令行工具方式进行操作前,还需要完成下载并启动命令行工具,然后配置接入实例信息并选择要操作的表。具体操作,请参见下载命令行工具启动并配置数据表操作

使用控制台

通过控制台查看多元索引的描述信息,例如索引计量、索引字段等。

  1. 进入索引管理页签。

    1. 登录表格存储控制台

    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 SDKGo SDKPython SDKNode.js SDK.NET SDKPHP SDK查询多元索引描述信息。此处以Java SDK为例介绍查询多元索引描述信息的操作。

以下示例用于获取多元索引的详细信息,例如数据生命周期、创建时间、同步状态、字段信息等。

private static DescribeSearchIndexResponse describeSearchIndex(SyncClient client) {
    DescribeSearchIndexRequest request = new DescribeSearchIndexRequest();
    //设置数据表名称。
    request.setTableName("<TABLE_NAME>"); 
    //设置多元索引名称。
    request.setIndexName("<INDEX_NAME>"); 
    DescribeSearchIndexResponse response = client.describeSearchIndex(request);
    //打印response的详细信息。
    System.out.println(response.jsonize()); 
    //打印多元索引数据同步状态。
    System.out.println(response.getSyncStat().getSyncPhase().name());
    return response;
}

相关文档

如果已有多元索引不满足使用需求,您可以创建新的多元索引、通过修改多元索引的Schema来增删改多元索引字段或者根据需要调整多元索引的TTL。具体操作,请参见创建多元索引动态修改schema生命周期管理