Index recovery API

Returns information about ongoing and completed shard recoveries for one or more indices. For data streams, the API returns information for the stream’s backing indices.

  1. GET /my-index-000001/_recovery

Request

GET /<target>/_recovery

GET /_recovery

Description

Use the index recovery API to get information about ongoing and completed shard recoveries.

Shard recovery is the process of syncing a replica shard from a primary shard. Upon completion, the replica shard is available for search.

Recovery automatically occurs during the following processes:

Path parameters

<target>

(Optional, string) Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (*) are supported.

To target all data streams and indices in a cluster, omit this parameter or use _all or *.

Query parameters

active_only

(Optional, boolean) If true, the response only includes ongoing shard recoveries. Defaults to false.

detailed

(Optional, boolean) If true, the response includes detailed information about shard recoveries. Defaults to false.

index

(Optional, string) Comma-separated list or wildcard expression of index names used to limit the request.

Response body

id

(Integer) ID of the shard.

type

(String) Recovery type. Returned values include:

  • STORE

    The recovery is related to a node startup or failure. This type of recovery is called a local store recovery.

    SNAPSHOT

    The recovery is related to a snapshot restoration.

    REPLICA

    The recovery is related to a primary shard replication.

    RELOCATING

    The recovery is related to the relocation of a shard to a different node in the same cluster.

STAGE

(String) Recovery stage. Returned values include:

  • DONE

    Complete.

    FINALIZE

    Cleanup.

    INDEX

    Reading index metadata and copying bytes from source to destination.

    INIT

    Recovery has not started.

    START

    Starting the recovery process; opening the index for use.

    TRANSLOG

    Replaying transaction log .

primary

(Boolean) If true, the shard is a primary shard.

start_time

(String) Timestamp of recovery start.

stop_time

(String) Timestamp of recovery finish.

total_time_in_millis

(String) Total time to recover shard in milliseconds.

source

(Object) Recovery source. This can include:

  • A repository description if recovery is from a snapshot
  • A description of source node

target

(Object) Destination node.

index

(Object) Statistics about physical index recovery.

translog

(Object) Statistics about translog recovery.

start

(Object) Statistics about time to open and start the index.

Examples

Get recovery information for several data streams and indices

  1. GET index1,index2/_recovery?human

Get segment information for all data streams and indices in a cluster

  1. GET /_recovery?human

The API returns the following response:

  1. {
  2. "index1" : {
  3. "shards" : [ {
  4. "id" : 0,
  5. "type" : "SNAPSHOT",
  6. "stage" : "INDEX",
  7. "primary" : true,
  8. "start_time" : "2014-02-24T12:15:59.716",
  9. "start_time_in_millis": 1393244159716,
  10. "stop_time" : "0s",
  11. "stop_time_in_millis" : 0,
  12. "total_time" : "2.9m",
  13. "total_time_in_millis" : 175576,
  14. "source" : {
  15. "repository" : "my_repository",
  16. "snapshot" : "my_snapshot",
  17. "index" : "index1",
  18. "version" : "{version}",
  19. "restoreUUID": "PDh1ZAOaRbiGIVtCvZOMww"
  20. },
  21. "target" : {
  22. "id" : "ryqJ5lO5S4-lSFbGntkEkg",
  23. "host" : "my.fqdn",
  24. "transport_address" : "my.fqdn",
  25. "ip" : "10.0.1.7",
  26. "name" : "my_es_node"
  27. },
  28. "index" : {
  29. "size" : {
  30. "total" : "75.4mb",
  31. "total_in_bytes" : 79063092,
  32. "reused" : "0b",
  33. "reused_in_bytes" : 0,
  34. "recovered" : "65.7mb",
  35. "recovered_in_bytes" : 68891939,
  36. "percent" : "87.1%"
  37. },
  38. "files" : {
  39. "total" : 73,
  40. "reused" : 0,
  41. "recovered" : 69,
  42. "percent" : "94.5%"
  43. },
  44. "total_time" : "0s",
  45. "total_time_in_millis" : 0,
  46. "source_throttle_time" : "0s",
  47. "source_throttle_time_in_millis" : 0,
  48. "target_throttle_time" : "0s",
  49. "target_throttle_time_in_millis" : 0
  50. },
  51. "translog" : {
  52. "recovered" : 0,
  53. "total" : 0,
  54. "percent" : "100.0%",
  55. "total_on_start" : 0,
  56. "total_time" : "0s",
  57. "total_time_in_millis" : 0,
  58. },
  59. "verify_index" : {
  60. "check_index_time" : "0s",
  61. "check_index_time_in_millis" : 0,
  62. "total_time" : "0s",
  63. "total_time_in_millis" : 0
  64. }
  65. } ]
  66. }
  67. }

This response includes information about a single index recovering a single shard. The source of the recovery is a snapshot repository and the target of the recovery is the my_es_node node.

The response also includes the number and percentage of files and bytes recovered.

Get detailed recovery information

To get a list of physical files in recovery, set the detailed query parameter to true.

  1. GET _recovery?human&detailed=true

The API returns the following response:

  1. {
  2. "index1" : {
  3. "shards" : [ {
  4. "id" : 0,
  5. "type" : "STORE",
  6. "stage" : "DONE",
  7. "primary" : true,
  8. "start_time" : "2014-02-24T12:38:06.349",
  9. "start_time_in_millis" : "1393245486349",
  10. "stop_time" : "2014-02-24T12:38:08.464",
  11. "stop_time_in_millis" : "1393245488464",
  12. "total_time" : "2.1s",
  13. "total_time_in_millis" : 2115,
  14. "source" : {
  15. "id" : "RGMdRc-yQWWKIBM4DGvwqQ",
  16. "host" : "my.fqdn",
  17. "transport_address" : "my.fqdn",
  18. "ip" : "10.0.1.7",
  19. "name" : "my_es_node"
  20. },
  21. "target" : {
  22. "id" : "RGMdRc-yQWWKIBM4DGvwqQ",
  23. "host" : "my.fqdn",
  24. "transport_address" : "my.fqdn",
  25. "ip" : "10.0.1.7",
  26. "name" : "my_es_node"
  27. },
  28. "index" : {
  29. "size" : {
  30. "total" : "24.7mb",
  31. "total_in_bytes" : 26001617,
  32. "reused" : "24.7mb",
  33. "reused_in_bytes" : 26001617,
  34. "recovered" : "0b",
  35. "recovered_in_bytes" : 0,
  36. "percent" : "100.0%"
  37. },
  38. "files" : {
  39. "total" : 26,
  40. "reused" : 26,
  41. "recovered" : 0,
  42. "percent" : "100.0%",
  43. "details" : [ {
  44. "name" : "segments.gen",
  45. "length" : 20,
  46. "recovered" : 20
  47. }, {
  48. "name" : "_0.cfs",
  49. "length" : 135306,
  50. "recovered" : 135306
  51. }, {
  52. "name" : "segments_2",
  53. "length" : 251,
  54. "recovered" : 251
  55. }
  56. ]
  57. },
  58. "total_time" : "2ms",
  59. "total_time_in_millis" : 2,
  60. "source_throttle_time" : "0s",
  61. "source_throttle_time_in_millis" : 0,
  62. "target_throttle_time" : "0s",
  63. "target_throttle_time_in_millis" : 0
  64. },
  65. "translog" : {
  66. "recovered" : 71,
  67. "total" : 0,
  68. "percent" : "100.0%",
  69. "total_on_start" : 0,
  70. "total_time" : "2.0s",
  71. "total_time_in_millis" : 2025
  72. },
  73. "verify_index" : {
  74. "check_index_time" : 0,
  75. "check_index_time_in_millis" : 0,
  76. "total_time" : "88ms",
  77. "total_time_in_millis" : 88
  78. }
  79. } ]
  80. }
  81. }

The response includes a listing of any physical files recovered and their sizes.

The response also includes timings in milliseconds of the various stages of recovery:

  • Index retrieval
  • Translog replay
  • Index start time

This response indicates the recovery is done. All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time.

To only return information about ongoing recoveries, set the active_only query parameter to true.