If you no longer need a secondary index that is created for a data table, you can call the DeleteIndex operation to delete the secondary index.
Usage notes
Deleted secondary indexes cannot be restored. If you need to use the secondary index after you delete it, you need to create the secondary index again.
API operation
/**
* Delete a global secondary index.
* @api
*
* @param [] $request
* The request parameter, which is the name of the data table.
* @return [] The response.
* @throws OTSClientException The exception that is returned when a parameter error occurs or the Tablestore server returns a verification error.
* @throws OTSServerException The exception that is returned when the Tablestore server returns an error.
* @example "src/examples/DropIndex.php"
*/
public function dropIndex(array $request)
Parameters
Parameter | Description |
table_name | The name of the data table. |
index_name | The name of the index table. |
Examples
The following sample code provides an example on how to delete a secondary index:
$request = array (
'table_name' => '<TABLE_NAME>', // Specify the name of the data table.
'index_name' => '<INDEX_NAME>' // Specify the name of the index table.
);
$otsClient->dropIndex($request);