All Products
Search
Document Center

Tablestore:Query search indexes

Last Updated:Aug 02, 2024

After you create search indexes, you can query all search indexes that are created for a data table.

API operation

You can call the ListSearchIndex operation to query search indexes.

Parameters

Parameter

Description

tableName

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

Methods

You can use the Tablestore console, Tablestore CLI, or Tablestore SDKs to query search indexes.

Before you query search indexes, make sure that the following preparations are made:

Use the Tablestore console

You can use the Tablestore console to query search indexes that are created for a data table.

  1. Go to the Indexes tab.

    1. Log on to the Tablestore console.

    2. In the top navigation bar, select a resource group and a region.

    3. On the Overview page, click the name of the instance that you want to manage or click Manage Instance in the Actions column of the instance.

    4. On the Tables tab of the Instance Details tab, click the name of the data table or click Indexes in the Actions column of the data table.

  2. On the Indexes tab, you can view the search indexes that are created for the data table.

Use the Tablestore CLI

You can run the list_search_index command in the Tablestore CLI to query search indexes. For more information, see Search index.

The following sample code provides an example on how to query search indexes that are created for the current table:

list_search_index

Sample output:

+-----------+--------------+
| TableName | IndexName    |
+-----------+--------------+
| mytable   | search_index |
+-----------+--------------+

Use Tablestore SDKs

You can query search indexes by using the following Tablestore SDKs: Tablestore SDK for Java, Tablestore SDK for Go, Tablestore SDK for Python, Tablestore SDK for Node.js, Tablestore SDK for .NET, and Tablestore SDK for PHP. In this example, Tablestore SDK for Java is used.

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

private static List<SearchIndexInfo> listSearchIndex(SyncClient client) {
    ListSearchIndexRequest request = new ListSearchIndexRequest();
    // Specify the name of the data table. 
    request.setTableName("<TABLE_NAME>"); 
    // Query all search indexes that are created for the data table. 
    return client.listSearchIndex(request).getIndexInfos();
}

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 search indexes.