刪除多元索引

更新時間:
Copy as MD

使用Table Store Java SDK刪除指定資料表中的多元索引。

注意事項

多元索引刪除後不可恢複,請謹慎操作。

前提條件

已初始化 Tablestore 用戶端。詳情請參見初始化Tablestore Client

方法說明

public DeleteSearchIndexResponse deleteSearchIndex(DeleteSearchIndexRequest request) throws TableStoreException, ClientException

DeleteSearchIndexRequest參數說明

tableName String(必選):資料表名稱。

indexName String(必選):待刪除的多元索引名稱。

範例程式碼

以下範例程式碼刪除 test_table 資料表中名為 index_name 的多元索引。運行前請將資料表名稱和多元索引名稱替換為實際值。

運行代碼前,請替換資料表名稱和多元索引名稱。
public static void deleteSearchIndexExample(SyncClient client) {
    DeleteSearchIndexRequest request = new DeleteSearchIndexRequest();
    // 設定資料表名稱。
    request.setTableName("test_table");
    // 設定需要刪除的多元索引名稱。
    request.setIndexName("index_name");
    // 刪除多元索引。
    client.deleteSearchIndex(request);
}