This plugin is part of the Kuzzle Enterprise Plan. If you are interested, please contact us.

status #

Returns the current (or last) job, the last background reindex, and every archive waiting for a purge. With a jobId, returns that job only, with the plan it applied. With subscribe: true (WebSocket or MQTT only), also subscribes the connection to the job's realtime progress.

See Following a migration.


Query Syntax #

HTTP #

URL: http://kuzzle:7512/_/mapping-migration/migration/status
URL: http://kuzzle:7512/_/mapping-migration/migration/status?jobId=<jobId>
URL: http://kuzzle:7512/_/mapping-migration/migration/status?index=<index>&collection=<collection>
Method: GET

Other protocols #

{
  "controller": "mapping-migration/migration",
  "action": "status",
  "jobId": "<jobId>",          // optional
  "index": "<index>",          // optional, with collection
  "collection": "<collection>", // optional, with index
  "subscribe": true            // optional, WebSocket or MQTT only
}

Kourou #

kourou mapping-migration/migration:status -a jobId=<jobId>

Arguments #

ArgumentTypeDescription
jobIdstringOnly that job, the current one or an archived one, with the plan it applied (changes). No reindex, no archives then; index and collection are ignored
index, collectionstringBoth or neither: the last reindex of that collection instead of the last one of the cluster
subscribebooleanAlso join the job's progress room: one message at each phase change or error, at most one every progressInterval during the copy. Refused over HTTP (subscribe_unsupported)

Response #

Without jobId:

{
  "job": {
    "jobId": "…",
    "index": "iot",
    "collection": "sensors",
    "phase": "copying",
    "allowFailures": false,
    "total": 300000,
    "processed": 156000,
    "failed": 0,
    "lastError": null,
    "owner": "knode-…",
    "checkpointAt": 1764000006022,
    "createdAt": 1764000000000,
    "lockedAt": 1764000000012,
    "copiedAt": null,
    "finishedAt": null,
    "updatedAt": 1764000006022
  },
  "reindex": null,
  "archives": [
    {
      "jobId": "…",
      "index": "iot",
      "collection": "devices",
      "indice": "&iot.devices",
      "archivedAt": 1763990000000,
      "failed": 0,
      "changes": [ /* ... */ ],
      "allowFailures": false,
      "createdAt": 1763989970000,
      "lockedAt": 1763989970010,
      "copiedAt": 1763989999000,
      "total": 1000000,
      "processed": 1000000
    }
  ],
  "subscription": { "channel": "…", "roomId": "…" } // with subscribe only
}

With jobId: { "job": { ..., "changes": [ ... ] } }, plus subscription with subscribe.

job #

null if no job ever ran. Timestamps are milliseconds since the epoch.

PropertyTypeDescription
jobIdstringJob identifier
index, collectionstringThe collection migrated
phasestringwaiting, copying, copied, done or aborted, see Job phases
allowFailuresbooleanAs given to start
totalnumberDocuments to copy
processednumberDocuments copied or failed so far
failednumberFailed documents, listed by failures
lastErrorstringLast error, null if none
ownerstringId of the Kuzzle node running the job
checkpointAtnumberLast checkpoint (a phase change or a batch copied); frozen while the job is stalled
createdAtnumberstart received
lockedAtnumberWrites closed
copiedAtnumberCopy done (includes the grace delay since lockedAt)
finishedAtnumberdone or aborted: writes reopened
updatedAtnumberLast change of the job state
changesobject[]With jobId only: the plan applied, see change kinds

A job replaced by another one is read from its archive: it is done, finishedAt and updatedAt are its archive time, and lastError, owner and checkpointAt are null. An aborted job replaced by another one, or a purged one, has no archive: unknown_job (404).

reindex #

The last background reindex (of the cluster, or of index / collection), null if none.

PropertyTypeDescription
taskIdstringElasticsearch task id, null when untracked
index, collectionstringThe collection reindexed
startedAtnumberWhen it started
statestringrunning, done, failed, unknown or untracked, see Reindexes
total, updatednumberDocuments to reindex, and reindexed so far
failednumberDocuments refused
failuresobject[]The first 100 refused documents, [{ documentId, reason }]; null for a caller without document:search on the collection
errorstringThe error that stopped the task, if any
finishedAtnumberWhen the task ended, null while it runs

archives #

Every archive waiting for a purge, oldest first. Each has these fields:

PropertyTypeDescription
jobIdstringThe job that archived it, the id purge takes
index, collectionstringThe collection migrated
indicestringThe archive: the collection's old indice, outside of any collection
archivedAtnumberWhen the collection was switched to the new indice
failednumberFailed documents, kept in the archive only
changesobject[]The plan applied, see change kinds
allowFailuresbooleanAs given to start
createdAt, lockedAt, copiedAtnumberThe job's timestamps, as in job
total, processednumberDocuments to copy, and copied or failed

An archive made by a 1.0.0 beta has null for the fields that beta did not record (allowFailures, createdAt, lockedAt, copiedAt, total, processed).

Progress messages #

With subscribe, each message on subscription.channel carries the job view above in result._source.


Possible errors #

Error idStatusWhen
plugin.mapping-migration.subscribe_unsupported400subscribe: true over HTTP
plugin.mapping-migration.invalid_flag400Over HTTP, subscribe is neither true, false nor the bare flag
api.assert.missing_argument400index without collection, or the reverse
plugin.mapping-migration.unknown_job404jobId is neither the current job nor an archived one
plugin.mapping-migration.unsupported_engine412Kuzzle does not run on Elasticsearch 8