Creates a knowledge base.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
eventbridge:CreateKnowledgeBase |
create |
*KnowledgeBase
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| KnowledgeBaseName |
string |
Yes |
The name of the knowledge base. The name must be unique within the same namespace. |
product-docs |
| Description |
string |
No |
The description of the knowledge base. |
Product documentation knowledge base |
| MetadataSchema |
array<object> |
Yes |
Declares the metadata fields for the knowledge base. When you upload documents, the metadata can only contain the fields declared here. This parameter cannot be modified after the knowledge base is created. |
[{"Name":"department","Type":"STRING"}] |
|
object |
No |
The metadata field. |
||
| Name |
string |
Yes |
The name of the field. |
department |
| Type |
string |
Yes |
The type of the field. Valid values: STRING, LONG, DOUBLE, BOOLEAN, and DATETIME. |
STRING |
| Value |
string |
No |
The value configuration. If ValueMode is set to CONSTANT, this parameter specifies a fixed value. If it is left empty, you can assign a value during upload. If ValueMode is set to SYSTEM_VARIABLE, this parameter specifies a system variable name, such as DOCUMENT_NAME, FILE_TYPE, FILE_SIZE, DOCUMENT_UPLOAD_TIME, SOURCE_TYPE, SOURCE_URI, or SOURCE_MODIFIED_TIME. |
EventHouse |
| ValueMode |
string |
Yes |
The value mode. CONSTANT indicates a constant. If Value is not empty, all documents use the fixed value. If Value is empty, you can assign a value during upload. SYSTEM_VARIABLE indicates a system variable. Value specifies the variable name, which is automatically generated by the system and cannot be overwritten during upload. |
CONSTANT |
| Catalog |
string |
Yes |
The EventHouse catalog to which the knowledge base belongs. This parameter, together with Namespace and KnowledgeBaseName, uniquely identifies the knowledge base. This parameter cannot be modified after the knowledge base is created. You cannot bind a system catalog. |
my_catalog |
| Namespace |
string |
Yes |
The EventHouse namespace to which the knowledge base belongs. The namespace must belong to the specified catalog. This parameter, together with Catalog and KnowledgeBaseName, uniquely identifies the knowledge base. This parameter cannot be modified after the knowledge base is created. |
my_namespace |
| EmbeddingModel |
string |
No |
Optional. The embedding model. This parameter cannot be modified after the knowledge base is created. Valid values: text-embedding-v3, text-embedding-v4, qwen3.7-text-embedding, and qwen3.7-text-embedding-flash. Only Qwen models provided by Model Studio are supported. Third-party models are not supported. Default value: text-embedding-v4. |
text-embedding-v4 |
| EmbeddingDimension |
integer |
No |
Optional. The vector dimensions. This parameter is attached to the embedding model for validation. Valid values for text-embedding-v3: 64, 128, 256, 512, 768, and 1024. Valid values for text-embedding-v4: 64, 128, 256, 512, 768, 1024, 1536, and 2048. Valid values for qwen3.7-text-embedding: 256, 512, 768, 1024, 1536, 2048, and 2560. Valid values for qwen3.7-text-embedding-flash: 256, 512, 768, and 1024. If this parameter is not specified, the default dimension of the model, 1024, is used. This parameter cannot be modified after the knowledge base is created. To change the model, you must rebuild the knowledge base, even if the dimensions remain the same. |
1024 |
| ChunkConfiguration |
object |
No |
Optional. The default chunking strategy for the knowledge base. This strategy applies only to documents uploaded after the configuration. If this parameter is not specified, the system default chunking strategy is used. |
|
| HeadingLevel |
integer |
No |
Required for the BY_HEADING strategy. Valid values: 1 to 6. This parameter is ignored for other strategies. Headings at or above the specified level are used as chunking boundaries. For example, if you set this parameter to 2, both H1 and H2 headings are used as boundaries. Lower-level headings are not used as boundaries and are retained in the chunk text. If the section content exceeds MaxChunkSize, the system falls back to chunking by paragraph or sentence. For documents without headings, the system falls back to intelligent chunking. |
2 |
| MaxChunkSize |
integer |
No |
The maximum number of characters in a single chunk. Valid values: 1 to 6000. An error is reported if the limit is exceeded. |
512 |
| OverlapSize |
integer |
No |
Applies only to the BY_LENGTH strategy. This parameter is ignored for other strategies. The overlap size between adjacent chunks, in characters. If the value is greater than 0, the beginning of the next chunk repeats the content at the end of the previous chunk within this window. The overlap does not cause the chunk to exceed MaxChunkSize. Default value: 0, which indicates no overlap. |
40 |
| PreprocessRules |
object |
No |
The preprocessing rules. |
|
| RemoveUrlsAndEmails |
boolean |
No |
Specifies whether to remove URLs and email addresses during parsing. |
false |
| ReplaceConsecutiveWhitespace |
boolean |
No |
Specifies whether to replace consecutive whitespace characters, such as spaces, line breaks, and tabs, with a single space. |
true |
| Separator |
string |
No |
Required for the BY_SEPARATOR strategy. This parameter is ignored for other strategies. The literal string used to split the text. Regular expressions are not supported. The maximum length is 32 characters. Example: \n\n for paragraph breaks. |
\\n\\n |
| Strategy |
string |
Yes |
The chunking strategy. AUTO indicates intelligent chunking, which is heading-aware and groups paragraphs. BY_LENGTH indicates sliding window chunking by length, where you can specify OverlapSize. BY_SEPARATOR indicates chunking by separator, where you must specify Separator. BY_HEADING indicates chunking by heading level, where you must specify HeadingLevel. Valid values: AUTO, BY_LENGTH, BY_SEPARATOR, and BY_HEADING. |
BY_SEPARATOR |
| SearchConfiguration |
object |
No |
Optional. The default search configuration at the knowledge base level. This configuration takes effect when the corresponding parameters are not specified in a search request. You can modify this configuration by calling UpdateKnowledgeBase after the knowledge base is created. |
|
| Mode |
string |
No |
The search mode. KEYWORD indicates keyword retrieve. VECTOR indicates AISearch. HYBRID indicates hybrid retrieve. Valid values: KEYWORD, VECTOR, and HYBRID. |
HYBRID |
| RankAlgorithm |
string |
No |
Applies only to the hybrid search mode. RRF indicates reciprocal rank fusion. WEIGHTED indicates weighted normalization fusion, which is used together with VectorWeight. Default value: RRF. |
RRF |
| RerankEnabled |
boolean |
No |
Applies only to the hybrid search mode. Specifies whether to enable reranking by default when a search request does not specify the Rerank parameter. |
false |
| RerankModel |
string |
No |
The default rerank model used when a search request does not specify the RerankModel parameter. Valid value: qwen3-rerank. Default value: qwen3-rerank. |
qwen3-rerank |
| RrfK |
integer |
No |
The k parameter for the RRF fusion algorithm. The value must be greater than 0. Default value: 60. |
60 |
| TopK |
integer |
No |
The default number of results to return. |
20 |
| VectorWeight |
number |
No |
The vector weight for the WEIGHTED fusion algorithm. Valid values: 0 to 1. The keyword weight is 1 minus this value. Default value: 0.7. |
0.7 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
string |
The response code. Success indicates that the call was successful. If the call fails, a specific error code is returned. |
Success |
| Data | KnowledgeBase |
The details of the created knowledge base, including the name, status, and configuration information. |
|
| Message |
string |
The response message. Operation success is returned if the call is successful. A specific error description is returned if the call fails. |
Operation success |
| RequestId |
string |
The request ID. |
34AD682D-5B91-5773-8132-AA38C130**** |
| Success |
boolean |
Indicates whether the call was successful. A value of true indicates success. |
true |
Examples
Success response
JSON format
{
"Code": "Success",
"Data": {
"Catalog": "my_catalog",
"ChunkConfiguration": {
"HeadingLevel": 2,
"MaxChunkSize": 600,
"OverlapSize": 40,
"PreprocessRules": {
"RemoveUrlsAndEmails": false,
"ReplaceConsecutiveWhitespace": true
},
"Separator": "\\\\n\\\\n",
"Strategy": "BY_SEPARATOR"
},
"CreatedAt": "2026-08-24T10:00:00Z",
"Description": "Product documentation knowledge base",
"EmbeddingDimension": 1024,
"EmbeddingModel": "text-embedding-v4",
"FailureReason": "OssException: BucketAlreadyExists ...",
"KnowledgeBaseName": "product-docs",
"MetadataSchema": [
{
"Name": "department",
"Type": "STRING",
"Value": "EventHouse",
"ValueMode": "CONSTANT"
}
],
"Namespace": "my_namespace",
"SearchConfiguration": {
"Mode": "HYBRID",
"RankAlgorithm": "RRF",
"RerankEnabled": false,
"RerankModel": "qwen3-rerank",
"RrfK": 60,
"TopK": 20,
"VectorWeight": 0.7
},
"Status": "ACTIVE",
"UpdatedAt": "2026-08-24T10:00:00Z"
},
"Message": "Operation success",
"RequestId": "34AD682D-5B91-5773-8132-AA38C130****",
"Success": true
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter | The specified parameter is invalid | |
| 400 | InvalidMetadata | The specified metadata is invalid or contains fields not declared in the knowledge base schema | |
| 400 | InvalidMetadataSchema | The specified metadata schema is invalid | |
| 400 | QuotaExceeded | The quota is exceeded | |
| 400 | InvalidCatalog | The specified catalog is a system catalog and cannot be bound | |
| 403 | ServiceNotEnable | Service not enable | |
| 404 | CatalogNotFound | The specified catalog does not exist | |
| 404 | NamespaceNotFound | The specified namespace does not exist |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.