Searching Knowledge Bases
Function
Search for top-N most relevant document chunks in a specified knowledge base based on user query.
URI
POST /v1/{project_id}/applications/{application_id}/uni-search/experience/searchtext
Parameter | Mandatory | Type | Description |
|---|---|---|---|
project_id | Yes | String | Definition: Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. Constraints: N/A Value range: The value can contain 1 to 64 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed. The value must start with a letter. Default value: N/A |
application_id | Yes | String | Definition: Application ID. For details about how to obtain the application ID, see Obtaining an Application ID. Constraints: Character string Value range: The value can contain 1 to 64 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed. The value must start with a letter. Default value: N/A |
Request Parameters
Parameter | Mandatory | Type | Description |
|---|---|---|---|
X-Auth-Token | Yes | String | Definition: Token used for API authentication. For details about how to obtain the token, see Obtaining an IAM User Token. Constraints: N/A Value range: N/A Default value: N/A |
Response Parameters
Status code: 200
Parameter | Type | Description |
|---|---|---|
doc_list | Array of ChatReferenceInfo objects | Definition: Documents. Value range: N/A |
total | Integer | Definition: Total number. Value range: N/A |
Parameter | Type | Description |
|---|---|---|
file_id | String | Definition: File ID (or FAQ ID). Value range: N/A |
chunk_id | String | Definition: Block ID. Value range: N/A |
title | String | Definition: Title. Value range: N/A |
subtitle | String | Definition: Document subheading. Value range: N/A |
content | String | Definition: Text content. Value range: N/A |
big_content | String | Definition: Content context, for example, the original table that is not segmented. Note: (1) The search API may have a value. (2) The Q&A API replaces big_content with content, and this field is cleared. Value range: N/A |
doc_type | String | Definition: Document type. The value can be doc or faq. Value range: |
file_path | String | Definition: Document archive path. Value range: N/A |
category | String | Definition: Document directory, which corresponds to the leaf nodes in the directory tree. This parameter has only one value. Value range: N/A |
tags | Array of strings | Definition: Document tag list. Value range: N/A |
update_date_time | String | Definition: Update time. Value range: N/A |
repo_id | String | Definition: Knowledge base ID. Value range: N/A |
page_num | Long | Definition: Page number. Value range: N/A |
component_num | Long | Definition: Chunk sequence number. Value range: N/A |
score | Float | Definition: ES score. Value range: N/A |
additional_fields | Map<String,Object> | Definition: Used to store unknown fields. Value range: N/A |
elements | Array of strings | Definition: Data element in HTML. Value range: N/A Constraints: This parameter is supported only in clusters 25.7.T1 or later. |
pdf_coordinate | Object | Definition: Metadata used for PDF parsing and text locating. Example value: [ [ 202, 687 ], [ 1031, 687 ] ] Value range: N/A Constraints: This parameter is supported only in clusters 25.7.T1 or later. |
Example Requests
Search for top-N most relevant document chunks in a specified knowledge base based on user query.
/v1/123456/applications/123456/uni-search/experience/searchtext
{
"repo_id" : "1234abdc",
"content" : "Write a story that the leading role is sent to the Song Dynasty.",
"page_num" : 1,
"page_size" : 10
} Example Responses
Status code: 200
Search result response body.
{
"doc_list" : [ {
"file_id" : "123abc",
"title" : "AI.doc",
"content" : "AI",
"update_date_time" : "134554",
"doc_type" : "doc",
"file_path" : "uni-search/v1/AI.doc",
"score" : 0.9999
} ],
"total" : 12
} Status Codes
Status Code | Description |
|---|---|
200 | Search result response body. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot
