From 8196cd597a127aa62f809ec466e39c1cc7c2f4f5 Mon Sep 17 00:00:00 2001 From: chenchun Date: Thu, 21 Apr 2022 18:03:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0es=E7=94=A8=E6=88=B7=E5=90=8D?= =?UTF-8?q?=E4=B8=8E=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Yi.Framework.Common/IOCOptions/ElasticSearchOptions.cs | 2 ++ Yi.Framework.Net6/Yi.Framework.Core/ElasticSearchInvoker.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Yi.Framework.Net6/Yi.Framework.Common/IOCOptions/ElasticSearchOptions.cs b/Yi.Framework.Net6/Yi.Framework.Common/IOCOptions/ElasticSearchOptions.cs index 1080aaa6..de6c5301 100644 --- a/Yi.Framework.Net6/Yi.Framework.Common/IOCOptions/ElasticSearchOptions.cs +++ b/Yi.Framework.Net6/Yi.Framework.Common/IOCOptions/ElasticSearchOptions.cs @@ -10,5 +10,7 @@ namespace Yi.Framework.Common.IOCOptions { public string Url { get; set; } public string IndexName { get; set; } + public string UserName { get; set; } + public string PassWord { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Core/ElasticSearchInvoker.cs b/Yi.Framework.Net6/Yi.Framework.Core/ElasticSearchInvoker.cs index 4b4556cc..da72e72f 100644 --- a/Yi.Framework.Net6/Yi.Framework.Core/ElasticSearchInvoker.cs +++ b/Yi.Framework.Net6/Yi.Framework.Core/ElasticSearchInvoker.cs @@ -16,7 +16,7 @@ namespace Yi.Framework.Core public ElasticSearchInvoker(IOptionsMonitor optionsMonitor) { _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); } private ElasticClient Client;