put-auto-follow-pattern.asciidoc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ccr-put-auto-follow-pattern]]
  4. === Create auto-follow pattern API
  5. ++++
  6. <titleabbrev>Create auto-follow pattern</titleabbrev>
  7. ++++
  8. Creates an auto-follow pattern.
  9. [[ccr-put-auto-follow-pattern-request]]
  10. ==== {api-request-title}
  11. [source,console]
  12. --------------------------------------------------
  13. PUT /_ccr/auto_follow/<auto_follow_pattern_name>
  14. {
  15. "remote_cluster" : "<remote_cluster>",
  16. "leader_index_patterns" :
  17. [
  18. "<leader_index_pattern>"
  19. ],
  20. "follow_index_pattern" : "<follow_index_pattern>"
  21. }
  22. --------------------------------------------------
  23. // TEST[setup:remote_cluster]
  24. // TEST[s/<auto_follow_pattern_name>/auto_follow_pattern_name/]
  25. // TEST[s/<remote_cluster>/remote_cluster/]
  26. // TEST[s/<leader_index_patterns>/leader_index*/]
  27. // TEST[s/<follow_index_pattern>/{{leader_index}}-follower/]
  28. //////////////////////////
  29. [source,console]
  30. --------------------------------------------------
  31. DELETE /_ccr/auto_follow/auto_follow_pattern_name
  32. --------------------------------------------------
  33. // TEST[continued]
  34. //////////////////////////
  35. [[ccr-put-auto-follow-pattern-prereqs]]
  36. ==== {api-prereq-title}
  37. * If the {es} {security-features} are enabled, you must have `read` and `monitor`
  38. index privileges for the leader index patterns. You must also have `manage_ccr`
  39. cluster privileges on the cluster that contains the follower index. For more
  40. information, see <<security-privileges>>.
  41. [[ccr-put-auto-follow-pattern-desc]]
  42. ==== {api-description-title}
  43. This API creates a new named collection of
  44. <<ccr-auto-follow,auto-follow patterns>> against the remote cluster
  45. specified in the request body. Newly created indices on the remote cluster
  46. matching any of the specified patterns will be automatically configured as follower
  47. indices.
  48. [[ccr-put-auto-follow-pattern-path-parms]]
  49. ==== {api-path-parms-title}
  50. `<auto_follow_pattern_name>`::
  51. (Required, string) The name of the collection of auto-follow patterns.
  52. [[ccr-put-auto-follow-pattern-request-body]]
  53. ==== {api-request-body-title}
  54. `remote_cluster`::
  55. (Required, string) The <<modules-remote-clusters,remote cluster>> containing
  56. the leader indices to match against.
  57. `leader_index_patterns`::
  58. (Optional, array) An array of simple index patterns to match against indices
  59. in the remote cluster specified by the `remote_cluster` field.
  60. `follow_index_pattern`::
  61. (Optional, string) The name of follower index. The template `{{leader_index}}`
  62. can be used to derive the name of the follower index from the name of the
  63. leader index.
  64. include::../follow-request-body.asciidoc[]
  65. [[ccr-put-auto-follow-pattern-examples]]
  66. ==== {api-examples-title}
  67. This example creates an auto-follow pattern named `my_auto_follow_pattern`:
  68. [source,console]
  69. --------------------------------------------------
  70. PUT /_ccr/auto_follow/my_auto_follow_pattern
  71. {
  72. "remote_cluster" : "remote_cluster",
  73. "leader_index_patterns" :
  74. [
  75. "leader_index*"
  76. ],
  77. "follow_index_pattern" : "{{leader_index}}-follower",
  78. "max_read_request_operation_count" : 1024,
  79. "max_outstanding_read_requests" : 16,
  80. "max_read_request_size" : "1024k",
  81. "max_write_request_operation_count" : 32768,
  82. "max_write_request_size" : "16k",
  83. "max_outstanding_write_requests" : 8,
  84. "max_write_buffer_count" : 512,
  85. "max_write_buffer_size" : "512k",
  86. "max_retry_delay" : "10s",
  87. "read_poll_timeout" : "30s"
  88. }
  89. --------------------------------------------------
  90. // TEST[setup:remote_cluster]
  91. The API returns the following result:
  92. [source,console-result]
  93. --------------------------------------------------
  94. {
  95. "acknowledged" : true
  96. }
  97. --------------------------------------------------
  98. //////////////////////////
  99. [source,console]
  100. --------------------------------------------------
  101. DELETE /_ccr/auto_follow/my_auto_follow_pattern
  102. --------------------------------------------------
  103. // TEST[continued]
  104. //////////////////////////