split_index.asciidoc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. [[java-rest-high-split-index]]
  2. === Split Index API
  3. [[java-rest-high-split-index-request]]
  4. ==== Resize Request
  5. The Split API requires a `ResizeRequest` instance.
  6. A `ResizeRequest` requires two string arguments:
  7. ["source","java",subs="attributes,callouts,macros"]
  8. --------------------------------------------------
  9. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-request]
  10. --------------------------------------------------
  11. <1> The target index (first argument) to split the source index (second argument) into
  12. <2> The resize type needs to be set to `SPLIT`
  13. ==== Optional arguments
  14. The following arguments can optionally be provided:
  15. ["source","java",subs="attributes,callouts,macros"]
  16. --------------------------------------------------
  17. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-request-timeout]
  18. --------------------------------------------------
  19. <1> Timeout to wait for the all the nodes to acknowledge the index is opened
  20. as a `TimeValue`
  21. <2> Timeout to wait for the all the nodes to acknowledge the index is opened
  22. as a `String`
  23. ["source","java",subs="attributes,callouts,macros"]
  24. --------------------------------------------------
  25. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-request-masterTimeout]
  26. --------------------------------------------------
  27. <1> Timeout to connect to the master node as a `TimeValue`
  28. <2> Timeout to connect to the master node as a `String`
  29. ["source","java",subs="attributes,callouts,macros"]
  30. --------------------------------------------------
  31. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-request-waitForActiveShards]
  32. --------------------------------------------------
  33. <1> The number of active shard copies to wait for before the split index API
  34. returns a response, as an `int`
  35. <2> The number of active shard copies to wait for before the split index API
  36. returns a response, as an `ActiveShardCount`
  37. ["source","java",subs="attributes,callouts,macros"]
  38. --------------------------------------------------
  39. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-request-settings]
  40. --------------------------------------------------
  41. <1> The settings to apply to the target index, which include the number of
  42. shards to create for it
  43. ["source","java",subs="attributes,callouts,macros"]
  44. --------------------------------------------------
  45. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-request-aliases]
  46. --------------------------------------------------
  47. <1> The aliases to associate the target index with
  48. [[java-rest-high-split-index-sync]]
  49. ==== Synchronous Execution
  50. ["source","java",subs="attributes,callouts,macros"]
  51. --------------------------------------------------
  52. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-execute]
  53. --------------------------------------------------
  54. [[java-rest-high-split-index-async]]
  55. ==== Asynchronous Execution
  56. The asynchronous execution of a split index request requires both the `ResizeRequest`
  57. instance and an `ActionListener` instance to be passed to the asynchronous
  58. method:
  59. ["source","java",subs="attributes,callouts,macros"]
  60. --------------------------------------------------
  61. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-execute-async]
  62. --------------------------------------------------
  63. <1> The `ResizeRequest` to execute and the `ActionListener` to use when
  64. the execution completes
  65. The asynchronous method does not block and returns immediately. Once it is
  66. completed the `ActionListener` is called back using the `onResponse` method
  67. if the execution successfully completed or using the `onFailure` method if
  68. it failed.
  69. A typical listener for `ResizeResponse` looks like:
  70. ["source","java",subs="attributes,callouts,macros"]
  71. --------------------------------------------------
  72. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-execute-listener]
  73. --------------------------------------------------
  74. <1> Called when the execution is successfully completed. The response is
  75. provided as an argument
  76. <2> Called in case of failure. The raised exception is provided as an argument
  77. [[java-rest-high-split-index-response]]
  78. ==== Split Index Response
  79. The returned `ResizeResponse` allows to retrieve information about the
  80. executed operation as follows:
  81. ["source","java",subs="attributes,callouts,macros"]
  82. --------------------------------------------------
  83. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-response]
  84. --------------------------------------------------
  85. <1> Indicates whether all of the nodes have acknowledged the request
  86. <2> Indicates whether the requisite number of shard copies were started for
  87. each shard in the index before timing out