以下代码使用Nest库,请用Elastic.Clients.Elasticsearch(版本8.11.0)替换Nest的c#代码要怎么写呢?…
Jump to turn (8)
- 1以下代码使用Nest库,请用Elastic.Clients.Elasticsearch(版本8.11.0)替换Nest的c#代码要怎么写呢? Elastic.C
- 2Elastic.Clients.Elasticsearch(版本8.11.0)的库中没有ElasticClient类
- 3请用Elastic.Clients.Elasticsearch替换Nest库,不再使用using Nest
- 4Elastic.Clients.Elasticsearch库中没有Elastic.Clients.Configuration
- 5Elastic.Clients.Elasticsearch库中没有IElasticClient
- 6Elastic.Clients.Elasticsearch库中没有ElasticsearchSettings,只有ElasticsearchClientSett
- 7ConnectionConfiguration类中没有DefaultMappingFor方法
- 8请使用ElasticsearchClientSettings替换ConnectionConfiguration
- User
以下代码使用Nest库,请用Elastic.Clients.Elasticsearch(版本8.11.0)替换Nest的c#代码要怎么写呢? Elastic.Clients.Elasticsearch(版本8.11.0)的库中没有ConnectionSettings类。 public IElasticClient CreateConnection(string index = null) { var sparePartsIndex = _configuration.SparePartsIndex; if (index != null) { sparePartsIndex = index; } var settings = new ConnectionSettings(new Uri(_configuration.ElasticSearchUrl)); settings.MapDefaultTypeIndices(s => s. Add(typeof(SparePartEntity), sparePartsIndex) .Add(typeof(OperationLogEntity), sparePartsIndex) .Add(typeof(CatalogueData), sparePartsIndex) .Add(typeof(StatisticsService), sparePartsIndex) .Add(typeof(ImageEntity), sparePartsIndex) .Add(typeof(MetadataEntity), sparePartsIndex) .Add(typeof(SparePartImageSet), sparePartsIndex)); settings.MapDefaultTypeNames(fd => fd.Add(typeof(SparePartEntity), “sparepartentities”) .Add(typeof(MetadataEntity), “metadataentities”) ); settings.SetMaximumAsyncConnections(20); settings.SetTimeout(int.MaxValue); #if DEBUG //settings.SetProxy(new Uri(“http://webgateway.eu.schindler.com:3128/”), “GLOBAL\bachmam2”, “Sk@teboard”); //settings.SetProxy(new Uri(“http://localhost:8888”), null, null); settings.EnableTrace(); settings.UsePrettyResponses(); #endif