Skip to main content
DELETE
取消索引任务

Authorizations

Authorization
string
header
required

每个请求都通过 API Key 认证:Authorization: Bearer {API_KEY}。应用接口使用应用 API Key,知识库接口使用知识库 API Key(快速开始)。

API Key 应保存在服务端,切勿嵌入客户端代码。缺失或无效的 Key 会返回 HTTP 401(unauthorized)。

Path Parameters

knowledge_base_id
string<uuid>
required

知识库 ID:即知识库 API 访问 对话框中所示服务 API 端点的最后一段(…/knowledge-fs/spaces/<knowledge base ID>),也是地址栏中 /datasets/new/ 之后的那一段。

task_id
string<uuid>
required

索引任务 ID,以下各处出现的都是同一个值:重新索引文档 响应中 queued 条目的 compilation_job.id、获取文档 返回的 latest_task.id、获取文档的索引任务列表 返回的 id,以及 获取后台任务列表 中 document 任务的 id。

Response

更新后的任务,其 stage 和 run_state 均为 canceled,且 completed_at 已有值。

base_head_revision
integer | null

内部字段,跟踪任务时无需使用。

candidate_fingerprint
string | null

内部字段,跟踪任务时无需使用。

candidate_publication_id
string | null

内部字段,跟踪任务时无需使用。

completed_at
number | null

任务进入终态阶段的时间,Unix 纪元毫秒。运行期间及重试后为 null。

created_at
number

任务创建时间,Unix 纪元毫秒。

document_asset_id
string

正在索引的文档文件 ID,可用于 获取文档文件。该值为发起此任务的 重新索引文档 请求项中的 asset.id,即使你提交的是文档 ID 也是如此。

error
string | null

简短的失败消息,可能与 failure.message 不同。仅当 stage 或 run_state 为 failed 时设置,其他情况下为 null,已取消的任务也是如此。

execution_attempts
integer | null

已执行的尝试次数。重试索引任务 会将其重置为 0,因此反复重试本身不会耗尽尝试次数上限。

failure
object | null

任务失败时的错误详情,否则为 null。

id
string

索引任务 ID。

knowledge_space_id
string

知识库的内部 ID,并非路径中的知识库 ID。

max_execution_attempts
integer | null

任务判定为失败前允许的尝试次数。

run_state
string | null

当前尝试的调度状态:

  • dispatch_pending:已受理,等待分派给工作进程。
  • queued:已分派,等待工作进程处理。
  • running:工作进程正在执行任务。
  • retry_wait:已安排自动重试,stage 保持不变。
  • succeeded:与 stage: published 同时出现。
  • failed、canceled:终态。
  • superseded:较新的一次尝试取代了本次尝试。属于终态,此时报告的阶段为 stage: canceled,取消和重试操作都不接受此状态的任务。

未设置时为 null。重试索引任务 会将其设为 dispatch_pending。

stage
string

索引阶段,按推进顺序:

  • queued
  • parsed
  • outline_built
  • nodes_generated
  • projection_built
  • smoke_eval_passed
  • published

published 表示新修订版本已生效。failed 和 canceled 是另外两个终态值。重试索引任务 会保留该次尝试已到达的检查点,因此重试后该值很少为 queued。

updated_at
number

任务最后变更时间,Unix 纪元毫秒。

version
integer

正在索引的文档文件的版本。