Java SDK 可刪除指定資料表中的多元索引,不影響資料表及表中資料。
前提條件
安裝Tablestore Java SDK並初始化用戶端。
功能說明
調用 deleteSearchIndex 方法刪除指定資料表中的多元索引。請求中必須指定資料表名稱和多元索引名稱。
public DeleteSearchIndexResponse deleteSearchIndex(DeleteSearchIndexRequest request) throws TableStoreException, ClientException
警告
刪除多元索引後無法恢複。該操作只刪除多元索引,不會刪除資料表或表中資料。
以下樣本刪除 example_table 中的 example_index。
String tableName = "example_table";
String indexName = "example_index";
DeleteSearchIndexRequest request = new DeleteSearchIndexRequest();
request.setTableName(tableName);
request.setIndexName(indexName);
client.deleteSearchIndex(request);
請求成功後,調用 listSearchIndex 方法列出資料表的多元索引,確認返回結果中不再包含目標索引。
參數說明
DeleteSearchIndexRequest 包含以下參數。
|
名稱 |
類型 |
說明 |
|
tableName(必選) |
|
資料表名稱。 |
|
indexName(必選) |
|
待刪除的多元索引名稱。 |