1

Previously I was using elasticsearch 2.2 and now I have upgraded to elasticsearch 5.1 and below is the code for getting the transport-client object, but facing an issue.

Settings settings = Settings.builder().put("cluster.name", 
                elasticConfiguration.getProperty("cluster.name", "elasticsearch")).
                put("client.transport.sniff", true).
                build();


        TransportClient client = new PreBuiltTransportClient(settings);
        for(InetSocketTransportAddress address:nodes){
            (client).addTransportAddress(address);
        }



SearchResponse response = null;
        try {
            LOG.debug("search query "+queryBuilder);
            response = client.prepareSearch(CampaignRepository.INDEX_NAME)
                    .setTypes(getTypeName()).setQuery(queryBuilder).execute()
                    .get();
} catch (InterruptedException | ExecutionException e) {
            LOG.error("Error searching result for " + queryBuilder
                    + " Error message " + e.getMessage());
            // e.printStackTrace();
            throw new CampaignSystemException();
        }

But it gives me an error,

java.util.concurrent.ExecutionException: SendRequestTransportException[[dHFgT6l][10.10.2.231:9300][indices:data/read/search]]; nested: IOException[can not write type [class com.seamless.ers.campaignsystem.api.model.campaign.CampaignState]];

where CampaignState is an enum

please help!!

1 Answer 1

1

After doing some R&D, found out there was a bug with elasticsearch. In ES 2.2 it use to accept enum and convert it into String but in 5.1 the same is not happening and this might get fixed in upcoming version

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.