Skip to content

Commit 067e1af

Browse files
committed
Settings changes
Remove suggest threadpool Remove WarmersEnabled, RequestCacheEnabled from Index settings. Add RequestsCacheEnabled Remove TranslogWriteMode Add tests to ensure all types in Nest and Elasticsearch.Net assemblies are in the root namespace Closes #2009
1 parent d59ee87 commit 067e1af

File tree

14 files changed

+347
-423
lines changed

14 files changed

+347
-423
lines changed

src/Nest/Cat/CatThreadPool/CatThreadPoolRecordJsonConverter.cs

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,23 @@ namespace Nest
77
{
88
internal class CatThreadPoolRecordJsonConverter : JsonConverter
99
{
10-
public override bool CanWrite
11-
{
12-
get { return false; }
13-
}
10+
public override bool CanWrite => false;
1411

1512
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
1613
{
1714
throw new NotSupportedException();
1815
}
1916

20-
private static readonly string[] _threadPoolShortHands = new[]
21-
{
17+
private static readonly string[] _threadPoolShortHands = {
2218
"b", "f", "g", "ge", "i", "ma", "m", "o", "p", "r", "s", "sn", "su", "w"
2319
};
2420

25-
private static readonly string[] _fieldShortHands = new[]
26-
{
21+
private static readonly string[] _fieldShortHands = {
2722
"t", "a", "s", "q", "qs", "r", "l", "c", "mi", "ma", "k"
2823
};
29-
private static IEnumerable<Tuple<string, string>> _combinations =
30-
_threadPoolShortHands.SelectMany<string, string, Tuple<string, string>>(t => _fieldShortHands, Tuple.Create);
24+
25+
private static readonly IEnumerable<Tuple<string, string>> _combinations =
26+
_threadPoolShortHands.SelectMany(t => _fieldShortHands, Tuple.Create);
3127

3228
public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
3329
JsonSerializer serializer)
@@ -136,11 +132,6 @@ private void SetThreadPool(string threadPool, CatThreadPoolRecord o, string fiel
136132
if (o.Snapshot == null) o.Snapshot = new CatThreadPool();
137133
this.SetFieldValue(o.Snapshot, field, value);
138134
return;
139-
case "suggest":
140-
case "su":
141-
if (o.Suggest == null) o.Suggest = new CatThreadPool();
142-
this.SetFieldValue(o.Suggest, field, value);
143-
return;
144135
case "warmer":
145136
case "w":
146137
if (o.Warmer == null) o.Warmer = new CatThreadPool();
@@ -162,47 +153,47 @@ private void SetFieldValue(CatThreadPool pool, string field, string value)
162153
{
163154
switch(field)
164155
{
165-
case "type":
156+
case "type":
166157
case "t":
167158
pool.Type = value;
168159
return;
169-
case "active":
160+
case "active":
170161
case "a":
171162
pool.Active = value;
172163
return;
173-
case "size":
164+
case "size":
174165
case "s":
175166
pool.Size = value;
176167
return;
177-
case "queue":
168+
case "queue":
178169
case "q":
179170
pool.Queue = value;
180171
return;
181-
case "queueSize":
172+
case "queueSize":
182173
case "qs":
183174
pool.QueueSize = value;
184175
return;
185-
case "rejected":
176+
case "rejected":
186177
case "r":
187178
pool.Rejected = value;
188179
return;
189-
case "largest":
180+
case "largest":
190181
case "l":
191182
pool.Largest = value;
192183
return;
193-
case "completed":
184+
case "completed":
194185
case "c":
195186
pool.Completed = value;
196187
return;
197-
case "min":
188+
case "min":
198189
case "mi":
199190
pool.Min = value;
200191
return;
201-
case "max":
192+
case "max":
202193
case "ma":
203194
pool.Max = value;
204195
return;
205-
case "keepAlive":
196+
case "keepAlive":
206197
case "k":
207198
pool.KeepAlive = value;
208199
return;
@@ -215,4 +206,4 @@ public override bool CanConvert(Type objectType)
215206
return objectType == typeof(CatThreadPoolRecord);
216207
}
217208
}
218-
}
209+
}

src/Nest/CrossPlatform/SynchronizedCollection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System;
33
using System.Collections;
44
using System.Diagnostics;
5-
using Elasticsearch.Net;
5+
using Nest;
66

77
namespace System.Collections.Generic
88
{
@@ -310,4 +310,4 @@ static void VerifyValueType(object value)
310310
}
311311
}
312312
}
313-
#endif
313+
#endif

src/Nest/IndexModules/IndexSettings/Settings/DynamicIndexSettings.cs

Lines changed: 33 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ namespace Nest
88
public interface IDynamicIndexSettings : IIsADictionary<string, object>
99
{
1010
/// <summary>
11-
///The number of replicas each primary shard has. Defaults to 1.
11+
///The number of replicas each primary shard has. Defaults to 1.
1212
/// </summary>
1313
int? NumberOfReplicas { get; set; }
1414

1515
/// <summary>
16-
///Auto-expand the number of replicas based on the number of available nodes.
17-
/// Set to a dash delimited lower and upper bound (e.g. 0-5) or use all for the upper bound (e.g. 0-all). Defaults to false (i.e. disabled).
16+
///Auto-expand the number of replicas based on the number of available nodes.
17+
/// Set to a dash delimited lower and upper bound (e.g. 0-5) or use all for the upper bound (e.g. 0-all). Defaults to false (i.e. disabled).
1818
/// </summary>
1919
//TODO SPECIAL TYPE FOR THIS INSTEAD OF JUST STRING
2020
string AutoExpandReplicas { get; set; }
@@ -50,30 +50,19 @@ public interface IDynamicIndexSettings : IIsADictionary<string, object>
5050
/// </summary>
5151
int? Priority { get; set; }
5252

53-
/// <summary>
54-
/// Index warmup can be disabled by setting index.warmer.enabled to false. This can be handy when
55-
/// doing initial bulk indexing: disable pre registered warmers to make indexing faster
56-
/// and less expensive and then enable it.
57-
/// </summary>
58-
bool? WarmersEnabled { get; set; }
59-
60-
/// <summary>
61-
/// When a search request is run against an index or against many indices, each involved shard executes the search locally and
62-
/// returns its local results to the coordinating node, which combines these shard-level results into a “global” result set.
63-
///<para>
64-
/// The shard-level request cache module caches the local results on each shard.This allows frequently used
65-
/// (and potentially heavy) search requests to return results almost instantly.</para>
66-
/// </summary>
67-
bool? RequestCacheEnabled { get; set; }
68-
6953
/// <summary>
7054
/// A primary shard is only recovered only if there are
7155
/// enough nodes available to allocate sufficient replicas to form a quorum.
7256
/// </summary>
7357
Union<int, RecoveryInitialShards> RecoveryInitialShards { get; set; }
7458

7559
/// <summary>
76-
/// The allocation of replica shards which become unassigned because a node has left can be
60+
/// Enables the shard-level request cache. Not enabled by default.
61+
/// </summary>
62+
bool? RequestsCacheEnabled { get; set; }
63+
64+
/// <summary>
65+
/// The allocation of replica shards which become unassigned because a node has left can be
7766
/// delayed with this dynamic setting, which defaults to 1m.
7867
/// </summary>
7968
Time UnassignedNodeLeftDelayedTimeout { get; set; }
@@ -94,10 +83,13 @@ public interface IDynamicIndexSettings : IIsADictionary<string, object>
9483
ISlowLog SlowLog { get; set; }
9584

9685
/// <summary>
97-
/// Configure translog settings, EXPERT MODE ONLY!
86+
/// Configure translog settings. This should only be used by experts who know what they're doing
9887
/// </summary>
9988
ITranslogSettings Translog { get; set; }
10089

90+
/// <summary>
91+
/// Configure analysis
92+
/// </summary>
10193
IAnalysis Analysis { get; set; }
10294
}
10395

@@ -109,6 +101,9 @@ public DynamicIndexSettings(Dictionary<string, object> container)
109101
: base(container.Select(kv => kv).ToDictionary(kv => kv.Key, kv => kv.Value))
110102
{ }
111103

104+
/// <inheritdoc/>
105+
public int? NumberOfReplicas { get; set; }
106+
112107
/// <inheritdoc/>
113108
public string AutoExpandReplicas { get; set; }
114109

@@ -120,40 +115,34 @@ public DynamicIndexSettings(Dictionary<string, object> container)
120115

121116
/// <inheritdoc/>
122117
public bool? BlocksReadOnly { get; set; }
123-
118+
124119
/// <inheritdoc/>
125120
public bool? BlocksWrite { get; set; }
126-
121+
127122
/// <inheritdoc/>
128123
public int? Priority { get; set; }
129-
130-
/// <inheritdoc/>
131-
public bool? WarmersEnabled { get; set; }
132-
124+
133125
/// <inheritdoc/>
134-
public bool? RequestCacheEnabled { get; set; }
135-
126+
public bool? RequestsCacheEnabled { get; set; }
127+
136128
/// <inheritdoc/>
137129
public IMergeSettings Merge { get; set; }
138-
139-
/// <inheritdoc/>
140-
public int? NumberOfReplicas { get; set; }
141-
130+
142131
/// <inheritdoc/>
143132
public Union<int, RecoveryInitialShards> RecoveryInitialShards { get; set; }
144-
133+
145134
/// <inheritdoc/>
146135
public Time RefreshInterval { get; set; }
147-
136+
148137
/// <inheritdoc/>
149138
public int? RoutingAllocationTotalShardsPerNode { get; set; }
150-
139+
151140
/// <inheritdoc/>
152141
public ISlowLog SlowLog { get; set; }
153-
142+
154143
/// <inheritdoc/>
155144
public ITranslogSettings Translog { get; set; }
156-
145+
157146
/// <inheritdoc/>
158147
public Time UnassignedNodeLeftDelayedTimeout { get; set; }
159148

@@ -192,7 +181,7 @@ public TDescriptor Setting(string setting, object value)
192181
public TDescriptor NumberOfReplicas(int? numberOfReplicas) => Assign(a => a.NumberOfReplicas = numberOfReplicas);
193182

194183
/// <inheritdoc/>
195-
public TDescriptor AutoExpandReplicas(string AutoExpandReplicas) => Assign(a => a.AutoExpandReplicas = AutoExpandReplicas);
184+
public TDescriptor AutoExpandReplicas(string autoExpandReplicas) => Assign(a => a.AutoExpandReplicas = autoExpandReplicas);
196185

197186
/// <inheritdoc/>
198187
public TDescriptor BlocksMetadata(bool? blocksMetadata = true) => Assign(a => a.BlocksMetadata = blocksMetadata);
@@ -209,12 +198,6 @@ public TDescriptor Setting(string setting, object value)
209198
/// <inheritdoc/>
210199
public TDescriptor Priority(int? priority) => Assign(a => a.Priority = priority);
211200

212-
/// <inheritdoc/>
213-
public TDescriptor WarmersEnabled(bool enabled = true) => Assign(a => a.WarmersEnabled = enabled);
214-
215-
/// <inheritdoc/>
216-
public TDescriptor RequestCacheEnabled(bool enabled = true) => Assign(a => a.RequestCacheEnabled = enabled);
217-
218201
/// <inheritdoc/>
219202
public TDescriptor Merge(Func<MergeSettingsDescriptor, IMergeSettings> merge) =>
220203
Assign(a => a.Merge = merge?.Invoke(new MergeSettingsDescriptor()));
@@ -223,6 +206,10 @@ public TDescriptor Merge(Func<MergeSettingsDescriptor, IMergeSettings> merge) =>
223206
public TDescriptor RecoveryInitialShards(Union<int, RecoveryInitialShards> initialShards) =>
224207
Assign(a => a.RecoveryInitialShards = initialShards);
225208

209+
/// <inheritdoc/>
210+
public TDescriptor RequestsCacheEnabled(bool? enable = true) =>
211+
Assign(a => a.RequestsCacheEnabled = enable);
212+
226213
/// <inheritdoc/>
227214
public TDescriptor RefreshInterval(Time time) => Assign(a => a.RefreshInterval = time);
228215

@@ -245,5 +232,4 @@ public TDescriptor UnassignedNodeLeftDelayedTimeout(Time time) =>
245232
public TDescriptor Analysis(Func<AnalysisDescriptor, IAnalysis> selector) =>
246233
Assign(a => a.Analysis = selector?.Invoke(new AnalysisDescriptor()));
247234
}
248-
249-
}
235+
}

0 commit comments

Comments
 (0)