put-auto-follow-pattern.asciidoc 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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-request-body]]
  62. ==== {api-request-body-title}
  63. `remote_cluster`::
  64. (Required, string) The <<remote-clusters,remote cluster>> containing
  65. the leader indices to match against.
  66. `leader_index_patterns`::
  67. (Optional, array) An array of simple index patterns to match against indices
  68. in the remote cluster specified by the `remote_cluster` field.
  69. `leader_index_exclusion_patterns`::
  70. (Optional, array) An array of simple index patterns that can be used to exclude indices
  71. from being auto-followed. Indices in the remote cluster whose names are matching one or
  72. more `leader_index_patterns` and one or more `leader_index_exclusion_patterns` won't be followed.
  73. `follow_index_pattern`::
  74. (Optional, string) The name of follower index. The template `{{leader_index}}` can be used to
  75. derive the name of the follower index from the name of the leader index. When following a data
  76. stream, the `follow_index_pattern` will be used for renaming not only the leader index, but also
  77. the data stream containing the leader index. For example, a data stream called
  78. `logs-mysql-default` with a backing index of `.ds-logs-mysql-default-2022-01-01-000001` and a
  79. `follow_index_pattern` of `{{leader_index}}_copy` will replicate the data stream as
  80. `logs-mysql-default_copy` and the backing index as
  81. `.ds-logs-mysql-default_copy-2022-01-01-000001`.
  82. include::../follow-request-body.asciidoc[]
  83. [[ccr-put-auto-follow-pattern-examples]]
  84. ==== {api-examples-title}
  85. This example creates an auto-follow pattern named `my_auto_follow_pattern`:
  86. [source,console]
  87. --------------------------------------------------
  88. PUT /_ccr/auto_follow/my_auto_follow_pattern
  89. {
  90. "remote_cluster" : "remote_cluster",
  91. "leader_index_patterns" :
  92. [
  93. "leader_index*"
  94. ],
  95. "follow_index_pattern" : "{{leader_index}}-follower",
  96. "settings": {
  97. "index.number_of_replicas": 0
  98. },
  99. "max_read_request_operation_count" : 1024,
  100. "max_outstanding_read_requests" : 16,
  101. "max_read_request_size" : "1024k",
  102. "max_write_request_operation_count" : 32768,
  103. "max_write_request_size" : "16k",
  104. "max_outstanding_write_requests" : 8,
  105. "max_write_buffer_count" : 512,
  106. "max_write_buffer_size" : "512k",
  107. "max_retry_delay" : "10s",
  108. "read_poll_timeout" : "30s"
  109. }
  110. --------------------------------------------------
  111. // TEST[setup:remote_cluster]
  112. The API returns the following result:
  113. [source,console-result]
  114. --------------------------------------------------
  115. {
  116. "acknowledged" : true
  117. }
  118. --------------------------------------------------
  119. //////////////////////////
  120. [source,console]
  121. --------------------------------------------------
  122. DELETE /_ccr/auto_follow/my_auto_follow_pattern
  123. --------------------------------------------------
  124. // TEST[continued]
  125. //////////////////////////