Add support for index pattern exclusion in CCR AutoFollow (#72935)

This commit adds the ability to specify exclusion patterns in Auto-Follow patterns. This allows excluding indices that match any of the inclusion patterns and also match some of the exclusion patterns giving more fine grained control in scenarios where this is important.

Related #67686
This commit is contained in:
Francisco Fernández Castaño 2021-06-04 13:53:30 +02:00 committed by GitHub
parent 9a8be68b27
commit a8101f346f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 570 additions and 40 deletions

View file

@ -22,6 +22,10 @@ PUT /_ccr/auto_follow/my_auto_follow_pattern
[
"leader_index*"
],
"leader_index_exclusion_patterns":
[
"leader_index_001"
],
"follow_index_pattern" : "{{leader_index}}-follower"
}
--------------------------------------------------
@ -96,6 +100,10 @@ The API returns the following result:
[
"leader_index*"
],
"leader_index_exclusion_patterns":
[
"leader_index_001"
],
"follow_index_pattern" : "{{leader_index}}-follower"
}
}

View file

@ -20,6 +20,10 @@ PUT /_ccr/auto_follow/<auto_follow_pattern_name>
[
"<leader_index_pattern>"
],
"leader_index_exclusion_patterns":
[
"<leader_index_exclusion_pattern>"
],
"follow_index_pattern" : "<follow_index_pattern>"
}
--------------------------------------------------
@ -27,6 +31,7 @@ PUT /_ccr/auto_follow/<auto_follow_pattern_name>
// TEST[s/<auto_follow_pattern_name>/auto_follow_pattern_name/]
// TEST[s/<remote_cluster>/remote_cluster/]
// TEST[s/<leader_index_patterns>/leader_index*/]
// TEST[s/<leader_index_exclusion_pattern>//]
// TEST[s/<follow_index_pattern>/{{leader_index}}-follower/]
//////////////////////////
@ -54,7 +59,10 @@ This API creates a new named collection of
<<ccr-auto-follow,auto-follow patterns>> against the remote cluster
specified in the request body. Newly created indices on the remote cluster
matching any of the specified patterns will be automatically configured as follower
indices.
indices. Additionally, this API can be used to update existing
<<ccr-auto-follow,auto-follow patterns>>. Note that follower indices that were configured automatically
before updating an auto-follow pattern will remain unchanged even if they don't match against
the new patterns.
[[ccr-put-auto-follow-pattern-path-parms]]
==== {api-path-parms-title}
@ -72,6 +80,11 @@ indices.
(Optional, array) An array of simple index patterns to match against indices
in the remote cluster specified by the `remote_cluster` field.
`leader_index_exclusion_patterns`::
(Optional, array) An array of simple index patterns that can be used to exclude indices
from being auto-followed. Indices in the remote cluster whose names are matching one or
more `leader_index_patterns` and one or more `leader_index_exclusion_patterns` won't be followed.
`follow_index_pattern`::
(Optional, string) The name of follower index. The template `{{leader_index}}`
can be used to derive the name of the follower index from the name of the