使用Elastic Search 6.1.1配置Spring-Boot-1.4.3



错误:

java.lang.NoClassDefFoundError:org/elasticsearch/action/count/CountRequestBuilder

我正在使用以下配置来生成我的传输客户端。

@Bean
public Client client() throws Exception {
System.setProperty("es.set.netty.runtime.available.processors", "false");
Settings esSettings = Settings.builder()
.put("cluster.name", EsClusterName)
.build();
TransportClient client = new PreBuiltTransportClient(esSettings);
if (hosts != null && !hosts.isEmpty()) {
for (ElasticHost elasticHosts2 : hosts) {
logger.info(String.format("Adding Elastic Cluster, Host - %s : %s", elasticHosts2.getHost(),
elasticHosts2.getPort()));
final InetAddress elasticHost = InetAddress.getByName(elasticHosts2.getHost());
client.addTransportAddress(new TransportAddress(elasticHost, elasticHosts2.getPort()));
}
} else {
client.addTransportAddress(new TransportAddress(InetAddress.getByName(EsHost), EsPort));
}
return client;
}

有人能建议一下它是否与弹性-6.1.1的弹簧靴1.4.3兼容吗。

如果是,那么我应该错过什么吗。。。或者是否有任何其他方式来使用低级别休息客户端或暴露弹性模板。

下表显示了Spring Data发布序列使用的Elasticsearch版本和其中包含的Spring Data Elasticsearch版本,以及引用特定Spring Data发布系列的Spring Boot版本:![]弹簧支持的各种弹性版本]1

此外,请参阅这个弹性搜索GitHub存储库,了解相关文档中的依赖项和插件。

最新更新