Instantiating TransportClient in elasticsearch 2.3.1 (Java)

I tried creating a simple TransportClient in Java with elasticsearch 2.3.1 driver.

I followed instructions given on following link:

And also:

The problem I'm facing is following:

Settings settings = Settings.settingsBuilder()
.put("cluster.name", "myescluster")
.put("client.transport.sniff", true)
.build();

I get a message in my IntelliJIdea saying: cannot resolve method settingsBuilder. My Settings class is import org.elasticsearch.common.settings.Settings;.

I face similar situation in following code:

Client client = TransportClient.builder().build()
        .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host1"), 9300))
        .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host2"), 9300));  

I get following error: cannot resolve method builder()
My TransportClient class is: import org.elasticsearch.client.transport.TransportClient;

Further, I'm using spring-boot and my maven entry for elasticsearch is as following:

<groupId>org.elasticsearch.distribution.tar</groupId>
<artifactId>elasticsearch</artifactId>
<version>2.3.1</version>

I need urgent help.

Does not help on a community forum.

<groupId>org.elasticsearch.distribution.tar</groupId>
<artifactId>elasticsearch</artifactId>
<version>2.3.1</version>

This is incorrect.

See the doc: Maven Repository | Java Transport Client (deprecated) [7.17] | Elastic

BTW, I think that Spring boot is using spring data and spring data elasticsearch has not been updated to 2.x IIRC.
So you might not be able to use that.

Thanks that helps.

I'm using spring-boot to define archetype for my application. I'll be making my own class to use ES