Skip to content

Commit 47cb51f

Browse files
committed
broke the CreateIndex() call because it did not inject connection settings any more thank you @ChrisMcKee
1 parent 4468ace commit 47cb51f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Diff for: src/Nest/DSL/CreateIndexDescriptor.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public partial class CreateIndexDescriptor : IndexPathDescriptorBase<CreateIndex
1616
{
1717
internal string _Index { get; set; }
1818
internal IndexSettings _IndexSettings = new IndexSettings();
19-
private readonly IConnectionSettingsValues _connectionSettings;
19+
private IConnectionSettingsValues _connectionSettings;
2020

2121

2222
/// <summary>
@@ -28,6 +28,12 @@ public CreateIndexDescriptor InitializeUsing(IndexSettings indexSettings)
2828
return this;
2929
}
3030

31+
internal CreateIndexDescriptor SetConnectionSettings(IConnectionSettingsValues connectionSettings)
32+
{
33+
this._connectionSettings = connectionSettings;
34+
return this;
35+
}
36+
3137
/// <summary>
3238
/// Set the number of shards (if possible) for the new index.
3339
/// </summary>

Diff for: src/Nest/ElasticClient-CreateIndex.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public partial class ElasticClient
1212
public IIndicesOperationResponse CreateIndex(Func<CreateIndexDescriptor, CreateIndexDescriptor> createIndexSelector)
1313
{
1414
return this.Dispatch<CreateIndexDescriptor, CreateIndexRequestParameters, IndicesOperationResponse>(
15-
createIndexSelector,
15+
c => createIndexSelector(new CreateIndexDescriptor().SetConnectionSettings(this._connectionSettings)),
1616
(p, d) => this.RawDispatch.IndicesCreateDispatch<IndicesOperationResponse>(p, d._IndexSettings)
1717
);
1818
}
@@ -22,7 +22,7 @@ public Task<IIndicesOperationResponse> CreateIndexAsync(Func<CreateIndexDescript
2222
{
2323
return this.DispatchAsync
2424
<CreateIndexDescriptor, CreateIndexRequestParameters, IndicesOperationResponse, IIndicesOperationResponse>(
25-
createIndexSelector,
25+
c => createIndexSelector(new CreateIndexDescriptor().SetConnectionSettings(this._connectionSettings)),
2626
(p, d) => this.RawDispatch.IndicesCreateDispatchAsync<IndicesOperationResponse>(p, d._IndexSettings)
2727
);
2828
}

0 commit comments

Comments
 (0)