You can call the DeleteSearchIndex operation to delete a search index that is created for a data table.
Prerequisites
An OTSClient instance is initialized. For more information, see Initialize an OTSClient instance.
A data table is created. Data is written to the table. For more information, see Create a data table and Write data.
A search index is created for the data table. For more information, see Create a search index.
API operations
/**
* Delete the search index.
* @api
*
* @param [] $request
* The request parameters, including the table name and search index name.
* @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/DeleteSearchIndex.php"
*/
public function deleteSearchIndex(array $request)
Parameters
Parameter | Description |
table_name | The name of the data table. |
index_name | The name of the search index. |
Examples
The following sample code provides an example on how to delete a search index:
$request = array(
'table_name' => 'php_sdk_test',
'index_name' => 'php_sdk_test_search_index'
);
$response = $otsClient->deleteSearchIndex($request);
References
If existing search indexes do not meet your business requirements, you can create search indexes or modify the schemas of existing search indexes to add, remove, and modify index fields. For more information, see Create a search index and Dynamically modify the schema of a search index.