Upgrade java source code using elasticsearch 1.7 to elasticsearch 2.1


I have a java class in order to connect to elasticsearch 1.7 and to make request, we have upgraded elasticsearch to version 2.1 and I have now many errors during runtime :

private Client getESClientByTransportClient() {
		Client result=null;
		Settings settings = Settings.settingsBuilder()
		        .put("cluster.name", "tlssbcloud91").put("network.host","tlssbcloud91.xxxxx.fr").build();
		result = TransportClient.builder().settings(settings).build();
		///result = transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("tlssbcloud91.xxxx.fr"), 9300));
		return result;

SearchResponse responseYes=client.prepareSearch("milestones").setTypes("pact")

I have this error when executing the request above :

java.lang.ClassNotFoundException: com.fasterxml.jackson.core.FormatFeature

Can you help me ?


Hi Karim,

You have to import all needed libs now.
If you are using maven, that's done out of the box but if you are importing elasticsearch to your project manually, you have to add all 3rd party libs yourself.

Hi David,

Thank you so much for your advice.
It's OK now, in fact I have a conflict of version into maven artifacts.