put-auto-follow-pattern.asciidoc 4.7 KB

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