All Products
Search
Document Center

Tablestore:Update time series metadata

Last Updated:Aug 03, 2026

Use Tablestore SDK for Java to update the attributes of multiple time series metadata entries and obtain errors for failed entries.

Prerequisites

Description

Call updateTimeseriesMeta to update the attributes of multiple time series metadata entries. If the specified metadata does not exist, the server adds it.

public UpdateTimeseriesMetaResponse updateTimeseriesMeta(UpdateTimeseriesMetaRequest request) throws TableStoreException, ClientException
Note

Time series metadata indexes are updated asynchronously. After you submit an update, wait for the index to be updated before you query the latest attributes.

The following example updates the status attribute of the specified time series in example_timeseries_table to online and checks failed entries.

Map<String, String> tags = new HashMap<>();
tags.put("region", "cn-hangzhou");
tags.put("host", "host_0");
TimeseriesKey timeseriesKey =
        new TimeseriesKey("cpu", "source_0", tags);

Map<String, String> attributes = new HashMap<>();
attributes.put("status", "online");
TimeseriesMeta meta = new TimeseriesMeta(timeseriesKey);
meta.setAttributes(attributes);

UpdateTimeseriesMetaRequest request =
        new UpdateTimeseriesMetaRequest("example_timeseries_table");
request.setMetas(Collections.singletonList(meta));
UpdateTimeseriesMetaResponse response =
        timeseriesClient.updateTimeseriesMeta(request);

for (UpdateTimeseriesMetaResponse.FailedRowResult result : response.getFailedRows()) {
    System.out.println(result.getIndex());
    System.out.println(result.getError());
}

Parameters

UpdateTimeseriesMetaRequest contains the following parameters.

Name

Type

Description

timeseriesTableName (required)

String

The time series table name.

metas (required)

List<TimeseriesMeta>

The non-empty list of time series metadata entries to update. You can update multiple entries in a request.

Time series metadata

Each element in metas[] is of the TimeseriesMeta type and contains the following parameters.

Name

Type

Description

timeseriesKey (required)

TimeseriesKey

The identifiers of the time series whose metadata you want to update.

attributes (optional)

SortedMap<String, String>

The metadata attributes to set as string key-value pairs. If this parameter is not specified or is set to an empty map, Tablestore SDK for Java does not send attribute content.

Note

updateTimeInUs is generated by the server and is returned when you query time series metadata. Do not set this field in an update request. Otherwise, Tablestore SDK for Java rejects the request.

Time series identifiers

metas[].timeseriesKey is of the TimeseriesKey type and contains the following parameters.

Name

Type

Description

measurementName (required)

String

The measurement name. Tablestore SDK for Java 5.17.2 and later allow this parameter to be empty.

dataSource (optional)

String

The data source identifier, which can be empty.

tags (optional)

SortedMap<String, String>

The tags as string key-value pairs. If this parameter is not specified, an empty map is used.

Response

UpdateTimeseriesMetaResponse contains the following operation-specific field.

Field

Type

Description

failedRows

List<UpdateTimeseriesMetaResponse.FailedRowResult>

Call getFailedRows() to obtain the metadata entries that failed to be updated. An empty list indicates that all entries are updated. You can also call isAllSuccess() to check whether all entries are updated.

Failed entry information

Each element in failedRows[] is of the UpdateTimeseriesMetaResponse.FailedRowResult type and contains the following fields.

Field

Type

Description

index

int

Call getIndex() to obtain the index of the failed metadata entry in the metas list of the request.

error

Error

Call getError() to obtain the failure reason.