Use Tablestore SDK for Python to list the search indexes of a table or an instance.
Prerequisites
Install the Tablestore SDK for Python and initialize a client.
Description
Call list_search_index to list search indexes. If you specify a table name, the method returns all search indexes of the table. If you omit the table name, the method returns all search indexes in the current instance.
def list_search_index(self, table_name=None)
The following example lists all search indexes of example_table and prints the table name and search index name of each entry.
search_indexes = client.list_search_index("example_table")
for table_name, index_name in search_indexes:
print(table_name, index_name)
Parameters
The list_search_index method contains the following parameter.
|
Name |
Type |
Description |
|
table_name (optional) |
|
The table name. If you specify this parameter, the method returns all search indexes of the table. If you omit this parameter, the method returns all search indexes in the current instance. |
Response
The list_search_index method returns List[Tuple[str, str]]. Each tuple contains the table name followed by the search index name.
Examples
List all search indexes in an instance
The following example omits the table name to list all search indexes in the current instance.
search_indexes = client.list_search_index()
for table_name, index_name in search_indexes:
print(table_name, index_name)