put-auto-follow-pattern.asciidoc 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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}}` can be used to
  73. derive the name of the follower index from the name of the leader index. When following a data
  74. stream, the `follow_index_pattern` will be used for renaming not only the leader index, but also
  75. the data stream containing the leader index. For example, a data stream called
  76. `logs-mysql-default` with a backing index of `.ds-logs-mysql-default-2022-01-01-000001` and a
  77. `follow_index_pattern` of `{{leader_index}}_copy` will replicate the data stream as
  78. `logs-mysql-default_copy` and the backing index as
  79. `.ds-logs-mysql-default_copy-2022-01-01-000001`.
  80. include::../follow-request-body.asciidoc[]
  81. [[ccr-put-auto-follow-pattern-examples]]
  82. ==== {api-examples-title}
  83. This example creates an auto-follow pattern named `my_auto_follow_pattern`:
  84. [source,console]
  85. --------------------------------------------------
  86. PUT /_ccr/auto_follow/my_auto_follow_pattern
  87. {
  88. "remote_cluster" : "remote_cluster",
  89. "leader_index_patterns" :
  90. [
  91. "leader_index*"
  92. ],
  93. "follow_index_pattern" : "{{leader_index}}-follower",
  94. "settings": {
  95. "index.number_of_replicas": 0
  96. },
  97. "max_read_request_operation_count" : 1024,
  98. "max_outstanding_read_requests" : 16,
  99. "max_read_request_size" : "1024k",
  100. "max_write_request_operation_count" : 32768,
  101. "max_write_request_size" : "16k",
  102. "max_outstanding_write_requests" : 8,
  103. "max_write_buffer_count" : 512,
  104. "max_write_buffer_size" : "512k",
  105. "max_retry_delay" : "10s",
  106. "read_poll_timeout" : "30s"
  107. }
  108. --------------------------------------------------
  109. // TEST[setup:remote_cluster]
  110. The API returns the following result:
  111. [source,console-result]
  112. --------------------------------------------------
  113. {
  114. "acknowledged" : true
  115. }
  116. --------------------------------------------------
  117. //////////////////////////
  118. [source,console]
  119. --------------------------------------------------
  120. DELETE /_ccr/auto_follow/my_auto_follow_pattern
  121. --------------------------------------------------
  122. // TEST[continued]
  123. //////////////////////////