data-stream-reindex-status.asciidoc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. [role="xpack"]
  2. [[data-stream-reindex-status-api]]
  3. === Reindex data stream status API
  4. ++++
  5. <titleabbrev>Reindex data stream status</titleabbrev>
  6. ++++
  7. .New API reference
  8. [sidebar]
  9. --
  10. For the most up-to-date API details, refer to {api-es}/group/endpoint-migration[Migration APIs].
  11. --
  12. include::{es-ref-dir}/migration/apis/shared-migration-apis-tip.asciidoc[]
  13. Obtains the current status of a reindex task for the requested data stream. This status is
  14. available while the reindex task is running and for 24 hours after completion of the task,
  15. whether it succeeds or fails. If the task is cancelled, the status is no longer available.
  16. If the task fails, the exception will be listed within the status.
  17. ///////////////////////////////////////////////////////////
  18. [source,console]
  19. ------------------------------------------------------
  20. POST _migration/reindex
  21. {
  22. "source": {
  23. "index": "my-data-stream"
  24. },
  25. "mode": "upgrade"
  26. }
  27. ------------------------------------------------------
  28. // TESTSETUP
  29. // TEST[setup:my_data_stream]
  30. [source,console]
  31. ------------------------------------------------------
  32. POST /_migration/reindex/my-data-stream/_cancel
  33. DELETE _data_stream/my-data-stream
  34. DELETE _index_template/my-data-stream-template
  35. ------------------------------------------------------
  36. // TEARDOWN
  37. ///////////////////////////////////////////////////////////
  38. [[data-stream-reindex-status-api-request]]
  39. ==== {api-request-title}
  40. `GET /_migration/reindex/<data-stream>/_status`
  41. [[data-stream-reindex-status-prereqs]]
  42. ==== {api-prereq-title}
  43. * If the {es} {security-features} are enabled, you must have the `manage`
  44. <<privileges-list-indices,index privilege>> for the data stream.
  45. [[data-stream-reindex-status-path-params]]
  46. ==== {api-path-parms-title}
  47. `<data-stream>`::
  48. (Required, string)
  49. Name of data stream to get status for. The reindex task for the
  50. data stream should be currently running or have been completed in the last 24 hours.
  51. [role="child_attributes"]
  52. [[data-stream-reindex-status-response-body]]
  53. ==== {api-response-body-title}
  54. `start_time`::
  55. (Optional, <<time-units,time value>>) The time when the reindex task started.
  56. `start_time_millis`::
  57. (integer) The time when the reindex task started, in milliseconds since the epoch.
  58. `complete`::
  59. (boolean) `false` if the reindex task is still running, and `true` if the task has completed with success or failure.
  60. `total_indices_in_data_stream`::
  61. (integer) The total number of backing indices in the data stream, including the write index.
  62. `total_indices_requiring_upgrade`::
  63. (integer) The number of backing indices that need to be upgraded. These will consist of the indices which have an
  64. older version and are not read-only.
  65. `successes`::
  66. (integer) The number of backing indices which have already been successfully upgraded.
  67. `in_progress`::
  68. (array of objects) Information on the backing indices which are currently being reindexed.
  69. +
  70. .Properties of objects in `in_progress`
  71. [%collapsible%open]
  72. =====
  73. `index`::
  74. (string) The name of the source backing index.
  75. `total_doc_count`::
  76. (integer) The number of documents in the source backing index.
  77. `reindexed_doc_count`::
  78. (integer) The number of documents which have already been added to the destination backing index.
  79. =====
  80. `pending`::
  81. (integer) The number of backing indices which still need to be upgraded and have not yet been started.
  82. `errors`::
  83. (array of objects) Information on any errors which have occurred.
  84. +
  85. .Properties of objects in `errors`
  86. [%collapsible%open]
  87. =====
  88. `index`::
  89. (string) The name of a backing index which has had an error during reindex.
  90. `message`::
  91. (string) Description of the error.
  92. =====
  93. `exceptions`::
  94. (Optional, string)
  95. Exception message for a reindex failure if the failure could not be tied to a particular index.
  96. [[data-stream-reindex-status-example]]
  97. ==== {api-examples-title}
  98. [source,console]
  99. ----
  100. GET _migration/reindex/my-data-stream/_status
  101. ----
  102. The following is a typical response:
  103. [source,console-result]
  104. ----
  105. {
  106. "start_time_millis": 1737676174349,
  107. "complete": false,
  108. "total_indices_in_data_stream": 4,
  109. "total_indices_requiring_upgrade": 3,
  110. "successes": 1,
  111. "in_progress": [
  112. {
  113. "index": ".ds-my-data-stream-2025.01.23-000002",
  114. "total_doc_count": 10000000,
  115. "reindexed_doc_count": 1000
  116. }
  117. ],
  118. "pending": 1,
  119. "errors": []
  120. }
  121. ----
  122. // TEST[skip:cannot easily clean up reindex task between tests]
  123. For a more in-depth example showing the usage of this API along with the <<data-stream-reindex-api,reindex>> and <<data-stream-reindex-cancel-api,cancel>> APIs,
  124. see this <<reindex-data-stream-api-example,example>>.