List search indexes
After you create search indexes for a data table, you can call the ListSearchIndex operation to list the search indexes that are created for the data table.
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 data tables and Write data.
-
A search index is created for the data table. For more information, see Create search indexes.
Parameters
|
Parameter |
Description |
|
TableName |
Required. The name of the data table. |
Examples
The following sample code provides an example on how to list search indexes that are created for a table:
/// <summary>
/// List the names of the search indexes.
/// </summary>
/// <param name="otsClient"></param>
public static void ListSearchIndex(OTSClient otsClient)
{
// Specify the name of the data table.
ListSearchIndexRequest request = new ListSearchIndexRequest(TableName);
ListSearchIndexResponse response = otsClient.ListSearchIndex(request);
// Query all search indexes associated with the data table.
foreach (var index in response.IndexInfos)
{
Console.WriteLine("indexname:" + index.IndexName);
Console.WriteLine("tablename:" + index.TableName);
}
}
References
-
If you want to query details about a search index, such as the fields and schema of the search index, you can query the description of the search index. For more information, see Query the description of a search index.
-
If you no longer use a search index, you can delete the search index. For more information, see Delete search indexes.