【发布时间】:2021-12-11 21:05:01
【问题描述】:
错误:
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;
}
有人可以建议它是否与带有 elastic-6.1.1 的 spring boot 1.4.3 兼容。
如果是,那么我是否应该错过任何东西...或者是否有任何其他方法可以使用低级休息客户端或公开弹性模板。
【问题讨论】:
标签: java spring spring-boot elasticsearch