From 8398d5307efd19f1ad09b910459530fe169f3e12 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 11 Jul 2021 19:12:39 +0100 Subject: [PATCH] Support index pattern exclusion in CCR AutoFollow (#5832) (#5833) * Add leader index exclusion patterns * Update create auto follow pattern request * Update auto follow pattern response Co-authored-by: Steve Gordon --- .../CreateAutoFollowPatternRequest.cs | 11 +++++++++++ .../GetAutoFollowPatternResponse.cs | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/src/Nest/XPack/CrossClusterReplication/AutoFollow/CreateAutoFollowPattern/CreateAutoFollowPatternRequest.cs b/src/Nest/XPack/CrossClusterReplication/AutoFollow/CreateAutoFollowPattern/CreateAutoFollowPatternRequest.cs index a2f1ccf6eba..3c6c4a085c1 100644 --- a/src/Nest/XPack/CrossClusterReplication/AutoFollow/CreateAutoFollowPattern/CreateAutoFollowPatternRequest.cs +++ b/src/Nest/XPack/CrossClusterReplication/AutoFollow/CreateAutoFollowPattern/CreateAutoFollowPatternRequest.cs @@ -23,6 +23,8 @@ public partial class CreateAutoFollowPatternRequest public string RemoteCluster { get; set; } /// public IEnumerable LeaderIndexPatterns { get; set; } + /// + public IEnumerable LeaderIndexExclusionPatterns { get; set; } /// public IIndexSettings Settings { get; set; } /// @@ -54,6 +56,7 @@ public partial class CreateAutoFollowPatternDescriptor { string IAutoFollowPattern.RemoteCluster { get; set; } IEnumerable IAutoFollowPattern.LeaderIndexPatterns { get; set; } + IEnumerable IAutoFollowPattern.LeaderIndexExclusionPatterns { get; set; } string IAutoFollowPattern.FollowIndexPattern { get; set; } IIndexSettings IAutoFollowPattern.Settings { get; set; } int? IAutoFollowPattern.MaxReadRequestOperationCount { get; set; } @@ -78,6 +81,14 @@ public CreateAutoFollowPatternDescriptor LeaderIndexPatterns(IEnumerable public CreateAutoFollowPatternDescriptor LeaderIndexPatterns(params string[] leaderIndexPatterns) => Assign(leaderIndexPatterns, (a, v) => a.LeaderIndexPatterns = v); + /// + public CreateAutoFollowPatternDescriptor LeaderIndexExclusionPatterns(IEnumerable leaderIndexExclusionPatterns) => + Assign(leaderIndexExclusionPatterns, (a, v) => a.LeaderIndexExclusionPatterns = v); + + /// + public CreateAutoFollowPatternDescriptor LeaderIndexExclusionPatterns(params string[] leaderIndexExclusionPatterns) => + Assign(leaderIndexExclusionPatterns, (a, v) => a.LeaderIndexExclusionPatterns = v); + /// public CreateAutoFollowPatternDescriptor FollowIndexPattern(string followIndexPattern) => Assign(followIndexPattern, (a, v) => a.FollowIndexPattern = v); diff --git a/src/Nest/XPack/CrossClusterReplication/AutoFollow/GetAutoFollowPattern/GetAutoFollowPatternResponse.cs b/src/Nest/XPack/CrossClusterReplication/AutoFollow/GetAutoFollowPattern/GetAutoFollowPatternResponse.cs index 13dc5e5297e..c3f9740d72f 100644 --- a/src/Nest/XPack/CrossClusterReplication/AutoFollow/GetAutoFollowPattern/GetAutoFollowPatternResponse.cs +++ b/src/Nest/XPack/CrossClusterReplication/AutoFollow/GetAutoFollowPattern/GetAutoFollowPatternResponse.cs @@ -109,6 +109,13 @@ public interface IAutoFollowPattern [DataMember(Name = "leader_index_patterns")] IEnumerable LeaderIndexPatterns { get; set; } + /// + /// 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. + /// + [DataMember(Name = "leader_index_exclusion_patterns")] + IEnumerable LeaderIndexExclusionPatterns { get; set; } + /// /// Settings to override from the leader index. /// Note that certain settings can not be overrode e.g. index.number_of_shards. @@ -197,6 +204,8 @@ public class AutoFollowPattern : IAutoFollowPattern /// public IEnumerable LeaderIndexPatterns { get; set; } + /// + public IEnumerable LeaderIndexExclusionPatterns { get; set; } /// public IIndexSettings Settings { get; set; }