clone_snapshot.asciidoc 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. [[java-rest-high-snapshot-clone-snapshot]]
  2. === Clone Snapshot API
  3. The Clone Snapshot API clones part or all of a snapshot into a new snapshot.
  4. [[java-rest-high-snapshot-clone-snapshot-request]]
  5. ==== Request
  6. A `CloneSnapshotRequest`:
  7. ["source","java",subs="attributes,callouts,macros"]
  8. --------------------------------------------------
  9. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[clone-snapshot-request]
  10. --------------------------------------------------
  11. ==== Indices to Clone
  12. Use `indices` to specify a list of indices from the source snapshot to include
  13. in the snapshot clone:
  14. ["source","java",subs="attributes,callouts,macros"]
  15. --------------------------------------------------
  16. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[clone-snapshot-request-indices]
  17. --------------------------------------------------
  18. <1> Include only `test_index` from the source snapshot.
  19. ==== Index Settings and Options
  20. You can also customize index settings and options when cloning a snapshot:
  21. ["source","java",subs="attributes,callouts,macros"]
  22. --------------------------------------------------
  23. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[clone-snapshot-request-index-settings]
  24. --------------------------------------------------
  25. <1> Set `IndicesOptions.Option.IGNORE_UNAVAILABLE` in `#indicesOptions()` to
  26. have the clone succeed even if indices are missing in the source snapshot.
  27. ==== Further Arguments
  28. You can also provide the following optional arguments:
  29. ["source","java",subs="attributes,callouts,macros"]
  30. --------------------------------------------------
  31. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[clone-snapshot-request-masterTimeout]
  32. --------------------------------------------------
  33. <1> Timeout to connect to the master node as a `TimeValue`
  34. <2> Timeout to connect to the master node as a `String`
  35. [[java-rest-high-snapshot-clone-snapshot-sync]]
  36. ==== Synchronous Execution
  37. ["source","java",subs="attributes,callouts,macros"]
  38. --------------------------------------------------
  39. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[clone-snapshot-execute]
  40. --------------------------------------------------
  41. [[java-rest-high-snapshot-clone-snapshot-async]]
  42. ==== Asynchronous Execution
  43. The asynchronous execution of a clone snapshot request requires both the
  44. `CloneSnapshotRequest` instance and an `ActionListener` instance to be
  45. passed to the asynchronous method:
  46. ["source","java",subs="attributes,callouts,macros"]
  47. --------------------------------------------------
  48. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[clone-snapshot-execute-async]
  49. --------------------------------------------------
  50. <1> The `CloneSnapshotRequest` to execute and the `ActionListener`
  51. to use when the execution completes
  52. The asynchronous method does not block and returns immediately. Once it is
  53. completed the `ActionListener` is called back using the `onResponse` method
  54. if the execution successfully completed or using the `onFailure` method if
  55. it failed.
  56. A typical listener for `AcknowledgedResponse` looks like:
  57. ["source","java",subs="attributes,callouts,macros"]
  58. --------------------------------------------------
  59. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[clone-snapshot-execute-listener]
  60. --------------------------------------------------
  61. <1> Called when the execution is successfully completed. The response is
  62. provided as an argument.
  63. <2> Called in case of a failure. The raised exception is provided as an argument.
  64. [[java-rest-high-cluster-clone-snapshot-response]]
  65. ==== Response
  66. `AcknowledgedResponse` indicates whether the request was received:
  67. ["source","java",subs="attributes,callouts,macros"]
  68. --------------------------------------------------
  69. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[clone-snapshot-response]
  70. --------------------------------------------------
  71. <1> A boolean value of `true` if the clone successfully completed. Otherwise, the value is `false`.