添加es用户名与密码
This commit is contained in:
@@ -10,5 +10,7 @@ namespace Yi.Framework.Common.IOCOptions
|
|||||||
{
|
{
|
||||||
public string Url { get; set; }
|
public string Url { get; set; }
|
||||||
public string IndexName { get; set; }
|
public string IndexName { get; set; }
|
||||||
|
public string UserName { get; set; }
|
||||||
|
public string PassWord { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace Yi.Framework.Core
|
|||||||
public ElasticSearchInvoker(IOptionsMonitor<ElasticSearchOptions> optionsMonitor)
|
public ElasticSearchInvoker(IOptionsMonitor<ElasticSearchOptions> optionsMonitor)
|
||||||
{
|
{
|
||||||
_elasticSearchOptions = optionsMonitor.CurrentValue;
|
_elasticSearchOptions = optionsMonitor.CurrentValue;
|
||||||
var settings = new ConnectionSettings(new Uri(_elasticSearchOptions.Url)).DefaultIndex(this._elasticSearchOptions.IndexName);
|
var settings = new ConnectionSettings(new Uri(_elasticSearchOptions.Url)).DefaultIndex(this._elasticSearchOptions.IndexName).BasicAuthentication(this._elasticSearchOptions.UserName, this._elasticSearchOptions.PassWord); ;
|
||||||
Client = new ElasticClient(settings);
|
Client = new ElasticClient(settings);
|
||||||
}
|
}
|
||||||
private ElasticClient Client;
|
private ElasticClient Client;
|
||||||
|
|||||||
Reference in New Issue
Block a user