Skip to content

Instantly share code, notes, and snippets.

@awswithdotnet
Created March 8, 2022 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awswithdotnet/adb7411d6cf0faf428e1d8984d1c75d1 to your computer and use it in GitHub Desktop.
Save awswithdotnet/adb7411d6cf0faf428e1d8984d1c75d1 to your computer and use it in GitHub Desktop.
elasticsearch elasticsearch ElasticSearchClientFactory
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