'PreBuiltTransportClient' doesn't exist in my 6.3.0 library

Hi, I'm porting my project's library version from 1.7.5 to 6.3.0.

The problem is here. In previous code,

        import org.elasticsearch.client.transport.TransportClient;
        import org.elasticsearch.common.settings.ImmutableSettings;
        import org.elasticsearch.common.settings.Settings;
        
        Settings settings = ImmutableSettings.settingsBuilder()
                .put("cluster.name", clusterName)
                .build();

        TransportClient transportClient = new TransportClient(settings);

And as the version changed(https://www.elastic.co/guide/en/elasticsearch/client/java-api/6.3/transport-client.html), I modified some code like this:

        import org.elasticsearch.transport.client.PreBuiltTransportClient;
        import org.elasticsearch.client.transport.TransportClient;
        import org.elasticsearch.common.settings.*;

        Settings settings = Settings.builder()
                .put("cluster.name", clusterName)
                .build();

        TransportClient client = new PreBuiltTransportClient(settings);

but this codes first line and last line gives me errors like this:

and I cannot find 'PreBuiltTransportClient' in my 6.3.0 library.

Any comment would be appreciated. Thanks.

'PreBuiltTransportClient' is other library and if you want to use it, inject below dependency:

<dependency>
    <groupId>org.elasticsearch.client</groupId>
    <artifactId>transport</artifactId>
    <version>6.3.2</version>
</dependency>

Silly question. Sorry :slight_smile:

1 Like

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