put-follow.asciidoc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. [role="xpack"]
  2. [[ccr-put-follow]]
  3. === Create follower API
  4. ++++
  5. <titleabbrev>Create follower</titleabbrev>
  6. ++++
  7. Creates a follower index.
  8. [[ccr-put-follow-request]]
  9. ==== {api-request-title}
  10. //////////////////////////
  11. [source,console]
  12. --------------------------------------------------
  13. POST /follower_index/_ccr/pause_follow
  14. --------------------------------------------------
  15. // TEARDOWN
  16. //////////////////////////
  17. [source,console]
  18. --------------------------------------------------
  19. PUT /<follower_index>/_ccr/follow?wait_for_active_shards=1
  20. {
  21. "remote_cluster" : "<remote_cluster>",
  22. "leader_index" : "<leader_index>"
  23. }
  24. --------------------------------------------------
  25. // TEST[setup:remote_cluster_and_leader_index]
  26. // TEST[s/<follower_index>/follower_index/]
  27. // TEST[s/<remote_cluster>/remote_cluster/]
  28. // TEST[s/<leader_index>/leader_index/]
  29. [[ccr-put-follow-prereqs]]
  30. ==== {api-prereq-title}
  31. * If the {es} {security-features} are enabled, you must have `write`, `monitor`,
  32. and `manage_follow_index` index privileges for the follower index. You must have
  33. `read` and `monitor` index privileges for the leader index. You must also have
  34. `manage_ccr` cluster privileges on the cluster that contains the follower index.
  35. For more information, see <<security-privileges>>.
  36. [[ccr-put-follow-desc]]
  37. ==== {api-description-title}
  38. This API creates a new follower index that is configured to follow the
  39. referenced leader index. When this API returns, the follower index exists, and
  40. {ccr} starts replicating operations from the leader index to the follower index.
  41. [[ccr-put-follow-path-parms]]
  42. ==== {api-path-parms-title}
  43. `<follower_index>`::
  44. (Required, string) The name of the follower index.
  45. [[ccr-put-follow-query-params]]
  46. ==== {api-query-parms-title}
  47. `wait_for_active_shards`::
  48. (Optional, integer) Specifies the number of shards to wait on being active before
  49. responding. This defaults to waiting on none of the shards to be active. A
  50. shard must be restored from the leader index before being active. Restoring a
  51. follower shard requires transferring all the remote Lucene segment files to
  52. the follower index.
  53. [[ccr-put-follow-request-body]]
  54. ==== {api-request-body-title}
  55. `leader_index`::
  56. (Required, string) The name of the index in the leader cluster to follow.
  57. `remote_cluster`::
  58. (Required, string) The <<remote-clusters,remote cluster>> containing
  59. the leader index.
  60. include::../follow-request-body.asciidoc[]
  61. [[ccr-put-follow-examples]]
  62. ==== {api-examples-title}
  63. This example creates a follower index named `follower_index`:
  64. [source,console]
  65. --------------------------------------------------
  66. PUT /follower_index/_ccr/follow?wait_for_active_shards=1
  67. {
  68. "remote_cluster" : "remote_cluster",
  69. "leader_index" : "leader_index",
  70. "settings": {
  71. "index.number_of_replicas": 0
  72. },
  73. "max_read_request_operation_count" : 1024,
  74. "max_outstanding_read_requests" : 16,
  75. "max_read_request_size" : "1024k",
  76. "max_write_request_operation_count" : 32768,
  77. "max_write_request_size" : "16k",
  78. "max_outstanding_write_requests" : 8,
  79. "max_write_buffer_count" : 512,
  80. "max_write_buffer_size" : "512k",
  81. "max_retry_delay" : "10s",
  82. "read_poll_timeout" : "30s"
  83. }
  84. --------------------------------------------------
  85. // TEST[setup:remote_cluster_and_leader_index]
  86. The API returns the following result:
  87. [source,console-result]
  88. --------------------------------------------------
  89. {
  90. "follow_index_created" : true,
  91. "follow_index_shards_acked" : true,
  92. "index_following_started" : true
  93. }
  94. --------------------------------------------------