put-auto-follow-pattern.asciidoc 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. .New API reference
  8. [sidebar]
  9. --
  10. For the most up-to-date API details, refer to {api-es}/group/endpoint-ccr[Cross-cluster replication APIs].
  11. --
  12. Creates a {ccr} <<ccr-auto-follow,auto-follow pattern>>.
  13. [[ccr-put-auto-follow-pattern-request]]
  14. ==== {api-request-title}
  15. [source,console]
  16. --------------------------------------------------
  17. PUT /_ccr/auto_follow/<auto_follow_pattern_name>
  18. {
  19. "remote_cluster" : "<remote_cluster>",
  20. "leader_index_patterns" :
  21. [
  22. "<leader_index_pattern>"
  23. ],
  24. "leader_index_exclusion_patterns":
  25. [
  26. "<leader_index_exclusion_pattern>"
  27. ],
  28. "follow_index_pattern" : "<follow_index_pattern>"
  29. }
  30. --------------------------------------------------
  31. // TEST[setup:remote_cluster]
  32. // TEST[s/<auto_follow_pattern_name>/auto_follow_pattern_name/]
  33. // TEST[s/<remote_cluster>/remote_cluster/]
  34. // TEST[s/<leader_index_patterns>/leader_index*/]
  35. // TEST[s/<leader_index_exclusion_pattern>//]
  36. // TEST[s/<follow_index_pattern>/{{leader_index}}-follower/]
  37. //////////////////////////
  38. [source,console]
  39. --------------------------------------------------
  40. DELETE /_ccr/auto_follow/auto_follow_pattern_name
  41. --------------------------------------------------
  42. // TEST[continued]
  43. //////////////////////////
  44. [[ccr-put-auto-follow-pattern-prereqs]]
  45. ==== {api-prereq-title}
  46. * If the {es} {security-features} are enabled, you must have `read` and `monitor`
  47. index privileges for the leader index patterns. You must also have `manage_ccr`
  48. cluster privileges on the cluster that contains the follower index. For more
  49. information, see <<security-privileges>>.
  50. [[ccr-put-auto-follow-pattern-desc]]
  51. ==== {api-description-title}
  52. This API creates a new named collection of
  53. <<ccr-auto-follow,auto-follow patterns>> against the remote cluster
  54. specified in the request body. Newly created indices on the remote cluster
  55. matching any of the specified patterns will be automatically configured as follower
  56. indices. Indices on the remote cluster that were created before the auto-follow
  57. pattern is created won't be auto-followed even if they match the pattern.
  58. This API can also be used to update existing
  59. <<ccr-auto-follow,auto-follow patterns>>. Note that follower indices that were configured automatically
  60. before updating an auto-follow pattern will remain unchanged even if they don't match against
  61. the new patterns.
  62. [[ccr-put-auto-follow-pattern-path-parms]]
  63. ==== {api-path-parms-title}
  64. `<auto_follow_pattern_name>`::
  65. (Required, string) The name of the collection of auto-follow patterns.
  66. [[ccr-put-auto-follow-pattern-query-params]]
  67. ==== {api-query-parms-title}
  68. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
  69. [[ccr-put-auto-follow-pattern-request-body]]
  70. ==== {api-request-body-title}
  71. `remote_cluster`::
  72. (Required, string) The <<remote-clusters,remote cluster>> containing
  73. the leader indices to match against.
  74. `leader_index_patterns`::
  75. (Optional, array) An array of simple index patterns to match against indices
  76. in the remote cluster specified by the `remote_cluster` field.
  77. `leader_index_exclusion_patterns`::
  78. (Optional, array) An array of simple index patterns that can be used to exclude indices
  79. from being auto-followed. Indices in the remote cluster whose names are matching one or
  80. more `leader_index_patterns` and one or more `leader_index_exclusion_patterns` won't be followed.
  81. `follow_index_pattern`::
  82. (Optional, string) The name of follower index. The template `{{leader_index}}` can be used to
  83. derive the name of the follower index from the name of the leader index. When following a data
  84. stream, the `follow_index_pattern` will be used for renaming not only the leader index, but also
  85. the data stream containing the leader index. For example, a data stream called
  86. `logs-mysql-default` with a backing index of `.ds-logs-mysql-default-2022-01-01-000001` and a
  87. `follow_index_pattern` of `{{leader_index}}_copy` will replicate the data stream as
  88. `logs-mysql-default_copy` and the backing index as
  89. `.ds-logs-mysql-default_copy-2022-01-01-000001`.
  90. include::../follow-request-body.asciidoc[]
  91. [[ccr-put-auto-follow-pattern-examples]]
  92. ==== {api-examples-title}
  93. This example creates an auto-follow pattern named `my_auto_follow_pattern`:
  94. [source,console]
  95. --------------------------------------------------
  96. PUT /_ccr/auto_follow/my_auto_follow_pattern
  97. {
  98. "remote_cluster" : "remote_cluster",
  99. "leader_index_patterns" :
  100. [
  101. "leader_index*"
  102. ],
  103. "follow_index_pattern" : "{{leader_index}}-follower",
  104. "settings": {
  105. "index.number_of_replicas": 0
  106. },
  107. "max_read_request_operation_count" : 1024,
  108. "max_outstanding_read_requests" : 16,
  109. "max_read_request_size" : "1024k",
  110. "max_write_request_operation_count" : 32768,
  111. "max_write_request_size" : "16k",
  112. "max_outstanding_write_requests" : 8,
  113. "max_write_buffer_count" : 512,
  114. "max_write_buffer_size" : "512k",
  115. "max_retry_delay" : "10s",
  116. "read_poll_timeout" : "30s"
  117. }
  118. --------------------------------------------------
  119. // TEST[setup:remote_cluster]
  120. The API returns the following result:
  121. [source,console-result]
  122. --------------------------------------------------
  123. {
  124. "acknowledged" : true
  125. }
  126. --------------------------------------------------
  127. //////////////////////////
  128. [source,console]
  129. --------------------------------------------------
  130. DELETE /_ccr/auto_follow/my_auto_follow_pattern
  131. --------------------------------------------------
  132. // TEST[continued]
  133. //////////////////////////