All Products
Search
Document Center

PolarDB:UpdateKnowledgeBaseFileShardingStrategy

Last Updated:Sep 01, 2026

Updates the chunking strategy for a file in a knowledge base.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

POST  HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The ID of the region where the knowledge base resides.

cn-beijing

KnowledgeBaseId

string

Yes

The unique ID of the knowledge base.

pkb-2zesv6l6a63xsrym

FileId

string

Yes

The unique ID of the knowledge base file.

e347ddb8-49bb-5c66-94bc-fa05cedaeac8

ShardingStrategyConfig

object

No

The file-level chunking strategy configuration. This parameter is required when InheritSpaceStrategy is not set to true.

DefaultStrategy

object

Yes

The default chunking strategy. This strategy is used when no rule is matched.

Type

string

Yes

The type of the default chunking strategy. Valid values:

  • hybrid: Splits by document structure and limits the token count.

  • hierarchical: Splits only by document structure.

hybrid

Parameters

object

No

The parameters of the default chunking strategy. MaxTokens and MergePeers are supported only when Type is set to hybrid.

MaxTokens

integer

No

The maximum number of tokens per chunk. The value must be a positive integer. This parameter takes effect only when Type is set to hybrid.

512

MergePeers

boolean

No

Specifies whether to merge adjacent small chunks under the same heading. This parameter takes effect only when Type is set to hybrid.

true

Rules

array<object>

No

The list of override rules that are matched in order. Currently, a maximum of one exact-match rule with ContentType set to table is supported.

array<object>

No

Match

object

Yes

The rule match condition. Currently, only exact matching by content type for table content is supported.

ContentType

string

No

The content type. Currently, only table is supported, which matches content that is parsed as tables.

table

Strategy

object

Yes

The chunking strategy to use when the rule is matched.

Type

string

Yes

The chunking strategy type of the override rule. Valid values:

  • hybrid

  • hierarchical

hierarchical

Parameters

object

No

The chunking strategy parameters of the override rule. MaxTokens takes effect only when Type is set to hybrid. MarkdownTables supports auto, on, or off.

MaxTokens

integer

No

The maximum number of tokens per chunk for matched content. The value must be a positive integer. This parameter takes effect only when Type is set to hybrid.

512

MarkdownTables

string

No

The Markdown table processing mode. Valid values:

  • auto: Automatically determines the processing mode.

  • on: Forcefully enables Markdown table processing.

  • off: Disables Markdown table processing.

auto

InheritSpaceStrategy

boolean

No

Specifies whether to restore inheritance of the chunking strategy from the knowledge space. When this parameter is set to true, ShardingStrategyConfig cannot be specified at the same time.

false

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID.

019F7F29-BF69-1734-AE5A-02D391385BAC

Examples

Success response

JSON format

{
  "RequestId": "019F7F29-BF69-1734-AE5A-02D391385BAC"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.