All Products
Search
Document Center

EventBridge:SearchKnowledgeBase

Last Updated:Oct 28, 2026

Searches 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

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

eventbridge:SearchKnowledgeBase

get

*KnowledgeBase

acs:eventbridge:{#regionId}:{#accountId}:catalog/{#Catalog}/namespace/{#Namespace}/knowledgebase/{#KnowledgeBaseName}

None None

Request parameters

Parameter

Type

Required

Description

Example

Catalog

string

Yes

The data catalog to which the knowledge base belongs. This parameter, together with Namespace and KnowledgeBaseName, uniquely identifies the knowledge base. You can call ListCatalogs to obtain the value.

my_catalog

Namespace

string

Yes

The namespace to which the knowledge base belongs. The namespace must belong to the specified data catalog. This parameter, together with Catalog and KnowledgeBaseName, uniquely identifies the knowledge base. You can call ListNamespaces to obtain the value.

my_namespace

KnowledgeBaseName

string

Yes

The name of the knowledge base. The name must be unique within the namespace. The name is specified upon creation and cannot be modified.

my-knowledge-base

Query

string

Yes

The retrieve text. Both keyword retrieve and AISearch are based on this text.

How to configure event rules

Mode

string

No

The retrieve mode. Valid values:

  • KEYWORD: keyword retrieve.

  • VECTOR: AISearch.

  • HYBRID: hybrid retrieve.

HYBRID

TopK

integer

No

The number of most relevant results to return. Default value: 10. Maximum value: 100.

10

MetadataFilter

string

No

Filters search results by document metadata. The value is a JSON expression tree. Nodes are divided into two types: logical nodes and leaf conditions. Logical nodes include {"AndAll": [child nodes...]} (all conditions met), {"OrAll": [child nodes...]} (any condition met), and {"NotAll": [child nodes...]} (no conditions met). Arbitrary nesting is supported. Leaf conditions are in the format of {"Key": field name, "Operator": operator, "Value": value}. For the In and NotIn operators, use "Values": [values...]. Valid values for Operator: Equals, NotEquals, In, NotIn, GreaterThan, GreaterThanOrEqual, LessThan, and LessThanOrEqual (the last four range operators apply only to LONG, DOUBLE, and DATETIME fields), StartsWith, and StringContains (applies only to STRING fields). The field must be declared in the knowledge base schema. The nesting depth cannot exceed 5, and the total number of leaf conditions cannot exceed 20. Valid formats for DATETIME field values: ISO-8601 with time zone, yyyy-MM-dd HH:mm:ss, or yyyy-MM-dd.

{"AndAll": [{"Key": "env", "Operator": "In", "Values": ["prod", "staging"]}, {"OrAll": [{"Key": "score", "Operator": "GreaterThan", "Value": "0.8"}, {"Key": "owner", "Operator": "Equals", "Value": "alice"}]}]}

Rerank

boolean

No

Specifies whether to enable reranking for search results. Default value: false.

false

RrfK

integer

No

Optional. Overrides the RRF fusion parameter k configured for the knowledge base in this request. This parameter takes effect only in HYBRID search mode and must be greater than 0.

60

RankAlgorithm

string

No

Optional. Overrides the fusion algorithm configured for the knowledge base in this request. This parameter takes effect only in HYBRID search mode. Valid values: RRF for reciprocal rank fusion, and WEIGHTED for weighted normalization fusion (used with VectorWeight). If you set this parameter to WEIGHTED in KEYWORD or VECTOR single mode, the InvalidParameter error is returned.

RRF

VectorWeight

number

No

Optional. The vector path weight for the WEIGHTED fusion algorithm. Valid values: 0 to 1. The keyword path weight is 1 minus this value. If this parameter is not specified, the value configured for the knowledge base is used. If no value is configured, the default value is 0.7.

0.7

RerankModel

string

No

Optional. Overrides the reranking model configured for the knowledge base in this request. This parameter takes effect when reranking is enabled across all search modes. Valid values: qwen3-rerank, gte-rerank-v2, and qwen3-vl-rerank. If this parameter is not specified, the value configured for the knowledge base is used. If no value is configured, the default value is qwen3-rerank. Score distributions of different models cannot be compared horizontally. We recommend that you use a fixed model for each knowledge base.

qwen3-rerank

Response elements

Element

Type

Description

Example

object

Code

string

The response code. A value of Success indicates success. If the call fails, a specific error code is returned.

Success

Data

object

The search results, which include the list of matched chunks and the time taken.

Chunks

array

The list of matched chunks, sorted by relevance.

[{"DocumentId":"doc-bp1xxxxxxxxxxxx","ChunkSeq":3,"Content":"EventBridge supports event routing."}]

KnowledgeBaseSearchChunk

The details of a single matched chunk, including the relevance score, chunk text, and location information.

TimeSpent

integer

The server-side processing time for this search, in milliseconds.

128

Message

string

The response message. The value is Operation success if the call is successful, or a specific error description if the call fails.

Operation success

RequestId

string

The request ID.

34AD682D-5B91-5773-8132-AA38C130****

Success

boolean

Indicates whether the call is successful. A value of true indicates success.

true

Examples

Success response

JSON format

{
  "Code": "Success",
  "Data": {
    "Chunks": [
      {
        "ChunkSeq": 12,
        "Content": "EventBridge supports routing events to multiple target services",
        "DocumentId": "doc-bp1xxxxxxxxxxxx",
        "FileName": "product-handbook.pdf",
        "Score": 0.92,
        "Scores": {
          "Fusion": 0.78,
          "Keyword": 0.62,
          "Rerank": 0.91,
          "Vector": 0.85
        },
        "SourceLocation": "p.3",
        "TitlePath": "Installation Guide>Prerequisites"
      }
    ],
    "TimeSpent": 128
  },
  "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
403 ServiceNotEnable Service not enable
404 KnowledgeBaseNotFound The specified knowledge base does not exist
404 CatalogNotFound The specified catalog does not exist
404 NamespaceNotFound The specified namespace does not exist
409 InvalidKnowledgeBaseStatus The knowledge base status does not support this operation

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.