文档与分段
重新索引文档
为每个选中的文档排入一个索引任务,根据其当前文件重建索引。返回一个批量任务 ID,用于统一跟踪这些任务。
all: true 和 documentIds 必须且只能提供其中一个。
不会重新上传任何文件。用 compilation_job.id 通过 获取索引任务 跟踪单个任务,通过 获取批量任务 跟踪整个请求。
重新索引流程详见 重新索引并跟踪索引进度。
POST
/
knowledge-fs
/
spaces
/
{knowledge_base_id}
/
documents
/
reindex
curl --request POST \
--url https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/reindex \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"all": true
}'{
"bulk_job_id": "5a1c2e3d-7b8f-4a9c-8d1e-2f3a4b5c6d7e",
"items": [
{
"asset": {
"created_at": "2026-09-03T10:02:11Z",
"filename": "handbook.pdf",
"id": "6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b",
"knowledge_space_id": "9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b",
"metadata": {},
"mime_type": "application/pdf",
"object_key": "1a7c9e40-2b3d-4f56-8a90-b1c2d3e4f506/spaces/9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b/documents/6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b/handbook.pdf",
"parser_status": "parsed",
"sha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"size_bytes": 482113,
"source_id": null,
"updated_at": null,
"version": 1
},
"code": null,
"compilation_job": {
"id": "e4a1f0b2-7c3d-4e5f-9a1b-2c3d4e5f6a7b",
"stage": "queued"
},
"document_id": null,
"error": null,
"status": "queued",
"status_url": "/knowledge-spaces/9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b/documents/3d2f1c0b-9a8e-4d7c-b6a5-4f3e2d1c0b9a/processing-tasks/e4a1f0b2-7c3d-4e5f-9a1b-2c3d4e5f6a7b"
},
{
"asset": null,
"code": null,
"compilation_job": null,
"document_id": "8f14e45f-ceea-467a-9575-62c9a2d3e6b1",
"error": null,
"status": "not_found",
"status_url": null
}
],
"total": 2
}Authorizations
每个请求都通过 API 密钥认证:Authorization: Bearer {API_KEY}。应用接口使用应用 API 密钥,知识库接口使用知识库 API 密钥(快速开始)。
API 密钥应保存在服务端,切勿嵌入客户端代码。缺失或无效的密钥会返回 HTTP 401(unauthorized)。
Headers
Path Parameters
Body
application/json
标记为 nullable 的可选字段,传 null 等同于省略。
规范化后的请求不得超过 1,048,576 个 UTF-8 字节。参见 请求大小限制。
- 全部文档
- 指定文档
发送 all: true 或非空的 documentIds 数组,二者不可同时发送。使用 documentIds 时,all 可省略,也可为 false 或 null。使用 all: true 时,documentIds 可省略或为 null;空数组会被拒绝。
Response
索引任务已排入队列。
批量任务 ID。通过 获取批量任务 轮询。
Was this page helpful?
⌘I
curl --request POST \
--url https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/reindex \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"all": true
}'{
"bulk_job_id": "5a1c2e3d-7b8f-4a9c-8d1e-2f3a4b5c6d7e",
"items": [
{
"asset": {
"created_at": "2026-09-03T10:02:11Z",
"filename": "handbook.pdf",
"id": "6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b",
"knowledge_space_id": "9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b",
"metadata": {},
"mime_type": "application/pdf",
"object_key": "1a7c9e40-2b3d-4f56-8a90-b1c2d3e4f506/spaces/9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b/documents/6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b/handbook.pdf",
"parser_status": "parsed",
"sha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"size_bytes": 482113,
"source_id": null,
"updated_at": null,
"version": 1
},
"code": null,
"compilation_job": {
"id": "e4a1f0b2-7c3d-4e5f-9a1b-2c3d4e5f6a7b",
"stage": "queued"
},
"document_id": null,
"error": null,
"status": "queued",
"status_url": "/knowledge-spaces/9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b/documents/3d2f1c0b-9a8e-4d7c-b6a5-4f3e2d1c0b9a/processing-tasks/e4a1f0b2-7c3d-4e5f-9a1b-2c3d4e5f6a7b"
},
{
"asset": null,
"code": null,
"compilation_job": null,
"document_id": "8f14e45f-ceea-467a-9575-62c9a2d3e6b1",
"error": null,
"status": "not_found",
"status_url": null
}
],
"total": 2
}