After you create a search index for a data table, you can call the DescribeSearchIndex operation to query the description of the search index, including the information about fields and configurations of the search index.
Prerequisites
An OTSClient instance is initialized. For more information, see Initialize an OTSClient instance.
A data table is created and data is written to the data table. For more information, see Create a data table and Write data.
A search index is created for the data table. For more information, see Create a search index.
Parameters
Parameter | Description |
tableName | The name of the data table. |
indexName | The name of the search index. |
Examples
The following sample code provides an example on how to query the details of a search index, such as the time to live (TTL), creation time, synchronization status, and field information:
private static DescribeSearchIndexResponse describeSearchIndex(SyncClient client) {
DescribeSearchIndexRequest request = new DescribeSearchIndexRequest();
// Specify the name of the data table.
request.setTableName("<TABLE_NAME>");
// Specify the name of the search index.
request.setIndexName("<INDEX_NAME>");
DescribeSearchIndexResponse response = client.describeSearchIndex(request);
// Display the details of the response.
System.out.println(response.jsonize());
// Display the synchronization status of data in the search index.
System.out.println(response.getSyncStat().getSyncPhase().name());
return response;
}
References
If an existing search index no longer meets your requirements, you can create a new search index, modify the schema of the existing search index to add, delete, or modify index fields, or adjust the TTL configuration of the search index. For more information, see Create a search index, Dynamically modify the schema of a search index, and Configure the TTL of a search index.