Get the status and progress of a specific reindex task Generally available; Added in 9.5.0

GET /_reindex/{task_id}

This API follows reindex tasks across node-shutdown relocations, so callers can keep using the original task ID throughout the lifetime of the operation. Returned task IDs and timings reflect the original task, not its relocated successor. Relocated task IDs are also supported. They are followed transparently and return the task ID and timings of the original task.

When the task ID cannot be resolved, the API returns the response below with a 404 status code. This response is used whether the ID is unknown, refers to a non-reindex task, refers to a sliced child subtask, or refers to a task whose node left the cluster with no stored result (e.g. a non-graceful shutdown).

{
  "error": {
    "type": "resource_not_found_exception",
    "reason": "Reindex operation [r1A2WoRbTwKZ516z6NEs5A:36619] not found"
  },
  "status": 404
}

Path parameters

  • task_id string Required

    The ID of the reindex task to retrieve.

Query parameters

  • wait_for_completion boolean

    If true, the request blocks until the reindex task completes, then returns the result.

  • timeout string

    The period to wait for the reindex task to complete when wait_for_completion is true.

    External documentation

Responses

  • 200 application/json
    Hide response attributes Show response attributes object
    • completed boolean Required

      Whether the reindex task has completed.

    • id string Required

      The ID of the reindex task. The value is the ID assigned when the task was first created and remains stable across node-shutdown relocations.

    • description string

      A sanitized description of the reindex operation (source and destination indices, and optionally remote host info).

    • start_time_in_millis number

      Time unit for milliseconds

    • start_time string

      The time at which the reindex task started, as an ISO 8601 formatted string. Only present when the request includes the ?human=true query parameter.

    • running_time string

      The elapsed running time of the reindex task, in a human-readable format. Only present when the request includes the ?human=true query parameter.

      External documentation
    • running_time_in_nanos number

      Time unit for nanoseconds

    • cancelled boolean Required

      Whether the reindex task has been cancelled.

    • status object

      The current progress of the reindex operation.

      Hide status attributes Show status attributes object
      • slice_id number

        The slice ID

      • batches number Required

        The number of scroll responses pulled back by the reindex.

      • created number

        The number of documents that were successfully created.

      • deleted number Required

        The number of documents that were successfully deleted.

      • noops number Required

        The number of documents that were ignored because the script used for the reindex returned a noop value for ctx.op.

      • requests_per_second number Required

        The number of requests per second effectively executed during the reindex.

      • retries object Required

        The number of retries attempted by reindex. bulk is the number of bulk actions retried and search is the number of search actions retried.

        Hide retries attributes Show retries attributes object
        • bulk number Required

          The number of bulk actions retried.

      • throttled string

        A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

        External documentation
      • throttled_millis number

        Time unit for milliseconds

      • throttled_until string

        A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

        External documentation
      • throttled_until_millis number

        Time unit for milliseconds

      • total number Required

        The number of documents that were successfully processed.

      • updated number

        The number of documents that were successfully updated, for example, a document with same ID already existed prior to reindex updating it.

      • version_conflicts number Required

        The number of version conflicts that reindex hits.

      • cancelled string

        The reason for cancellation if the slice was canceled

    • error object

      The error that caused the reindex task to fail, if any.

      Hide error attributes Show error attributes object
      • type string Required

        The type of error

      • reason string | null

        A human-readable explanation of the error, in English.

      • stack_trace string

        The server stack trace. Present only if the error_trace=true parameter was sent with the request.

      • caused_by object

        Cause and details about a request failure. This class defines the properties common to all error types. Additional details are also provided, that depend on the error type.

      • root_cause array[object]

        Cause and details about a request failure. This class defines the properties common to all error types. Additional details are also provided, that depend on the error type.

        Cause and details about a request failure. This class defines the properties common to all error types. Additional details are also provided, that depend on the error type.

      • suppressed array[object]

        Cause and details about a request failure. This class defines the properties common to all error types. Additional details are also provided, that depend on the error type.

        Cause and details about a request failure. This class defines the properties common to all error types. Additional details are also provided, that depend on the error type.

    • response object

      The final result of the completed reindex operation, if the task has finished successfully.

      Hide response attributes Show response attributes object
      • batches number

        The number of scroll responses pulled back by the reindex.

      • created number

        The number of documents that were successfully created.

      • deleted number

        The number of documents that were successfully deleted.

      • failures array[object]

        Any failures encountered during the reindex. If non-empty, the reindex ended because of these failures.

        Hide failures attributes Show failures attributes object
        • cause object Required

          Cause and details about a request failure. This class defines the properties common to all error types. Additional details are also provided, that depend on the error type.

        • id string Required
        • index string Required
        • status number Required
      • noops number

        The number of documents that were ignored because the script returned a noop value for ctx.op.

      • requests_per_second number

        The number of requests per second effectively executed during the reindex.

      • retries object

        The number of retries attempted by reindex.

        Hide retries attributes Show retries attributes object
        • bulk number Required

          The number of bulk actions retried.

      • throttled_millis number

        Time unit for milliseconds

      • throttled_until_millis number

        Time unit for milliseconds

      • timed_out boolean

        Whether any of the requests executed during the reindex timed out.

      • took number

        Time unit for milliseconds

      • total number

        The number of documents that were successfully processed.

      • updated number

        The number of documents that were successfully updated.

      • version_conflicts number

        The number of version conflicts that occurred.

GET /_reindex/{task_id}
GET _reindex/r1A2WoRbTwKZ516z6NEs5A:36619
resp = client.get_reindex(
    task_id="r1A2WoRbTwKZ516z6NEs5A:36619",
)
const response = await client.getReindex({
  task_id: "r1A2WoRbTwKZ516z6NEs5A:36619",
});
response = client.get_reindex(
  task_id: "r1A2WoRbTwKZ516z6NEs5A:36619"
)
$resp = $client->getReindex([
    "task_id" => "r1A2WoRbTwKZ516z6NEs5A:36619",
]);
curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_reindex/r1A2WoRbTwKZ516z6NEs5A:36619"
Response examples (200)
A successful response for an in-progress reindex task. The `status` block reports current progress; the `response` block is absent until the task completes.
{
  "completed": false,
  "id": "r1A2WoRbTwKZ516z6NEs5A:36619",
  "description": "reindex from [reindex_src] to [reindex_dst]",
  "start_time_in_millis": 1778265266199,
  "running_time_in_nanos": 1588606084,
  "cancelled": false,
  "status": {
    "total": 0,
    "updated": 0,
    "created": 0,
    "deleted": 0,
    "batches": 0,
    "version_conflicts": 0,
    "noops": 0,
    "retries": {
      "bulk": 0,
      "search": 0
    },
    "throttled_millis": 0,
    "requests_per_second": 4.0,
    "throttled_until_millis": 0,
    "slices": [
      null,
      null
    ]
  }
}
A successful response for a completed reindex task. The final outcome is in the `response` block.
{
  "completed": true,
  "id": "r1A2WoRbTwKZ516z6NEs5A:36619",
  "description": "reindex from [reindex_src] to [reindex_dst]",
  "start_time_in_millis": 1778265266199,
  "running_time_in_nanos": 35457187167,
  "cancelled": false,
  "status": {
    "total": 240,
    "updated": 0,
    "created": 240,
    "deleted": 0,
    "batches": 120,
    "version_conflicts": 0,
    "noops": 0,
    "retries": {
      "bulk": 0,
      "search": 0
    },
    "throttled_millis": 2999,
    "requests_per_second": -1.0,
    "throttled_until_millis": 0,
    "slices": [
      {
        "slice_id": 0,
        "total": 174,
        "updated": 0,
        "created": 174,
        "deleted": 0,
        "batches": 87,
        "version_conflicts": 0,
        "noops": 0,
        "retries": {
          "bulk": 0,
          "search": 0
        },
        "throttled_millis": 999,
        "requests_per_second": -1.0,
        "throttled_until_millis": 0
      },
      {
        "slice_id": 1,
        "total": 66,
        "updated": 0,
        "created": 66,
        "deleted": 0,
        "batches": 33,
        "version_conflicts": 0,
        "noops": 0,
        "retries": {
          "bulk": 0,
          "search": 0
        },
        "throttled_millis": 1999,
        "requests_per_second": -1.0,
        "throttled_until_millis": 0
      }
    ]
  },
  "response": {
    "took": 35434,
    "timed_out": false,
    "total": 240,
    "updated": 0,
    "created": 240,
    "deleted": 0,
    "batches": 120,
    "version_conflicts": 0,
    "noops": 0,
    "retries": {
      "bulk": 0,
      "search": 0
    },
    "throttled": "2.9s",
    "throttled_millis": 2999,
    "requests_per_second": -1.0,
    "throttled_until": "0s",
    "throttled_until_millis": 0,
    "slices": [
      {
        "slice_id": 0,
        "total": 174,
        "updated": 0,
        "created": 174,
        "deleted": 0,
        "batches": 87,
        "version_conflicts": 0,
        "noops": 0,
        "retries": {
          "bulk": 0,
          "search": 0
        },
        "throttled": "999.9ms",
        "throttled_millis": 999,
        "requests_per_second": -1.0,
        "throttled_until": "0s",
        "throttled_until_millis": 0
      },
      {
        "slice_id": 1,
        "total": 66,
        "updated": 0,
        "created": 66,
        "deleted": 0,
        "batches": 33,
        "version_conflicts": 0,
        "noops": 0,
        "retries": {
          "bulk": 0,
          "search": 0
        },
        "throttled": "1.9s",
        "throttled_millis": 1999,
        "requests_per_second": -1.0,
        "throttled_until": "0s",
        "throttled_until_millis": 0
      }
    ],
    "failures": []
  }
}