All Products
Search
Document Center

Tablestore:Update information about search indexes

Last Updated:Jan 19, 2024

After you create a search index, you can call the UpdateSearchIndex operation to update information about the search index, such as the time to live (TTL) of the search index. Tablestore SDK for PHP allows you to update only the TTL of search indexes.

Prerequisites

Parameters

Parameter

Description

table_name

The name of the data table.

index_name

The name of the search index.

time_to_live

The TTL of the search index. For more information, see TTL of search indexes.

The TTL value of a search index can be -1 or a positive int32 in seconds. The value of -1 indicates that data in the search index never expires and the maximum int32 value is equivalent to approximately 68 years.

Examples

The following code provides an example on how to update the TTL of a search index:

$response = $otsClient->updateSearchIndex(array(
    'table_name' => 'php_sdk_test',
    'index_name' => 'test_create_search_index',
    'time_to_live' => 60 * 60 * 24 * 365 * 10   // Unit: seconds. 
));

print json_encode($response, JSON_PRETTY_PRINT);