Updated on 2025-08-13 GMT+08:00

Searching the Knowledge Base

Function

This API is used to search for top N segment files in a specified knowledge.

URI

POST /v1/koosearch/experience/search

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Parameter description:

Token used for API authentication. For how to obtain the token, see section 3.2 "Authentication."

Constraints:

N/A.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

repo_id

Yes

String

Parameter description:

Knowledge base ID.

How to obtain:

Log in to the KooSearch experience platform. In the navigation tree on the left, choose Knowledge Bases to view knowledge base IDs. Each knowledge base has a unique ID stored in the vector database.

Constraints:

N/A.

extra_repo_ids

No

Array of strings

Parameter description:

List of referenced knowledge base IDs, which is used to support joint retrieval of multiple knowledge bases.

Constraints:

Not limited.

content

Yes

String

Parameter description:

Query

Constraints:

N/A.

page_num

Yes

Integer

Parameter description:

Total number of pages in the returned result. The value ranges from 1 to 1000.

Constraints:

N/A.

page_size

Yes

Integer

Parameter description:

Number of records on each page. The value ranges from 1 to 9000.

Constraints:

N/A.

filter_string

No

String

Parameter description:

A query string with syntax. A parser with strict syntax is used to return documents based on the provided query string.

Example: 'tags:(education OR finance) AND category:"industry knowledge"'

Example: If segments need to be filtered based on the document ID, use '"fileId": "f6a050ffef5512e80a6dea57e386f194"'.

Constraints:

  1. Boolean operators AND, OR, and NOT (also written as &&, ||, and !) are supported, but note that they do not follow the usual precedence rules. Parentheses should be used as long as multiple operators are used together.

  2. If you use reserved characters in your query string, you will need to escape them using "\". These characters include: + - = && || > <! ( ) { } [ ] ^ " ~ * ? : \ /. For example, \!.

  3. [For the query string syntax, see the following:] (https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax)

scope

No

String

Parameter description:

Search scope scope. Currently, three configurations are supported.

Options:

doc: document knowledge, using the query2doc model.

faq: FAQ, using the query2query model.

web: web source, from the web search engine.

Constraints:

N/A.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

doc_list

Array of ChatReferenceInfo objects

List of found document segments.

total

Integer

Parameter description:

Total number of found reference document segments.

Constraints:

N/A.

Table 4 ChatReferenceInfo

Parameter

Type

Description

file_id

String

Parameter description:

Document ID (or FAQ ID) of the reference document segment source.

Constraints:

N/A.

title

String

Parameter description:

Title of the document where the referenced segment originates.

Constraints:

N/A.

content

String

Parameter description:

Referenced document segments.

Constraints:

N/A.

big_content

String

Parameter description:

Reference document 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.

Constraints:

N/A.

update_date_time

String

Parameter description:

Update time of the reference document segment.

Constraints:

N/A.

doc_type

String

Parameter description:

Type of the referenced segment source (doc: document; faq: FAQ).

Constraints:

N/A.

file_path

String

Parameter description:

Archive path of the reference document shard.

Constraints:

N/A.

category

String

Parameter description:

Document directory, which corresponds to the leaf nodes in the directory tree. This parameter has only one value.

Constraints:

N/A.

tags

Array of strings

Parameter description:

Document tag list.

Constraints:

N/A.

score

Float

Parameter description:

Relevance score of the query and the current reference shard. A higher score indicates a higher relevance.

Constraints:

N/A.

subtitle

String

Parameter description:

Subtitle of the current reference segment in the original text.

Constraints:

N/A.

repo_id

String

Parameter description:

ID of the current knowledge base.

Constraints:

N/A.

chunk_id

String

Parameter description:

ID of the current document chunk.

Constraints:

N/A.

page_num

Integer

Parameter description:

Page number of the current document chunk in the document.

Constraints:

N/A.

component_num

Integer

Parameter description:

Sequence number of the current document segment in the document.

Constraints:

N/A.

Example Requests

POST https://{endpoint}/v1/koosearch/experience/search

{
  "repo_id" : "acd90739-2e22-4870-b2db-35018699b623",
  "content" : "Abnormal engine",
  "page_num" : 1,
  "page_size" : 10,
  "scope" : "doc",
  "extra_repo_ids" : [ ]
}

Example Responses

Status code: 200

Search result response body

{
  "doc_list" : [ {
    "file_id" : "b7947c56436d29bf7671844d7f57371e",
    "chunk_id" : "0512b8fe109941208de99b4470ab2de3",
    "title" : "Engine Abnormal.txt",
    "subtitle" : "Engine Abnormal\n1. Engine start failure:",
    "content" : "This may be due to water infiltration into key components such as the distributor, ignition module, spark plugs, or high-voltage wires during engine cleaning.\nDamaged spark plugs can also prevent engine start.\nInsufficient battery power is another significant factor.\nAdditionally, the disconnection of the inertia switch may also cause starting difficulties.",
    "file_path" : "uni-search/files/b25446daeb1a41a7953c5deba2b2677a/fb9731ab-7085-474f-b6c7-64473586f0f3/acd90739-2e22-4870-b2db-35018699b623/b7947c56436d29bf7671844d7f57371e/ Engine Abnormal.txt",
    "category" : "",
    "update_date_time" : "1731049431522",
    "repo_id" : "acd90739-2e22-4870-b2db-35018699b623",
    "page_num" : 1,
    "component_num" : 2,
    "score" : 0.99415743
  }, {
    "file_id" : "b7947c56436d29bf7671844d7f57371e",
    "chunk_id" : "4c6f4eabbc1c44099ff2f1db3a9f8987",
    "title" : "Engine Abnormal.txt",
    "subtitle" : "Engine Abnormal",
    "content" : "Engine abnormalities often stem from multiple factors. Below are some typical conditions and their potential causes:",
    "file_path" : "uni-search/files/b25446daeb1a41a7953c5deba2b2677a/fb9731ab-7085-474f-b6c7-64473586f0f3/acd90739-2e22-4870-b2db-35018699b623/b7947c56436d29bf7671844d7f57371e/ Engine Abnormal.txt",
    "category" : "",
    "update_date_time" : "1731049431522",
    "repo_id" : "acd90739-2e22-4870-b2db-35018699b623",
    "page_num" : 1,
    "component_num" : 1,
    "score" : 0.98771137
  }, {
    "file_id" : "b7947c56436d29bf7671844d7f57371e",
    "chunk_id" : "ed56718be0864f15a17ec209a3ba07ca",
    "title" : "Engine abnormal.txt",
    "subtitle" : "Engine abnormal\n3. The steering wheel shakes during high-speed driving.",
    "content" : "If the tires are not balanced after disassembly and assembly, the steering wheel may shake at high speeds.\nThe detachment of balance weights on the wheels may also cause shaking.\nAdditionally, mud attached to the wheels or deformation of the wheels due to impact may also cause instability in the steering wheel.\nPlease note that the above is for reference only. In the event of any engine abnormality, it is recommended to seek professional repair personnel immediately to ensure driving safety.",
    "file_path" : "uni-search/files/b25446daeb1a41a7953c5deba2b2677a/fb9731ab-7085-474f-b6c7-64473586f0f3/acd90739-2e22-4870-b2db-35018699b623/b7947c56436d29bf7671844d7f57371e/ Engine abnormal.txt",
    "category" : "",
    "update_date_time" : "1731049431522",
    "repo_id" : "acd90739-2e22-4870-b2db-35018699b623",
    "page_num" : 1,
    "component_num" : 4,
    "score" : 0.95791227
  }, {
    "file_id" : "b7947c56436d29bf7671844d7f57371e",
    "chunk_id" : "fa3bdf2e57344327bf4c8466e6f54c9a",
    "title" : "Engine abnormal.txt",
    "subtitle" : "Engine abnormal\n2. The engine suddenly shuts down during gear shifting.",
    "content" : "A too low idle speed may be the culprit of gear shifting and engine shutdown.\nIf the idle stop valve is not tightened, this problem may also occur.\nIn addition, selecting a high gear or severe blockage of the oil-gas separator are potential causes of engine shutdown.",
    "file_path" : "uni-search/files/b25446daeb1a41a7953c5deba2b2677a/fb9731ab-7085-474f-b6c7-64473586f0f3/acd90739-2e22-4870-b2db-35018699b623/b7947c56436d29bf7671844d7f57371e/ Engine abnormal.txt",
    "category" : "",
    "update_date_time" : "1731049431522",
    "repo_id" : "acd90739-2e22-4870-b2db-35018699b623",
    "page_num" : 1,
    "component_num" : 3,
    "score" : 0.9533619
  }, {
    "file_id" : "22b179b9de0ad941215cc7f052ab10f8",
    "chunk_id" : "483faffeeb284d20a23378a7d18e9ff1",
    "title" : "Engine Faults and Symptoms.txt",
    "subtitle" : "Engine Faults and Symptoms",
    "content" : "1. Difficulty in starting: The engine cannot start smoothly, which may be caused by insufficient battery power, spark plug problems, or fuel system blockage.\n2. Unstable idle speed: The engine runs unstably at idle speed, which may cause engine shutdown or severe shaking. This may be caused by problems in the air intake system, fuel system, or ignition system.\n3. Reduced power: The engine acceleration performance deteriorates, and the climbing ability decreases, which may be caused by problems in the fuel system, ignition system, or exhaust system.\n4. Increased fuel consumption: The fuel consumption of the engine increases abnormally, which may be caused by problems in the fuel system, ignition system, or sensors.\n5. Abnormal noise: Abnormal noise occurs during engine running, which may be caused by mechanical component wear, lubrication system problems, or belt loosening.\n6. Overheating: The engine temperature is too high, which may cause the overheat protection switch to start and stop the engine. This may be caused by cooling system faults, water pump faults, or radiator blockage.\n7. Oil leakage: Fuel, engine oil, or other liquid leakage occurs inside or outside the engine, which may be caused by aging seals, loose fasteners, or oil circuit blockage.\n8. Oil burning: Excessive engine oil consumption may be caused by worn piston rings, damaged valve oil seals, or crankcase ventilation system faults.\n9. Excessive emission: The engine exhaust emission exceeds the national standard, which may be caused by problems in the fuel system, ignition system, or exhaust system.",
    "file_path" : "uni-search/files/b25446daeb1a41a7953c5deba2b2677a/fb9731ab-7085-474f-b6c7-64473586f0f3/acd90739-2e22-4870-b2db-35018699b623/22b179b9de0ad941215cc7f052ab10f8/ Engine Faults and Symptoms.txt",
    "category" : "",
    "update_date_time" : "1731049431328",
    "repo_id" : "acd90739-2e22-4870-b2db-35018699b623",
    "page_num" : 1,
    "component_num" : 1,
    "score" : 0.81047887
  }, {
    "file_id" : "22b179b9de0ad941215cc7f052ab10f8",
    "chunk_id" : "389497084e3f44e589b635f9a1ef4f2f",
    "title" : "Engine Faults and Symptoms.txt",
    "subtitle" : "Engine Faults and Symptoms",
    "content" : "10. Sensor fault: Some sensors in the engine control system are faulty. As a result, the engine may run unstably, the performance may deteriorate, or the alarm indicator may be on.",
    "file_path" : "uni-search/files/b25446daeb1a41a7953c5deba2b2677a/fb9731ab-7085-474f-b6c7-64473586f0f3/acd90739-2e22-4870-b2db-35018699b623/22b179b9de0ad941215cc7f052ab10f8/ Engine Faults and Symptoms.txt",
    "category" : "",
    "update_date_time" : "1731049431328",
    "repo_id" : "acd90739-2e22-4870-b2db-35018699b623",
    "page_num" : 1,
    "component_num" : 2,
    "score" : 0.74223495
  } ],
  "total" : 6
}

Status Codes

Status Code

Description

200

Search result response body

Error Codes

See Error Codes.