All Products
Search
Document Center

Tablestore:Update search index configurations

Last Updated:Aug 07, 2026

Use the Tablestore SDK for Go to update the TTL of a search index or adjust traffic and switch indexes during dynamic schema modification.

Prerequisites

Install the Tablestore Go SDK and initialize a client.

Description

Call UpdateSearchIndex to update the TTL of a search index. During dynamic schema modification, you can also use this method to set query traffic weights for the source and reindex indexes or switch the two indexes. For the complete workflow, see Dynamically modify a search index schema.

func (client *tablestore.TableStoreClient) UpdateSearchIndex(request *tablestore.UpdateSearchIndexRequest) (*tablestore.UpdateSearchIndexResponse, error)
ttl := int32(7 * 24 * 60 * 60)
_, err := client.UpdateSearchIndex(&tablestore.UpdateSearchIndexRequest{
    TableName:  "example_table",
    IndexName:  "example_index",
    TimeToLive: &ttl,
})
if err != nil {
    log.Fatal(err)
}

Parameters

Name

Type

Description

TableName (required)

string

The name of the data table.

IndexName (required)

string

The name of the search index to update.

TimeToLive (optional)

*int32

The TTL of index data in seconds. Valid values are -1 and int32 integers no less than 86,400. -1 indicates that data never expires. For a non--1 value, UpdateRow updates must be disabled, and the index TTL cannot exceed the table TTL. For more information, see Configure the TTL of a search index.

QueryFlowWeights (optional)

[]*tablestore.QueryFlowWeight

The query traffic weights for the source and reindex indexes. The Weight values must add up to 100.

SwitchIndexName (optional)

*string

The reindex index whose target is switched with IndexName.

Query traffic weight

Name

Type

Description

IndexName (required)

string

The source or reindex index name.

Weight (required)

int32

The query traffic weight.