Skip to content

Commit 874ed5c

Browse files
committed
Support for supplying index settings on restore #1362 - SettingNames has been renamed to UpdatableSettings
1 parent a9f1be5 commit 874ed5c

File tree

3 files changed

+40
-40
lines changed

3 files changed

+40
-40
lines changed

src/Nest/DSL/UpdateSettingsDescriptor.cs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Nest
77
{
8-
public class SettingNames
8+
public class UpdatableSettings
99
{
1010
public const string NumberOfReplicas = "index.number_of_replicas";
1111
public const string AutoExpandReplicas = "index.auto_expand_replicas";
@@ -46,109 +46,109 @@ public class SettingNames
4646

4747
public interface IUpdateSettingsRequest : IIndexOptionalPath<UpdateSettingsRequestParameters>
4848
{
49-
[JsonProperty(SettingNames.NumberOfReplicas)]
49+
[JsonProperty(UpdatableSettings.NumberOfReplicas)]
5050
int? NumberOfReplicas { get; set; }
5151

52-
[JsonProperty(SettingNames.AutoExpandReplicas)]
52+
[JsonProperty(UpdatableSettings.AutoExpandReplicas)]
5353
object AutoExpandReplicas { get; set; }
5454

55-
[JsonProperty(SettingNames.BlocksReadOnly)]
55+
[JsonProperty(UpdatableSettings.BlocksReadOnly)]
5656
bool? BlocksReadOnly { get; set; }
5757

58-
[JsonProperty(SettingNames.BlocksRead)]
58+
[JsonProperty(UpdatableSettings.BlocksRead)]
5959
bool? BlocksRead { get; set; }
6060

61-
[JsonProperty(SettingNames.BlocksWrite)]
61+
[JsonProperty(UpdatableSettings.BlocksWrite)]
6262
bool? BlocksWrite { get; set; }
6363

64-
[JsonProperty(SettingNames.BlocksMetadata)]
64+
[JsonProperty(UpdatableSettings.BlocksMetadata)]
6565
bool? BlocksMetadata { get; set; }
6666

67-
[JsonProperty(SettingNames.RefreshInterval)]
67+
[JsonProperty(UpdatableSettings.RefreshInterval)]
6868
string RefreshInterval { get; set; }
6969

70-
[JsonProperty(SettingNames.IndexConcurrency)]
70+
[JsonProperty(UpdatableSettings.IndexConcurrency)]
7171
int? IndexConcurrency { get; set; }
7272

73-
[JsonProperty(SettingNames.Codec)]
73+
[JsonProperty(UpdatableSettings.Codec)]
7474
string Codec { get; set; }
7575

76-
[JsonProperty(SettingNames.CodecBloomLoad)]
76+
[JsonProperty(UpdatableSettings.CodecBloomLoad)]
7777
bool? CodecBloomLoad { get; set; }
7878

79-
[JsonProperty(SettingNames.FailOnMergeFailure)]
79+
[JsonProperty(UpdatableSettings.FailOnMergeFailure)]
8080
bool? FailOnMergeFailure { get; set; }
8181

82-
[JsonProperty(SettingNames.TranslogFlushTreshHoldOps)]
82+
[JsonProperty(UpdatableSettings.TranslogFlushTreshHoldOps)]
8383
string TranslogFlushTreshHoldOps { get; set; }
8484

85-
[JsonProperty(SettingNames.TranslogFlushThresholdSize)]
85+
[JsonProperty(UpdatableSettings.TranslogFlushThresholdSize)]
8686
string TranslogFlushThresholdSize { get; set; }
8787

88-
[JsonProperty(SettingNames.TranslogFlushThresholdPeriod)]
88+
[JsonProperty(UpdatableSettings.TranslogFlushThresholdPeriod)]
8989
string TranslogFlushThresholdPeriod { get; set; }
9090

91-
[JsonProperty(SettingNames.TranslogDisableFlush)]
91+
[JsonProperty(UpdatableSettings.TranslogDisableFlush)]
9292
bool? TranslogDisableFlush { get; set; }
9393

94-
[JsonProperty(SettingNames.CacheFilterMaxSize)]
94+
[JsonProperty(UpdatableSettings.CacheFilterMaxSize)]
9595
string CacheFilterMaxSize { get; set; }
9696

97-
[JsonProperty(SettingNames.CacheFilterExpire)]
97+
[JsonProperty(UpdatableSettings.CacheFilterExpire)]
9898
string CacheFilterExpire { get; set; }
9999

100-
[JsonProperty(SettingNames.CacheQueryEnable)]
100+
[JsonProperty(UpdatableSettings.CacheQueryEnable)]
101101
bool? CacheQueryEnable { get; set; }
102102

103-
[JsonProperty(SettingNames.GatewaySnapshotInterval)]
103+
[JsonProperty(UpdatableSettings.GatewaySnapshotInterval)]
104104
string GatewaySnapshotInterval { get; set; }
105105

106-
[JsonProperty(SettingNames.RoutingAllocationInclude)]
106+
[JsonProperty(UpdatableSettings.RoutingAllocationInclude)]
107107
IDictionary<string, object> RoutingAllocationInclude { get; set; }
108108

109-
[JsonProperty(SettingNames.RoutingAllocationExclude)]
109+
[JsonProperty(UpdatableSettings.RoutingAllocationExclude)]
110110
IDictionary<string, object> RoutingAllocationExclude { get; set; }
111111

112-
[JsonProperty(SettingNames.RoutingAllocationRequire)]
112+
[JsonProperty(UpdatableSettings.RoutingAllocationRequire)]
113113
IDictionary<string, object> RoutingAllocationRequire { get; set; }
114114

115-
[JsonProperty(SettingNames.RoutingAllocationEnable)]
115+
[JsonProperty(UpdatableSettings.RoutingAllocationEnable)]
116116
RoutingAllocationEnableOption? RoutingAllocationEnable { get; set; }
117117

118-
[JsonProperty(SettingNames.RoutingAllocationDisableAllication)]
118+
[JsonProperty(UpdatableSettings.RoutingAllocationDisableAllication)]
119119
bool? RoutingAllocationDisableAllication { get; set; }
120120

121-
[JsonProperty(SettingNames.RoutingAllocationDisableNewAllocation)]
121+
[JsonProperty(UpdatableSettings.RoutingAllocationDisableNewAllocation)]
122122
bool? RoutingAllocationDisableNewAllocation { get; set; }
123123

124-
[JsonProperty(SettingNames.RoutingAllocationDisableReplicaAllocation)]
124+
[JsonProperty(UpdatableSettings.RoutingAllocationDisableReplicaAllocation)]
125125
bool? RoutingAllocationDisableReplicaAllocation { get; set; }
126126

127-
[JsonProperty(SettingNames.RoutingAllocationTotalShardsPerNode)]
127+
[JsonProperty(UpdatableSettings.RoutingAllocationTotalShardsPerNode)]
128128
int? RoutingAllocationTotalShardsPerNode { get; set; }
129129

130-
[JsonProperty(SettingNames.RecoveryInitialShards)]
130+
[JsonProperty(UpdatableSettings.RecoveryInitialShards)]
131131
string RecoveryInitialShards { get; set; }
132132

133-
[JsonProperty(SettingNames.GcDeletes)]
133+
[JsonProperty(UpdatableSettings.GcDeletes)]
134134
bool? GcDeletes { get; set; }
135135

136-
[JsonProperty(SettingNames.TtlDisablePurge)]
136+
[JsonProperty(UpdatableSettings.TtlDisablePurge)]
137137
bool? TtlDisablePurge { get; set; }
138138

139-
[JsonProperty(SettingNames.TranslogFsType)]
139+
[JsonProperty(UpdatableSettings.TranslogFsType)]
140140
string TranslogFsType { get; set; }
141141

142-
[JsonProperty(SettingNames.CompoundFormat)]
142+
[JsonProperty(UpdatableSettings.CompoundFormat)]
143143
bool? CompoundFormat { get; set; }
144144

145-
[JsonProperty(SettingNames.CompoundOnFlush)]
145+
[JsonProperty(UpdatableSettings.CompoundOnFlush)]
146146
bool? CompoundOnFlush { get; set; }
147147

148-
[JsonProperty(SettingNames.WarmersEnabled)]
148+
[JsonProperty(UpdatableSettings.WarmersEnabled)]
149149
bool? WarmersEnabled { get; set; }
150150

151-
[JsonProperty(SettingNames.Analysis)]
151+
[JsonProperty(UpdatableSettings.Analysis)]
152152
AnalysisSettings Analysis { get; set; }
153153
}
154154

src/Tests/Nest.Tests.Integration/Core/Repository/RestoreTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public void SnapshotRestore_IndexSettings()
122122
.IgnoreUnavailable(true)
123123
.IndexSettings(descriptor => descriptor
124124
.RefreshInterval("123s"))
125-
.IgnoreIndexSettings(SettingNames.BlocksWrite));
125+
.IgnoreIndexSettings(UpdatableSettings.BlocksWrite));
126126

127127
restoreResponse.IsValid.Should().BeTrue();
128128
_restoredIndexName = _indexName.Replace(d + "_", d + "_restored_");
@@ -132,8 +132,8 @@ public void SnapshotRestore_IndexSettings()
132132

133133
var indexSettingsResponse = this.Client.GetIndexSettings(descriptor => descriptor.Index(_restoredIndexName));
134134
indexSettingsResponse.IsValid.Should().BeTrue();
135-
indexSettingsResponse.IndexSettings.Settings[SettingNames.RefreshInterval].Should().Be("123s");
136-
indexSettingsResponse.IndexSettings.Settings[SettingNames.BlocksWrite].Should().BeNull();
135+
indexSettingsResponse.IndexSettings.Settings[UpdatableSettings.RefreshInterval].Should().Be("123s");
136+
indexSettingsResponse.IndexSettings.Settings[UpdatableSettings.BlocksWrite].Should().BeNull();
137137
}
138138

139139
[Test]

src/Tests/Nest.Tests.Unit/Core/Repository/RestoreTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public void Restore()
2222
.IndexSettings(settingsDescriptor => settingsDescriptor
2323
.NumberOfReplicas(0)
2424
.BlocksRead())
25-
.IgnoreIndexSettings(SettingNames.RefreshInterval, SettingNames.AutoExpandReplicas));
25+
.IgnoreIndexSettings(UpdatableSettings.RefreshInterval, UpdatableSettings.AutoExpandReplicas));
2626

2727
restoreResponse.ConnectionStatus.RequestUrl.Should().Be("http://localhost:9200/_snapshot/repository/snapshotName/_restore");
2828
this.JsonEquals(restoreResponse.ConnectionStatus.Request, MethodInfo.GetCurrentMethod());

0 commit comments

Comments
 (0)