[ExposeServices(isSingleton: true)]public class ElasticSearchServer : IElasticSearchServer{ public IElasticClient ElasticLinqClient { get; set; } public IElasticLowLevelClient ElasticJsonClient { get; set; } public ElasticSearchServer(ESConfig esConfig) { var urls = esConfig.Urls.ConvertAll(x => new Uri(x)); var connectonPool = new StaticConnectionPool(urls); var settings=new ConnectionSettings(connectonPool).RequestTimeout(TimeSpan.FromSeconds(esConfig.Timeout)); this.ElasticJsonClient=new ElasticLowLevelClient(settings); this.ElasticLinqClient= new ElasticClient(settings);//linq请求客户端初始化 } #region 创建Index。指定分片 ///
netcore使用elasticsearch
时间:2023-05-14
elasticsearch7.x
相关推荐