All Products
Search
Document Center

Tablestore:Update document

Last Updated:Sep 24, 2026

Use the UpdateDocument operation to update the metadata of a specified document. The document to be updated must be in the completed state. The metadata is updated by overwrite: the provided value fully replaces the existing metadata. If you want to update only one field, you must include all fields. Passing "metadata": null clears all metadata.

Prerequisites

  • An AgentStorage instance has been created and is in the normal state, and you have obtained the instance endpoint and instance name.

  • An API Key has been created.

  • The document to be updated is in the completed state.

Request parameters

Parameter

Type

Description

knowledgeBaseName

string

The name of the knowledge base. Required.

subspace

string

The name of the subspace. Required when subspace is enabled.

ossKey

string

The OSS path of the document. Mutually exclusive with docId.

docId

string

The document ID. Mutually exclusive with ossKey.

metadata

map

The new metadata. Optional. If this field is omitted, the original value is retained and NO_OP is returned. If you explicitly pass null, all metadata is cleared. If you pass an object, the existing metadata is fully replaced.

Sample request

When you use API Key authentication, pass the instance name and API Key through the x-ots-instancename and x-ots-apikey request headers.

curl -X POST https://<endpoint>/UpdateDocument \
  -H "x-ots-instancename: <instance-name>" \
  -H "x-ots-apikey: <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
  "knowledgeBaseName": "product_docs_kb",
  "subspace": "default",
  "ossKey": "oss://example-bucket/docs/manual.pdf",
  "metadata": {"author": "Li Si", "date": "2026-02-01 12:00:00", "score": 80}
}'

Response

Field

Type

Description

docId

string

The document ID.

ossKey

string

The OSS path.

updatedAt

long

The update timestamp.

updateStatus

string

NO_OP or UPDATED.