/batches 路由提供关于异步操作批处理进度的信息。

批处理对象

{
  "uid": 0,
  "progress": {
    "steps": [
      { 
        "currentStep": "extracting words",
        "finished": 2,
        "total": 9,
      },
      {
        "currentStep": "document",
        "finished": 30546,
        "total": 31944,
      }
    ],
    "percentage": 32.8471
  },
  "details": {
    "receivedDocuments": 6,
    "indexedDocuments": 6
  },
  "stats": {
    "totalNbTasks": 1,
    "status": {
      "succeeded": 1
    },
    "types": {
      "documentAdditionOrUpdate": 1
    },
    "indexUids": {
      "INDEX_NAME": 1
    }, 
    "progressTrace": {  },
    "writeChannelCongestion": {  },
    "internalDatabaseSizes": {  },
    "embedderRequests": {
      "total": 12,
      "failed": 5,
      "lastError": "runtime error: received internal error HTTP 500 from embedding server\n  - server replied with `{\"error\":\"Service Unavailable\"}`"
    }
  },
  "duration": "PT0.250518S",
  "startedAt": "2024-12-10T15:20:30.18182Z",
  "finishedAt": "2024-12-10T15:20:30.432338Z",
  "batchStrategy": "batched all enqueued tasks"
}

uid

类型:整数
描述:批处理的唯一顺序标识符。从 0 开始,每个新批处理增加 1。

详情

类型:对象
描述:批处理中任务类型的基本信息。有关可能值的详尽列表,请查阅任务对象参考

进度

类型:对象
描述:包含两个字段的对象:stepspercentage。一旦 Meilisearch 完全处理完一个批处理,其 progress 将设置为 null

步骤

关于 Meilisearch 在此批处理中正在执行的当前操作的信息。一个步骤可能包含多个子步骤。
名称描述
currentStep描述操作的字符串
总数该步骤中的操作总数
finishedMeilisearch 已完成的操作数
如果 Meilisearch 处理批处理的时间超出了预期,请监控 steps 数组。如果 steps 数组中最后一项的 finished 字段没有更新,Meilisearch 可能已停滞。

百分比

已完成操作的百分比,根据所有当前步骤和子步骤计算。此值是一个粗略的估计,可能无法始终反映批处理的当前状态,因为不同步骤的处理速度不同。

统计

类型:对象
描述:批处理中所有任务负载的详细信息。

totalNbTasks

批处理中的任务数量。

状态

列出批处理中每个任务状态的对象。包含五个键,其值对应于该状态的任务数量。

类型

批处理中包含的任务类型列表。

indexUids

批处理中按其影响的索引分隔的任务数量列表。

progressTrace

批处理中执行的每个操作的完整路径列表,以及人类可读格式的处理时间。

writeChannelCongestion

包含索引期间计算的写入操作信息的对象。在诊断与写入速度相关的性能问题时可能有用。

internalDatabaseSizes

每个内部数据库的大小,包括批处理后变化了多少。

embedderRequests

包含对嵌入器发出的请求总数的对象。如果存在失败请求,还会显示失败请求的数量,以及最近一次失败的错误消息。 仅在至少有一个任务查询嵌入器的批处理中存在。此字段会持续更新,直到 Meilisearch 完成处理批处理。

持续时间

类型:字符串
描述:批处理在 processing 状态中花费的总时间,采用 ISO 8601 格式。当批处理正在处理任务时,设置为 null

startedAt

类型:字符串
描述:批处理开始处理的日期和时间,采用 RFC 3339 格式。

finishedAt

类型:字符串
描述:任务完成处理的日期和时间,无论是失败成功还是取消,采用 RFC 3339 格式。

batchStrategy

类型:字符串
描述:描述批处理创建逻辑的字符串。在诊断索引性能问题时可能包含有用信息。

获取批处理

GET
/batches
列出所有批处理,不区分索引。批处理对象包含在 results 数组中。 批处理始终按 uid 降序返回。这意味着默认情况下,最近创建的批处理对象会首先出现 批处理结果是分页的,并且可以使用查询参数进行过滤
/batches 的某些查询参数,例如 uidsstatuses,针对的是任务而不是批处理。例如,?uids=0 返回一个包含 taskUid 等于 0 的任务的批处理,而不是 batchUid 等于 0 的批处理。

查询参数

查询参数默认值描述
uids*(所有任务 uid)选择包含指定 uid 任务的批处理。多个任务 uid 用逗号 (,) 分隔。
batchUids*(所有批处理 uid)按批处理的 uid 过滤。多个批处理 uid 用逗号 (,) 分隔。
indexUids*(所有索引)选择包含影响指定索引的任务的批处理。多个 indexUids 用逗号 (,) 分隔。
statuses*(所有状态)选择包含指定 status 任务的批处理。多个任务 statuses 用逗号 (,) 分隔。
类型*(所有类型)选择包含指定 type 任务的批处理。多个任务 types 用逗号 (,) 分隔。
limit20要返回的批处理数量
from最后创建的批处理的 uid返回的第一个批处理的 uid
reversefalse如果为 true,则按相反顺序(从最旧到最新)返回结果
beforeEnqueuedAt*(所有任务)选择包含指定 enqueuedAt 字段的任务的批处理
beforeStartedAt*(所有任务)选择包含指定 startedAt 字段的任务的批处理
beforeFinishedAt*(所有任务)选择包含指定 finishedAt 字段的任务的批处理
afterEnqueuedAt*(所有任务)选择包含指定 enqueuedAt 字段的任务的批处理
afterStartedAt*(所有任务)选择包含指定 startedAt 字段的任务的批处理
afterFinishedAt*(所有任务)选择包含指定 finishedAt 字段的任务的批处理

响应

名称类型描述
results数组批处理对象数组
总数整数匹配筛选器或查询的批处理总数
limit整数返回的批处理数量
from整数返回的第一个批处理的 uid
next整数传递给 from 的值,用于查看结果的下一“页”。当 next 的值为 null 时,没有更多任务可查看。

示例

curl \
  -X GET 'http://MEILISEARCH_URL/batches'

响应:200 Ok

{
  "results": [
    {
      "uid": 2,
      "progress": null,
      "details": {
        "stopWords": [
          "of",
          "the"
        ]
      },
      "stats": {
        "totalNbTasks": 1,
        "status": {
          "succeeded": 1
        },
        "types": {
          "settingsUpdate": 1
        },
        "indexUids": {
          "INDEX_NAME": 1
        },
        "progressTrace": {  },
        "writeChannelCongestion": {  },
        "internalDatabaseSizes": {  },
        "embedderRequests": {
          "total": 12,
          "failed": 5,
          "lastError": "runtime error: received internal error HTTP 500 from embedding server\n  - server replied with `{\"error\":\"Service Unavailable\"}`"
        }
      },
      "duration": "PT0.110083S",
      "startedAt": "2024-12-10T15:49:04.995321Z",
      "finishedAt": "2024-12-10T15:49:05.105404Z",
      "batchStrategy": "batched all enqueued tasks"
    }
  ],
  "total": 3,
  "limit": 1,
  "from": 2,
  "next": 1
}

获取单个批处理

GET
/batches/{batch_uid}
获取单个批处理。

路径参数

名称类型描述
batch_uid *字符串请求批处理的uid

示例

curl \
  -X GET 'http://MEILISEARCH_URL/batches/BATCH_UID'

响应:200 Ok

{
  "uid": 1,
  "details": {
    "receivedDocuments": 1,
    "indexedDocuments": 1
  },
  "progress": null,
  "stats": {
    "totalNbTasks": 1,
    "status": {
      "succeeded": 1
    },
    "types": {
      "documentAdditionOrUpdate": 1
    },
    "indexUids": {
      "INDEX_NAME": 1
    },
    "progressTrace": {  },
    "writeChannelCongestion": {  },
    "internalDatabaseSizes": {  },
    "embedderRequests": {
      "total": 12,
      "failed": 5,
      "lastError": "runtime error: received internal error HTTP 500 from embedding server\n  - server replied with `{\"error\":\"Service Unavailable\"}`"
    }
  },
  "duration": "PT0.364788S",
  "startedAt": "2024-12-10T15:48:49.672141Z",
  "finishedAt": "2024-12-10T15:48:50.036929Z",
  "batchStrategy": "batched all enqueued tasks"
}
© . This site is unofficial and not affiliated with Meilisearch.