ElasticSearch x-pack使用transportclient连接
setting设置
String absolutePath = ResourceUtils.getFile(ResourceUtils.CLASSPATH_URL_PREFIX + keystorePath).getAbsolutePath();
settings = builder.put("xpack.security.enabled", true)
.put("xpack.security.user", username + ":" + password)
.put("xpack.security.transport.ssl.enabled", true)
.put("xpack.security.transport.ssl.keystore.path", absolutePath)
.put("xpack.security.transport.ssl.truststore.path", absolutePath)
.put("xpack.security.transport.ssl.verification_mode", "certificate")
.put("cluster.name", clusterName).put("client.transport.sniff", isCluster).build();
使用PreBuiltXPackTransportClient
beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(PreBuiltXPackTransportClient.class);