put-auto-follow-pattern.asciidoc 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. Indices on the remote cluster that were created before the auto-follow
  52. pattern is created won't be auto-followed even if they match the pattern.
  53. This API can also be used to update existing
  54. <<ccr-auto-follow,auto-follow patterns>>. Note that follower indices that were configured automatically
  55. before updating an auto-follow pattern will remain unchanged even if they don't match against
  56. the new patterns.
  57. [[ccr-put-auto-follow-pattern-path-parms]]
  58. ==== {api-path-parms-title}
  59. `<auto_follow_pattern_name>`::
  60. (Required, string) The name of the collection of auto-follow patterns.
  61. [[ccr-put-auto-follow-pattern-query-params]]
  62. ==== {api-query-parms-title}
  63. `master_timeout`::
  64. (Optional, <<time-units, time units>>) Specifies the period of time to wait for
  65. a connection to the master node. If no response is received before the timeout
  66. expires, the request fails and returns an error. Defaults to `30s`.
  67. [[ccr-put-auto-follow-pattern-request-body]]
  68. ==== {api-request-body-title}
  69. `remote_cluster`::
  70. (Required, string) The <<remote-clusters,remote cluster>> containing
  71. the leader indices to match against.
  72. `leader_index_patterns`::
  73. (Optional, array) An array of simple index patterns to match against indices
  74. in the remote cluster specified by the `remote_cluster` field.
  75. `leader_index_exclusion_patterns`::
  76. (Optional, array) An array of simple index patterns that can be used to exclude indices
  77. from being auto-followed. Indices in the remote cluster whose names are matching one or
  78. more `leader_index_patterns` and one or more `leader_index_exclusion_patterns` won't be followed.
  79. `follow_index_pattern`::
  80. (Optional, string) The name of follower index. The template `{{leader_index}}` can be used to
  81. derive the name of the follower index from the name of the leader index. When following a data
  82. stream, the `follow_index_pattern` will be used for renaming not only the leader index, but also
  83. the data stream containing the leader index. For example, a data stream called
  84. `logs-mysql-default` with a backing index of `.ds-logs-mysql-default-2022-01-01-000001` and a
  85. `follow_index_pattern` of `{{leader_index}}_copy` will replicate the data stream as
  86. `logs-mysql-default_copy` and the backing index as
  87. `.ds-logs-mysql-default_copy-2022-01-01-000001`.
  88. include::../follow-request-body.asciidoc[]
  89. [[ccr-put-auto-follow-pattern-examples]]
  90. ==== {api-examples-title}
  91. This example creates an auto-follow pattern named `my_auto_follow_pattern`:
  92. [source,console]
  93. --------------------------------------------------
  94. PUT /_ccr/auto_follow/my_auto_follow_pattern
  95. {
  96. "remote_cluster" : "remote_cluster",
  97. "leader_index_patterns" :
  98. [
  99. "leader_index*"
  100. ],
  101. "follow_index_pattern" : "{{leader_index}}-follower",
  102. "settings": {
  103. "index.number_of_replicas": 0
  104. },
  105. "max_read_request_operation_count" : 1024,
  106. "max_outstanding_read_requests" : 16,
  107. "max_read_request_size" : "1024k",
  108. "max_write_request_operation_count" : 32768,
  109. "max_write_request_size" : "16k",
  110. "max_outstanding_write_requests" : 8,
  111. "max_write_buffer_count" : 512,
  112. "max_write_buffer_size" : "512k",
  113. "max_retry_delay" : "10s",
  114. "read_poll_timeout" : "30s"
  115. }
  116. --------------------------------------------------
  117. // TEST[setup:remote_cluster]
  118. The API returns the following result:
  119. [source,console-result]
  120. --------------------------------------------------
  121. {
  122. "acknowledged" : true
  123. }
  124. --------------------------------------------------
  125. //////////////////////////
  126. [source,console]
  127. --------------------------------------------------
  128. DELETE /_ccr/auto_follow/my_auto_follow_pattern
  129. --------------------------------------------------
  130. // TEST[continued]
  131. //////////////////////////