启用xpack后,无法使用PreBuiltTransportClient连接到Elasticsearch 6.2.4

时间:2018-06-22 13:07:18

标签: elasticsearch-6

我正在使用Elasticsearch版本6.2.4。 启用xpack安全性后,我无法将传输客户端连接到elasticsearch

TransportClient transportClient1 = new PreBuiltXPackTransportClient(
            Settings.builder().put("cluster.name", "Elastic-application")
                    .put("xpack.security.user", "elastic:pass@123")
                    .build());

ipPortMapping = ExportMiscellaneousUtils.getURLDetails(connectionURL, ExportMiscellaneousUtils.DEFAULT_TCP_PORT_ELASTICSEARCH);
for (Map.Entry<InetAddress, Integer> ipPortDetails : ipPortMapping.entrySet()) {
            transportClient1.addTransportAddresses(new TransportAddress(ipPortDetails.getKey(), ipPortDetails.getValue()));
    }

以下是我添加到我的Maven中的依赖项

  

<elasticsearch.version>6.2.4</elasticsearch.version>

    <repositories>
        <!-- add the elasticsearch repo -->
        <repository>
            <id>elasticsearch-releases</id>
            <url>https://artifacts.elastic.co/maven</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>x-pack-transport</artifactId>
            <version>6.0.0-beta2</version>
        </dependency>
    <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>

有什么想法吗?

0 个答案:

没有答案