Use Tablestore SDK for Python to query the fields, configurations, TTL, and data synchronization status of a search index.
Prerequisites
Install the Tablestore SDK for Python and initialize a client.
Description
Call describe_search_index to query the configurations and data synchronization status of a search index.
def describe_search_index(
self,
table_name,
index_name,
include_sync_stat=True,
)
The following example queries example_index for example_table and prints its TTL, index fields, and data synchronization phase.
index_meta, sync_stat = client.describe_search_index(
"example_table",
"example_index",
)
print(index_meta.time_to_live)
for field_schema in index_meta.fields:
print(field_schema.field_name)
if sync_stat is not None:
print(sync_stat.sync_phase)
Parameters
The describe_search_index method contains the following parameters.
|
Name |
Type |
Description |
|
table_name (required) |
|
The table name. |
|
index_name (required) |
|
The search index name. |
|
include_sync_stat (optional) |
|
Specifies whether to return the data synchronization status. Default value: |
Response
The describe_search_index method returns a tuple that contains the following information.
|
Field |
Type |
Description |
|
index_meta |
|
The index fields, index settings, presorting settings, and TTL. |
|
sync_stat |
|
The data synchronization status. If |
Search index metadata
index_meta is a SearchIndexMeta object that contains the following fields.
|
Field |
Type |
Description |
|
fields |
|
The index fields. For the object structure, see Create a search index. |
|
index_setting |
|
The index settings. |
|
index_sort |
|
The presorting settings. |
|
time_to_live |
|
The TTL of index data in seconds. A value of |
Data synchronization status
sync_stat is a SyncStat object that contains the following fields.
|
Field |
Type |
Description |
|
sync_phase |
|
The data synchronization phase. |
|
current_sync_timestamp |
|
The current data synchronization timestamp. |