Skip to content

Commit e87c5ac

Browse files
committed
Add global ccr stats endpoint and tidy up implemented ccr api's thus far
1 parent 853a94f commit e87c5ac

File tree

13 files changed

+553
-489
lines changed

13 files changed

+553
-489
lines changed

src/Nest/XPack/CrossClusterReplication/Follow/FollowIndexStats/FollowIndexStatsRequest.cs

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,17 @@
33

44
namespace Nest
55
{
6+
/// <summary>
7+
/// This API gets follower stats. This API will return shard-level stats about the following tasks
8+
/// associated with each shard for the specified indices.
9+
/// </summary>
610
[MapsApi("ccr.follow_stats.json")]
711
[ContractJsonConverter(typeof(ReadAsTypeJsonConverter<FollowIndexStatsRequest>))]
8-
public partial interface IFollowIndexStatsRequest
9-
{
10-
/// <summary>
11-
///
12-
/// <para>
13-
/// </para>
14-
/// </summary>
15-
[JsonProperty("cursor")]
16-
string Cursor { get; set; }
17-
}
12+
public partial interface IFollowIndexStatsRequest { }
1813

19-
public partial class FollowIndexStatsRequest
20-
{
21-
/// <inheritdoc cref="IFollowIndexStatsRequest.Cursor" />
22-
public string Cursor { get; set; }
23-
}
14+
/// <inheritdoc cref="IFollowIndexStatsRequest"/>
15+
public partial class FollowIndexStatsRequest { }
2416

25-
public partial class FollowIndexStatsDescriptor
26-
{
27-
string IFollowIndexStatsRequest.Cursor { get; set; }
28-
29-
/// <inheritdoc cref="IFollowIndexStatsRequest.Cursor" />
30-
public FollowIndexStatsDescriptor Cursor(string cursor) => Assign(a => a.Cursor = cursor);
31-
}
17+
/// <inheritdoc cref="IFollowIndexStatsRequest"/>
18+
public partial class FollowIndexStatsDescriptor { }
3219
}

src/Nest/XPack/CrossClusterReplication/Follow/PauseFollowIndex/ElasticClient-PauseFollowIndex.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ namespace Nest
77
{
88
public partial interface IElasticClient
99
{
10-
/// <summary></summary>
10+
/// <summary>
11+
/// This API pauses a follower index. When this API returns, the follower index will not fetch any additional operations from
12+
/// the leader index. You can resume following with the resume follower API. Pausing and resuming a follower index can be
13+
/// used to change the configuration of the following task.
14+
/// </summary>
1115
IPauseFollowIndexResponse PauseFollowIndex(IndexName index, Func<PauseFollowIndexDescriptor, IPauseFollowIndexRequest> selector = null);
1216

1317
/// <inheritdoc cref="PauseFollowIndex(IndexName, System.Func{Nest.PauseFollowIndexDescriptor,Nest.IPauseFollowIndexRequest})" />

src/Nest/XPack/CrossClusterReplication/Follow/PauseFollowIndex/PauseFollowIndexRequest.cs

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,18 @@
33

44
namespace Nest
55
{
6+
/// <summary>
7+
/// This API pauses a follower index. When this API returns, the follower index will not fetch any additional operations from
8+
/// the leader index. You can resume following with the resume follower API. Pausing and resuming a follower index can be
9+
/// used to change the configuration of the following task.
10+
/// </summary>
611
[MapsApi("ccr.pause_follow.json")]
712
[ContractJsonConverter(typeof(ReadAsTypeJsonConverter<PauseFollowIndexRequest>))]
8-
public partial interface IPauseFollowIndexRequest
9-
{
10-
/// <summary>
11-
///
12-
/// <para>
13-
/// </para>
14-
/// </summary>
15-
[JsonProperty("cursor")]
16-
string Cursor { get; set; }
17-
}
13+
public partial interface IPauseFollowIndexRequest { }
1814

19-
public partial class PauseFollowIndexRequest
20-
{
21-
/// <inheritdoc cref="IPauseFollowIndexRequest.Cursor" />
22-
public string Cursor { get; set; }
23-
}
15+
/// <inheritdoc cref="IPauseFollowIndexRequest"/>
16+
public partial class PauseFollowIndexRequest { }
2417

25-
public partial class PauseFollowIndexDescriptor
26-
{
27-
string IPauseFollowIndexRequest.Cursor { get; set; }
28-
29-
/// <inheritdoc cref="IPauseFollowIndexRequest.Cursor" />
30-
public PauseFollowIndexDescriptor Cursor(string cursor) => Assign(a => a.Cursor = cursor);
31-
}
18+
/// <inheritdoc cref="IPauseFollowIndexRequest"/>
19+
public partial class PauseFollowIndexDescriptor { }
3220
}

src/Nest/XPack/CrossClusterReplication/Follow/ResumeFollowIndex/ElasticClient-ResumeFollowIndex.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ namespace Nest
77
{
88
public partial interface IElasticClient
99
{
10-
/// <summary></summary>
10+
/// <summary>
11+
/// This API resumes a follower index that has been paused either explicitly with the pause follower API or
12+
/// implicitly due to execution that can not be retried due to failure during following. When this API returns,
13+
/// the follower index will resume fetching operations from the leader index.
14+
/// </summary>
1115
IResumeFollowIndexResponse ResumeFollowIndex(IndexName index, Func<ResumeFollowIndexDescriptor, IResumeFollowIndexRequest> selector = null);
1216

1317
/// <inheritdoc cref="ResumeFollowIndex(IndexName, System.Func{Nest.ResumeFollowIndexDescriptor,Nest.IResumeFollowIndexRequest})" />

src/Nest/XPack/CrossClusterReplication/Follow/ResumeFollowIndex/ResumeFollowIndexRequest.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
namespace Nest
55
{
6+
/// <summary>
7+
/// This API resumes a follower index that has been paused either explicitly with the pause follower API or
8+
/// implicitly due to execution that can not be retried due to failure during following. When this API returns,
9+
/// the follower index will resume fetching operations from the leader index.
10+
/// </summary>
611
[MapsApi("ccr.resume_follow.json")]
712
[ContractJsonConverter(typeof(ReadAsTypeJsonConverter<ResumeFollowIndexRequest>))]
813
public partial interface IResumeFollowIndexRequest
@@ -38,6 +43,7 @@ public partial interface IResumeFollowIndexRequest
3843
Time ReadPollTimeout { get; set; }
3944
}
4045

46+
/// <inheritdoc cref="IResumeFollowIndexRequest"/>
4147
public partial class ResumeFollowIndexRequest
4248
{
4349
/// <inheritdoc cref="ICreateFollowIndexRequest.MaxReadRequestOperationCount"/>
@@ -72,6 +78,7 @@ public partial class ResumeFollowIndexRequest
7278

7379
}
7480

81+
/// <inheritdoc cref="IResumeFollowIndexRequest"/>
7582
public partial class ResumeFollowIndexDescriptor
7683
{
7784
long? IResumeFollowIndexRequest.MaxReadRequestOperationCount { get; set; }

src/Nest/XPack/CrossClusterReplication/Follow/UnfollowIndex/UnfollowIndexRequest.cs

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,18 @@
33

44
namespace Nest
55
{
6+
/// <summary>
7+
/// This API stops the following task associated with a follower index and removes index metadata and settings associated with
8+
/// cross-cluster replication. This enables the index to treated as a regular index. The follower index must be paused and closed
9+
/// before invoking the unfollow API.
10+
/// </summary>
611
[MapsApi("ccr.unfollow.json")]
712
[ContractJsonConverter(typeof(ReadAsTypeJsonConverter<UnfollowIndexRequest>))]
8-
public partial interface IUnfollowIndexRequest
9-
{
10-
/// <summary>
11-
///
12-
/// <para>
13-
/// </para>
14-
/// </summary>
15-
[JsonProperty("cursor")]
16-
string Cursor { get; set; }
17-
}
13+
public partial interface IUnfollowIndexRequest { }
1814

19-
public partial class UnfollowIndexRequest
20-
{
21-
/// <inheritdoc cref="IUnfollowIndexRequest.Cursor" />
22-
public string Cursor { get; set; }
23-
}
15+
/// <inheritdoc cref="IUnfollowIndexRequest"/>
16+
public partial class UnfollowIndexRequest { }
2417

25-
public partial class UnfollowIndexDescriptor
26-
{
27-
string IUnfollowIndexRequest.Cursor { get; set; }
28-
29-
/// <inheritdoc cref="IUnfollowIndexRequest.Cursor" />
30-
public UnfollowIndexDescriptor Cursor(string cursor) => Assign(a => a.Cursor = cursor);
31-
}
18+
/// <inheritdoc cref="IUnfollowIndexRequest"/>
19+
public partial class UnfollowIndexDescriptor { }
3220
}

src/Nest/XPack/CrossClusterReplication/Follow/UnfollowIndex/UnfollowIndexResponse.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
{
33
public interface IUnfollowIndexResponse : IAcknowledgedResponse { }
44

5-
public class UnfollowIndexResponse : AcknowledgedResponseBase, IUnfollowIndexResponse
6-
{
7-
}
5+
public class UnfollowIndexResponse : AcknowledgedResponseBase, IUnfollowIndexResponse { }
86
}

src/Nest/XPack/CrossClusterReplication/Stats/CcrStatsRequest.cs

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,18 @@
33

44
namespace Nest
55
{
6+
/// <summary>
7+
/// This API gets cross-cluster replication stats. This API will return all stats related to cross-cluster replication.
8+
/// In particular, this API returns stats about auto-following, and returns the same shard-level stats as in the get
9+
/// follower stats API. <see cref="IElasticClient.FollowIndexStats(Nest.Indices,System.Func{Nest.FollowIndexStatsDescriptor,Nest.IFollowIndexStatsRequest})"/>
10+
/// </summary>
611
[MapsApi("ccr.stats.json")]
712
[ContractJsonConverter(typeof(ReadAsTypeJsonConverter<CcrStatsRequest>))]
8-
public partial interface ICcrStatsRequest
9-
{
10-
/// <summary>
11-
///
12-
/// <para>
13-
/// </para>
14-
/// </summary>
15-
[JsonProperty("cursor")]
16-
string Cursor { get; set; }
17-
}
13+
public partial interface ICcrStatsRequest { }
1814

19-
public partial class CcrStatsRequest
20-
{
21-
/// <inheritdoc cref="ICcrStatsRequest.Cursor" />
22-
public string Cursor { get; set; }
23-
}
15+
/// <inheritdoc cref="ICcrStatsRequest"/>
16+
public partial class CcrStatsRequest { }
2417

25-
public partial class CcrStatsDescriptor
26-
{
27-
string ICcrStatsRequest.Cursor { get; set; }
28-
29-
/// <inheritdoc cref="ICcrStatsRequest.Cursor" />
30-
public CcrStatsDescriptor Cursor(string cursor) => Assign(a => a.Cursor = cursor);
31-
}
18+
/// <inheritdoc cref="ICcrStatsRequest"/>
19+
public partial class CcrStatsDescriptor { }
3220
}
Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,59 @@
11
using System.Collections.Generic;
2+
using Elasticsearch.Net;
23
using Newtonsoft.Json;
34

45
namespace Nest
56
{
67
public interface ICcrStatsResponse : IResponse
78
{
8-
/// <summary>
9-
///
10-
/// </summary>
11-
[JsonProperty("columns")]
12-
IReadOnlyCollection<SqlColumn> Columns { get; }
9+
[JsonProperty("auto_follow_stats")]
10+
CcrAutoFollowStats AutoFollowStats { get; }
11+
12+
[JsonProperty("follow_stats")]
13+
CcrFollowStats FollowStats { get; }
1314
}
1415

1516
public class CcrStatsResponse : ResponseBase, ICcrStatsResponse
1617
{
17-
/// <inheritdoc cref="ICcrStatsResponse.Columns" />
18-
public IReadOnlyCollection<SqlColumn> Columns { get; internal set; } = EmptyReadOnly<SqlColumn>.Collection;
18+
/// <inheritdoc cref="ICcrStatsResponse.AutoFollowStats"/>
19+
public CcrAutoFollowStats AutoFollowStats { get; internal set; }
20+
21+
/// <inheritdoc cref="ICcrStatsResponse.FollowStats"/>
22+
public CcrFollowStats FollowStats { get; internal set; }
23+
}
24+
25+
26+
public class CcrFollowStats
27+
{
28+
/// <inheritdoc cref="IFollowIndexStatsResponse.Indices" />
29+
[JsonProperty("indices")]
30+
public IReadOnlyCollection<FollowIndexStats> Indices { get; internal set; } = EmptyReadOnly<FollowIndexStats>.Collection;
31+
}
32+
33+
public class CcrAutoFollowStats
34+
{
35+
36+
/// <summary>
37+
/// the number of indices that the auto-follow coordinator failed to automatically follow; the causes of recent failures are
38+
/// captured in the logs of the elected master node, and in the auto_follow_stats.recent_auto_follow_errors field
39+
/// </summary>
40+
[JsonProperty("number_of_failed_follow_indices")]
41+
public long NumberOfFailedFollowIndices { get; internal set; }
42+
43+
/// <summary>
44+
/// the number of times that the auto-follow coordinator failed to retrieve the cluster state from a
45+
/// remote cluster registered in a collection of auto-follow patterns
46+
/// </summary>
47+
[JsonProperty("number_of_failed_remote_cluster_state_requests")]
48+
public long NumberOfFailedRemoteClusterStateRequests { get; internal set; }
49+
50+
/// <summary> the number of indices that the auto-follow coordinator successfully followed </summary>
51+
[JsonProperty("number_of_successful_follow_indices")]
52+
public long NumberOfSuccessfulFollowIndices { get; internal set; }
53+
54+
/// <summary> an array of objects representing failures by the auto-follow coordinator </summary>
55+
[JsonProperty("recent_auto_follow_errors")]
56+
public IReadOnlyCollection<ErrorCause> RecentAutoFollowErrors { get; internal set; } = EmptyReadOnly<ErrorCause>.Collection;
57+
1958
}
2059
}

src/Nest/XPack/CrossClusterReplication/Stats/ElasticClient-CcrStats.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ namespace Nest
77
{
88
public partial interface IElasticClient
99
{
10-
/// <summary></summary>
10+
/// <summary>
11+
/// This API gets cross-cluster replication stats. This API will return all stats related to cross-cluster replication.
12+
/// In particular, this API returns stats about auto-following, and returns the same shard-level stats as in the get
13+
/// follower stats API. <see cref="IElasticClient.FollowIndexStats(Nest.Indices,System.Func{Nest.FollowIndexStatsDescriptor,Nest.IFollowIndexStatsRequest})"/>
14+
/// </summary>
1115
ICcrStatsResponse CcrStats(Func<CcrStatsDescriptor, ICcrStatsRequest> selector = null);
1216

1317
/// <inheritdoc cref="CcrStats(System.Func{Nest.CcrStatsDescriptor,Nest.ICcrStatsRequest})" />

0 commit comments

Comments
 (0)