Created
March 8, 2022 16:15
-
-
Save awswithdotnet/adb7411d6cf0faf428e1d8984d1c75d1 to your computer and use it in GitHub Desktop.
elasticsearch elasticsearch ElasticSearchClientFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Abstractions; | |
using Nest; | |
namespace Elasticsearch | |
{ | |
public class ElasticSearchClientFactory : IElasticSearchClientFactory | |
{ | |
private readonly IElasticSearchConnectionSettingsFactory _connectionSettingsFactory; | |
public ElasticSearchClientFactory(IElasticSearchConnectionSettingsFactory connectionSettingsFactory) | |
{ | |
_connectionSettingsFactory = connectionSettingsFactory; | |
} | |
public IElasticClient GetClient() | |
{ | |
ConnectionSettings settings = _connectionSettingsFactory.GetSettings(); | |
IElasticClient client = new ElasticClient(settings); | |
return client; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment