All Products
Search
Document Center

Tablestore:UpdateSearchIndex

Last Updated:Dec 11, 2024

Updates the configurations of a search index, including the time to live (TTL) and schema configurations.

Usage notes

  • To update the TTL of a search index, make sure that the allow_update parameter is set to false for the data table for which the search index is created. For more information, see UpdateTable.

  • If you modify the schema of a search index by using an SDK to call the specific API operation, the operations are complex. We recommend that you modify the schema of a search index in the Tablestore console. For more information, see Dynamically modify the schema of a search index.

Request syntax

message UpdateSearchIndexRequest {
    optional string table_name = 1;
    optional string index_name = 2;
    optional string switch_index_name = 3;
    repeated QueryFlowWeight query_flow_weight = 4;
    optional int32 time_to_live = 5;  // unit is seconds
}

Parameter

Type

Required

Description

table_name

string

Yes

The name of the data table.

index_name

string

Yes

The name of the search index.

switch_index_name

string

No

The new name of the search index. This parameter is required only when you want to dynamically modify the schema of the search index.

query_flow_weight

QueryFlowWeight

No

The weight configurations. This parameter is required only when you want to dynamically modify the schema of the search index.

time_to_live

int32

No

The retention period of data in the search index. Unit: seconds.

The default value is -1, which specifies that the data never expires. The TTL must be at least 86,400 seconds (one day) or -1.

If the retention period of data exceeds the TTL, the data expires. Tablestore automatically deletes expired data.

The TTL of a search index is independent of and must be no greater than that of the data table for which the search index is created. If you want to decrease the TTL of a search index and the data table for which the search index is created, you must change the TTL of the search index before you change the TTL of the data table.

Response syntax

message UpdateSearchIndexResponse {
}

Check whether an HTTP status code 200 is returned to determine whether the call is successful.

  • If an HTTP status code 200 is returned, the call is successful.

  • If an HTTP status code 400 or 500 is returned, the call failed.

    An error message is returned for a failed call. For more information, see Error.

Use Tablestore SDKs

You can use the following Tablestore SDKs to update the TTL configurations of a search index: