Skip to content

Commit 1497d34

Browse files
committed
Merge pull request #909 from elasticsearch/feature/cluster-stats
Cluster stats support
2 parents a963df2 + 9d3917f commit 1497d34

19 files changed

+644
-14
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using Elasticsearch.Net;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
7+
namespace Nest
8+
{
9+
internal static class ClusterStatsPathInfo
10+
{
11+
public static void Update(ElasticsearchPathInfo<ClusterStatsRequestParameters> pathInfo)
12+
{
13+
pathInfo.HttpMethod = PathInfoHttpMethod.GET;
14+
}
15+
}
16+
17+
public interface IClusterStatsRequest : IRequest<ClusterStatsRequestParameters>
18+
{
19+
}
20+
21+
public partial class ClusterStatsRequest : BasePathRequest<ClusterStatsRequestParameters>, IClusterStatsRequest
22+
{
23+
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<ClusterStatsRequestParameters> pathInfo)
24+
{
25+
ClusterStatsPathInfo.Update(pathInfo);
26+
}
27+
}
28+
29+
public partial class ClusterStatsDescriptor
30+
: BasePathDescriptor<ClusterStatsDescriptor, ClusterStatsRequestParameters>, IClusterStatsRequest
31+
{
32+
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<ClusterStatsRequestParameters> pathInfo)
33+
{
34+
ClusterStatsPathInfo.Update(pathInfo);
35+
}
36+
}
37+
}

src/Nest/DSL/_Descriptors.generated.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ public ClusterStateDescriptor FlatSettings(bool flat_settings = true)
12371237
///http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/cluster-stats.html
12381238
///</pre>
12391239
///</summary>
1240-
public partial class ClusterStatsDescriptor : BaseRequest<ClusterStatsRequestParameters>
1240+
public partial class ClusterStatsDescriptor
12411241
{
12421242

12431243

@@ -1257,12 +1257,6 @@ public ClusterStatsDescriptor Human(bool human = true)
12571257
return this;
12581258
}
12591259

1260-
1261-
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<ClusterStatsRequestParameters> pathInfo)
1262-
{
1263-
throw new NotImplementedException();
1264-
}
1265-
12661260

12671261
}
12681262

src/Nest/DSL/_Requests.generated.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ public bool FlatSettings
11591159
///http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/cluster-stats.html
11601160
///</pre>
11611161
///</summary>
1162-
public partial class ClusterStatsRequest : BasePathRequest<ClusterStatsRequestParameters>
1162+
public partial class ClusterStatsRequest
11631163
{
11641164

11651165
///<summary>Return settings in flat format (default: false)</summary>
@@ -1177,12 +1177,6 @@ public bool Human
11771177
set { this.Request.RequestParameters.AddQueryString("human", value); }
11781178
}
11791179

1180-
1181-
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<ClusterStatsRequestParameters> pathInfo)
1182-
{
1183-
throw new NotImplementedException();
1184-
}
1185-
11861180
}
11871181

11881182

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
7+
namespace Nest
8+
{
9+
public interface IClusterStatsResponse : IResponse
10+
{
11+
string ClusterName { get; set; }
12+
string Status { get; set; }
13+
IndicesStats Indices { get; set; }
14+
ClusterNodesStats Nodes { get; set; }
15+
}
16+
17+
[JsonObject]
18+
public class ClusterStatsResponse : BaseResponse, IClusterStatsResponse
19+
{
20+
[JsonProperty("cluster_name")]
21+
public string ClusterName { get; set; }
22+
[JsonProperty("status")]
23+
public string Status { get; set; }
24+
25+
[JsonProperty("indices")]
26+
public IndicesStats Indices { get; set; }
27+
28+
[JsonProperty("nodes")]
29+
public ClusterNodesStats Nodes { get; set; }
30+
}
31+
}
Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
7+
namespace Nest
8+
{
9+
[JsonObject]
10+
public class ClusterNodesStats
11+
{
12+
[JsonProperty("count")]
13+
public ClusterNodeCount Count { get; internal set; }
14+
15+
[JsonProperty("versions")]
16+
public List<string> Versions { get; internal set; }
17+
18+
[JsonProperty("os")]
19+
public ClusterOs Os { get; internal set; }
20+
21+
[JsonProperty("process")]
22+
public ClusterProcess Process { get; internal set; }
23+
24+
[JsonProperty("jvm")]
25+
public ClusterJvm Jvm { get; internal set; }
26+
27+
[JsonProperty("fs")]
28+
public ClusterFileSystem FileSystem { get; internal set; }
29+
30+
[JsonProperty("plugins")]
31+
public List<PluginStats> Plugins { get; internal set; }
32+
}
33+
34+
[JsonObject]
35+
public class ClusterFileSystem
36+
{
37+
[JsonProperty("total")]
38+
public string Total { get; internal set; }
39+
[JsonProperty("total_in_bytes")]
40+
public long TotalInBytes { get; internal set; }
41+
[JsonProperty("free")]
42+
public string Free { get; internal set; }
43+
[JsonProperty("free_in_bytes")]
44+
public long FreeInBytes { get; internal set; }
45+
[JsonProperty("available")]
46+
public string Available { get; internal set; }
47+
[JsonProperty("available_in_bytes")]
48+
public long AvailableInBytes { get; internal set; }
49+
[JsonProperty("disk_reads")]
50+
public long DiskReads { get; internal set; }
51+
[JsonProperty("disk_writes")]
52+
public long DiskWrites { get; internal set; }
53+
[JsonProperty("disk_io_op")]
54+
public long DiskIoOps { get; internal set; }
55+
[JsonProperty("disk_read_size")]
56+
public string DiskReadSize { get; internal set; }
57+
[JsonProperty("disk_read_size_in_bytes")]
58+
public long DiskReadSizeInBytes { get; internal set; }
59+
[JsonProperty("disk_write_size")]
60+
public string DiskWriteSize { get; internal set; }
61+
[JsonProperty("disk_write_size_in_bytes")]
62+
public long DiskWriteSizeInBytes { get; internal set; }
63+
[JsonProperty("disk_queue")]
64+
public string DiskQueue { get; internal set; }
65+
}
66+
67+
[JsonObject]
68+
public class ClusterJvm
69+
{
70+
[JsonProperty("max_uptime")]
71+
public string MaxUptime { get; internal set; }
72+
73+
[JsonProperty("max_uptime_in_milliseconds")]
74+
public string MaxUptimeInMilliseconds { get; internal set; }
75+
76+
[JsonProperty("versions")]
77+
public List<ClusterJvmVersion> Versions { get; internal set; }
78+
79+
[JsonProperty("mem")]
80+
public ClusterJvmMemory Memory { get; internal set; }
81+
82+
[JsonProperty("threads")]
83+
public long Threads { get; internal set; }
84+
}
85+
86+
[JsonObject]
87+
public class ClusterJvmVersion
88+
{
89+
[JsonProperty("version")]
90+
public string Version { get; internal set; }
91+
92+
[JsonProperty("vm_name")]
93+
public string VmName { get; internal set; }
94+
95+
[JsonProperty("vm_version")]
96+
public string VmVersion { get; internal set; }
97+
98+
[JsonProperty("vm_vendor")]
99+
public string VmVendor { get; internal set; }
100+
101+
[JsonProperty("count")]
102+
public int Count { get; internal set; }
103+
}
104+
105+
[JsonObject]
106+
public class ClusterJvmMemory
107+
{
108+
[JsonProperty("heap_used")]
109+
public string HeapUsed { get ;set;}
110+
111+
[JsonProperty("heap_used_in_bytes")]
112+
public long HeapUsedInBytes { get; internal set; }
113+
114+
[JsonProperty("heap_max")]
115+
public string HeapMax { get; internal set; }
116+
117+
[JsonProperty("heap_max_in_bytes")]
118+
public long HeapMaxInBytes { get; internal set; }
119+
}
120+
121+
[JsonObject]
122+
public class ClusterProcess
123+
{
124+
[JsonProperty("cpu")]
125+
public ClusterProcessCpu Cpu { get; internal set; }
126+
127+
[JsonProperty("open_file_descriptors")]
128+
public ClusterProcessOpenFileDescriptors OpenFileDescriptors { get; internal set; }
129+
}
130+
131+
[JsonObject]
132+
public class ClusterProcessCpu
133+
{
134+
[JsonProperty("percent")]
135+
public int Percent { get; internal set; }
136+
}
137+
138+
[JsonObject]
139+
public class ClusterProcessOpenFileDescriptors
140+
{
141+
[JsonProperty("min")]
142+
public long Min { get; internal set; }
143+
144+
[JsonProperty("max")]
145+
public long Max { get; internal set; }
146+
147+
[JsonProperty("avg")]
148+
public long Avg { get; internal set; }
149+
}
150+
151+
[JsonObject]
152+
public class ClusterOs
153+
{
154+
[JsonProperty("available_processors")]
155+
public int AvailableProcessors { get; internal set; }
156+
157+
[JsonProperty("mem")]
158+
public ClusterOsMemory Memory { get; internal set; }
159+
160+
[JsonProperty("cpu")]
161+
public List<ClusterCpu> Cpu { get; internal set; }
162+
}
163+
164+
[JsonObject]
165+
public class ClusterOsMemory
166+
{
167+
[JsonProperty("total_in_bytes")]
168+
public long TotalInBytes { get; internal set; }
169+
}
170+
171+
[JsonObject]
172+
public class ClusterCpu
173+
{
174+
[JsonProperty("vendor")]
175+
public string Vendor { get; internal set; }
176+
177+
[JsonProperty("model")]
178+
public string Model { get; internal set; }
179+
180+
[JsonProperty("mhz")]
181+
public int Mhz { get; internal set; }
182+
183+
[JsonProperty("total_scores")]
184+
public int TotalCores { get; internal set; }
185+
186+
[JsonProperty("total_sockets")]
187+
public int TotalSockets { get; internal set; }
188+
189+
[JsonProperty("cores_per_socket")]
190+
public int CoresPerSocket { get; internal set; }
191+
192+
[JsonProperty("cache_size_in_bytes")]
193+
public int CacheSizeInBytes { get; internal set; }
194+
195+
[JsonProperty("count")]
196+
public int Count { get; internal set; }
197+
}
198+
199+
[JsonObject]
200+
public class ClusterNodeCount
201+
{
202+
[JsonProperty("total")]
203+
public int Total { get; internal set; }
204+
205+
[JsonProperty("master_only")]
206+
public int MasterOnly { get; internal set; }
207+
208+
[JsonProperty("data_only")]
209+
public int DataOnly { get; internal set; }
210+
211+
[JsonProperty("master_data")]
212+
public int MasterData { get; internal set; }
213+
214+
[JsonProperty("client")]
215+
public int Client { get; internal set; }
216+
}
217+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
7+
namespace Nest
8+
{
9+
[JsonObject]
10+
public class CompletionStats
11+
{
12+
[JsonProperty("size")]
13+
public string Size { get; set; }
14+
15+
[JsonProperty("size_in_bytes")]
16+
public long SizeInBytes { get; set; }
17+
}
18+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
7+
namespace Nest
8+
{
9+
[JsonObject]
10+
public class FieldDataStats
11+
{
12+
[JsonProperty("memory_size")]
13+
public string MemorySize { get; set; }
14+
15+
[JsonProperty("memory_size_in_bytes")]
16+
public long MemorySizeInBytes { get; set; }
17+
18+
[JsonProperty("evictions")]
19+
public long Evictions { get; set; }
20+
}
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
7+
namespace Nest
8+
{
9+
[JsonObject]
10+
public class FilterCacheStats
11+
{
12+
[JsonProperty("memory_size")]
13+
public string MemorySize { get; set; }
14+
15+
[JsonProperty("memory_size_in_bytes")]
16+
public long MemorySizeInBytes { get; set; }
17+
18+
[JsonProperty("evictions")]
19+
public long Evictions { get; set; }
20+
}
21+
}

0 commit comments

Comments
 (0)