You can call the ListSearchIndex operation to obtain indexes created in the current instance or associated with a table.

Prerequisites

  • The OTSClient instance is initialized. For more information, see Initialization.
  • A data table is created and data is written to the table.
  • A search index is created for the table. For more information, see Create search indexes.

Parameters

Parameter Description
tableName Optional. This parameter specifies the name of the table.
  • If the name of the table is set, all search indexes associated with the table are returned.
  • If the name of the table is not set, all search indexes in the current instance are returned.

Examples

private static List<SearchIndexInfo> listSearchIndex(SyncClient client) {
    ListSearchIndexRequest request = new ListSearchIndexRequest();
    request.setTableName(TABLE_NAME); // Set the name of the table.
    return client.listSearchIndex(request).getIndexInfos(); // Return all search indexes associated with the table.
}