Skip to content

Commit 6004f99

Browse files
committed
Support for supplying index settings on restore #1362
1 parent 16b0d21 commit 6004f99

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/Nest/DSL/RestoreDescriptor.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,10 @@ public RestoreDescriptor RenameReplacement(string renameReplacement)
111111
return this;
112112
}
113113

114-
public RestoreDescriptor IndexSettings(Func<UpdateSettingsDescriptor, UpdateSettingsDescriptor> settings)
114+
public RestoreDescriptor IndexSettings(Func<UpdateSettingsDescriptor, UpdateSettingsDescriptor> settingsSelector)
115115
{
116-
Self.IndexSettings = settings(new UpdateSettingsDescriptor());
116+
settingsSelector.ThrowIfNull("settings");
117+
Self.IndexSettings = settingsSelector(new UpdateSettingsDescriptor());
117118
return this;
118119
}
119120

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,26 @@ public void Restore()
2929
}
3030

3131
[Test]
32-
[ExpectedException]
32+
[ExpectedException(typeof(ArgumentNullException))]
3333
public void Null_IgnoreIndexSettings_ThorwException()
3434
{
3535
List<string> ignoreIndexSettings = null;
3636
_client.Restore("repository", "snapshotName",
3737
descriptor => descriptor
38+
.Index("index")
3839
.IgnoreIndexSettings(ignoreIndexSettings));
3940
}
4041

4142
[Test]
42-
[ExpectedException]
43+
[ExpectedException(typeof(ArgumentNullException))]
4344
public void Null_IndexSettings_ThorwException()
4445
{
45-
Func<UpdateSettingsDescriptor, UpdateSettingsDescriptor> settings = null;
46+
Func<UpdateSettingsDescriptor, UpdateSettingsDescriptor> settingsSelector = null;
4647

4748
var restoreResponse = _client.Restore("repository", "snapshotName",
4849
descriptor => descriptor
49-
.IndexSettings(settings));
50+
.Index("index")
51+
.IndexSettings(settingsSelector));
5052
}
5153
}
5254
}

0 commit comments

Comments
 (0)