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 Node.js allows you to update only the TTL of search indexes.

Prerequisites

  • A Tablestore client is initialized. For more information, see Initialization.
  • A data table is created. Data is written to the table.
  • A search index is created for the data table. For more information, see Create search indexes.

Parameters

Parameter Description
tableName The name of the data table.
indexName The name of the search index.
timeToLive 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 to 8,000,000 seconds.


let params = {
    tableName: tableName,
    indexName: indexName,
    timeToLive: 8000000,
}
client.updateSearchIndex(params, function (err, data) {
    if (err) {
        console.log('updateSearchIndex error:', err.toString());
    } else {
        console.log('updateSearchIndex success:', data);
    }
});