Skip to content

Commit

Permalink
Support index pattern exclusion in CCR AutoFollow (#5832) (#5833)
Browse files Browse the repository at this point in the history
* Add leader index exclusion patterns

* Update create auto follow pattern request

* Update auto follow pattern response

Co-authored-by: Steve Gordon <[email protected]>
  • Loading branch information
github-actions[bot] and stevejgordon authored Jul 11, 2021
1 parent 1d70c56 commit 8398d53
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public partial class CreateAutoFollowPatternRequest
public string RemoteCluster { get; set; }
/// <inheritdoc cref="IAutoFollowPattern.LeaderIndexPatterns"/>
public IEnumerable<string> LeaderIndexPatterns { get; set; }
/// <inheritdoc cref="IAutoFollowPattern.LeaderIndexExclusionPatterns"/>
public IEnumerable<string> LeaderIndexExclusionPatterns { get; set; }
/// <inheritdoc cref="IAutoFollowPattern.Settings"/>
public IIndexSettings Settings { get; set; }
/// <inheritdoc cref="IAutoFollowPattern.FollowIndexPattern"/>
Expand Down Expand Up @@ -54,6 +56,7 @@ public partial class CreateAutoFollowPatternDescriptor
{
string IAutoFollowPattern.RemoteCluster { get; set; }
IEnumerable<string> IAutoFollowPattern.LeaderIndexPatterns { get; set; }
IEnumerable<string> IAutoFollowPattern.LeaderIndexExclusionPatterns { get; set; }
string IAutoFollowPattern.FollowIndexPattern { get; set; }
IIndexSettings IAutoFollowPattern.Settings { get; set; }
int? IAutoFollowPattern.MaxReadRequestOperationCount { get; set; }
Expand All @@ -78,6 +81,14 @@ public CreateAutoFollowPatternDescriptor LeaderIndexPatterns(IEnumerable<string>
public CreateAutoFollowPatternDescriptor LeaderIndexPatterns(params string[] leaderIndexPatterns) =>
Assign(leaderIndexPatterns, (a, v) => a.LeaderIndexPatterns = v);

/// <inheritdoc cref="IAutoFollowPattern.LeaderIndexExclusionPatterns"/>
public CreateAutoFollowPatternDescriptor LeaderIndexExclusionPatterns(IEnumerable<string> leaderIndexExclusionPatterns) =>
Assign(leaderIndexExclusionPatterns, (a, v) => a.LeaderIndexExclusionPatterns = v);

/// <inheritdoc cref="IAutoFollowPattern.LeaderIndexExclusionPatterns"/>
public CreateAutoFollowPatternDescriptor LeaderIndexExclusionPatterns(params string[] leaderIndexExclusionPatterns) =>
Assign(leaderIndexExclusionPatterns, (a, v) => a.LeaderIndexExclusionPatterns = v);

/// <inheritdoc cref="IAutoFollowPattern.FollowIndexPattern"/>
public CreateAutoFollowPatternDescriptor FollowIndexPattern(string followIndexPattern) =>
Assign(followIndexPattern, (a, v) => a.FollowIndexPattern = v);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ public interface IAutoFollowPattern
[DataMember(Name = "leader_index_patterns")]
IEnumerable<string> LeaderIndexPatterns { get; set; }

/// <summary>
/// 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.
/// </summary>
[DataMember(Name = "leader_index_exclusion_patterns")]
IEnumerable<string> LeaderIndexExclusionPatterns { get; set; }

/// <summary>
/// Settings to override from the leader index.
/// Note that certain settings can not be overrode e.g. index.number_of_shards.
Expand Down Expand Up @@ -197,6 +204,8 @@ public class AutoFollowPattern : IAutoFollowPattern

/// <inheritdoc cref="IAutoFollowPattern.LeaderIndexPatterns" />
public IEnumerable<string> LeaderIndexPatterns { get; set; }
/// <inheritdoc cref="IAutoFollowPattern.LeaderIndexExclusionPatterns" />
public IEnumerable<string> LeaderIndexExclusionPatterns { get; set; }

/// <inheritdoc cref="IAutoFollowPattern.Settings" />
public IIndexSettings Settings { get; set; }
Expand Down

0 comments on commit 8398d53

Please sign in to comment.