Reputation: 249
I am pretty new to Elastic Search. I have following things in my code OR looking for solution to 'No Node Available Exception' problem in the following scenario.
In a Scenario if consumer asks for all 4 types of data for a Customer, and if we ask first for preference, address, interests and basic details in sequence. It works well. But this adds to performance. So we want these things to process and get data parallel.
So we used Spring Task Executors to do this parallel. In that case we get data from one index and others will get 'No Node Available Exception'. Its pretty random to on say on which data we get this problem.
Pleas help me here.
Thanks in advance!....
Upvotes: 2
Views: 853
Reputation: 560
I had a similar issue, when trying to write data into a same ES node from multiple web applications. I fixed it by creating separate nodes for each.
I suggest you to try these settings of ES
client.transport.sniff=true
sniffOnConnectionFault=true
Also you can get the data from 4 indexes in a single query. For Customer Preference / Customer Address / Customer Interests / Customer Basic Details.
Example code:
SearchRequestBuilder srb = client
.prepareSearch("preference_index", "address_index", "interests_index", "details_index")
.setTypes("preference_doc", "address_doc", "interests_doc", "details_doc")
.setSearchType(SearchType.DEFAULT);
QueryBuilder boolBuilder = QueryBuilders.boolQuery().should(
QueryBuilders.matchQuery("id_customer", "14"));
SearchResponse response = srb.setSize(4).execute().actionGet();
SearchHit[] docs = response.getHits().getHits();
Upvotes: 1