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
- The OTSClient is initialized. For more information, see Initialize an OTSClient instance.
- A data table is created. Data is written to the table.
- A search index is created for the data table. For more information, see Create search indexes.
Parameters
Parameter | Description |
tableName | The name of the data table. |
indexName | The name of the search index. |
Sample code
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 the data in the search index.
System.out.println(response.getSyncStat().getSyncPhase().name());
return response;
}
References
If existing search indexes do not meet your business requirements, you can create search indexes or modify the schemas of existing search indexes to add, remove, and modify indexed columns. For more information, see Create search indexes and Dynamically modify schemas.