Upgrade java source code using elasticsearch 1.7 to elasticsearch 2.1


(Karim Kolli) #1

Hello,

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")
            .setSearchType(SearchType.QUERY_AND_FETCH)
            .setQuery(queryBuilder)
            .setFrom(0).setSize(00).setExplain(true)
            .execute()
            .actionGet();

I have this error when executing the request above :

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

Can you help me ?

regards


(David Pilato) #2

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.


(Karim Kolli) #3

Hi David,

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

Regards

Karim


(system) #4