Hello, how should I initialization PreBuiltXPackTransportClient I opened the x - pack

Hello, how should I initialization PreBuiltXPackTransportClient I opened the x - pack

Elasticsearch version :
6.5.4
Plugins installed :
x-pack
JVM version:
jdk1.8
OS version :
win10
Description of the problem including expected versus actual behavior :
I see official support only to es6.0,https://www.elastic.co/guide/en/x-pack/current/xpack-settings.html

Settings settings = Settings.builder()
                  // es 集群的名称
                  .put("cluster.name", "elasticsearch")
                  .put("client.transport.sniff", "true")
                  //账号密码
                  .put("xpack.security.user", "elastic:123456")
                  .build();
          client = new PreBuiltXPackTransportClient(settings)
                  //添加集群节点
                  .addTransportAddresses(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300);

The exception that occurs after this setting

java.lang.NoSuchMethodError: org.elasticsearch.common.settings.Settings$Builder.put([Ljava/lang/Object;)Lorg/elasticsearch/common/settings/Settings$Builder

Has been resolved:grinning:

It'd be great for the community if you can share the code which fixed it.
Also, I'd recommend switching to the rest client as the TransportClient is removed in 8.0.

It's caused by version inconsistency

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.