get_snapshots.asciidoc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. [[java-rest-high-snapshot-get-snapshots]]
  2. === Get Snapshots API
  3. Use the Get Snapshot API to get snapshots.
  4. [[java-rest-high-snapshot-get-snapshots-request]]
  5. ==== Get Snapshots Request
  6. A `GetSnapshotsRequest`:
  7. ["source","java",subs="attributes,callouts,macros"]
  8. --------------------------------------------------
  9. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[get-snapshots-request]
  10. --------------------------------------------------
  11. ==== Required Arguments
  12. The following arguments are mandatory:
  13. ["source","java",subs="attributes,callouts,macros"]
  14. --------------------------------------------------
  15. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[get-snapshots-request-repositoryName]
  16. --------------------------------------------------
  17. <1> The name of the repository.
  18. ==== Optional Arguments
  19. The following arguments are optional:
  20. ["source","java",subs="attributes,callouts,macros"]
  21. --------------------------------------------------
  22. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[get-snapshots-request-snapshots]
  23. --------------------------------------------------
  24. <1> An array of snapshots to get. Otherwise it will return all snapshots for a repository.
  25. ["source","java",subs="attributes,callouts,macros"]
  26. --------------------------------------------------
  27. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[get-snapshots-request-masterTimeout]
  28. --------------------------------------------------
  29. <1> Timeout to connect to the master node as a `TimeValue`.
  30. <2> Timeout to connect to the master node as a `String`.
  31. ["source","java",subs="attributes,callouts,macros"]
  32. --------------------------------------------------
  33. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[get-snapshots-request-verbose]
  34. --------------------------------------------------
  35. <1> `Boolean` indicating if the response should be verbose.
  36. ["source","java",subs="attributes,callouts,macros"]
  37. --------------------------------------------------
  38. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[get-snapshots-request-ignore-unavailable]
  39. --------------------------------------------------
  40. <1> `Boolean` indicating if unavailable snapshots should be ignored. Otherwise the request will
  41. fail if any of the snapshots are unavailable.
  42. [[java-rest-high-snapshot-get-snapshots-sync]]
  43. ==== Synchronous Execution
  44. ["source","java",subs="attributes,callouts,macros"]
  45. --------------------------------------------------
  46. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[get-snapshots-execute]
  47. --------------------------------------------------
  48. [[java-rest-high-snapshot-get-snapshots-async]]
  49. ==== Asynchronous Execution
  50. The asynchronous execution of a get snapshots request requires both the
  51. `GetSnapshotsRequest` instance and an `ActionListener` instance to be
  52. passed as arguments to the asynchronous method:
  53. ["source","java",subs="attributes,callouts,macros"]
  54. --------------------------------------------------
  55. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[get-snapshots-execute-async]
  56. --------------------------------------------------
  57. <1> The `GetSnapshotsRequest` to execute and the `ActionListener` to use when
  58. the execution completes.
  59. The asynchronous method does not block and returns immediately. Once it is
  60. completed the `ActionListener` is called back with the `onResponse` method
  61. if the execution is successful or the `onFailure` method if the execution
  62. failed.
  63. A typical listener for `GetSnapshotsResponse` looks like:
  64. ["source","java",subs="attributes,callouts,macros"]
  65. --------------------------------------------------
  66. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[get-snapshots-execute-listener]
  67. --------------------------------------------------
  68. <1> Called when the execution is successfully completed. The response is
  69. provided as an argument.
  70. <2> Called in case of a failure. The raised exception is provided as an
  71. argument.
  72. [[java-rest-high-snapshot-get-snapshots-response]]
  73. ==== Get Snapshots Response
  74. The returned `GetSnapshotsResponse` allows the retrieval of information about the requested
  75. snapshots:
  76. ["source","java",subs="attributes,callouts,macros"]
  77. --------------------------------------------------
  78. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[get-snapshots-response]
  79. --------------------------------------------------
  80. <1> The REST status of a snapshot
  81. <2> The snapshot id
  82. <3> The current state of the snapshot
  83. <4> Information about failures that occurred during the shard snapshot process.
  84. <5> The snapshot start time
  85. <6> The snapshot end time