Hi Guys,
I'm using java api to fetching whole index data from one cluster to another, and while using scan, I got the below exception:
Exception in thread "main" org.elasticsearch.client.transport.NoNodeAvailableException: No node available at org.elasticsearch.client.transport.TransportClientNodesService$RetryListener.onFailure(TransportClientNodesService.java:246) at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:214) at org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106) at org.elasticsearch.client.support.AbstractClient.searchScroll(AbstractClient.java:229) at org.elasticsearch.client.transport.TransportClient.searchScroll(TransportClient.java:410) at org.elasticsearch.action.search.SearchScrollRequestBuilder.doExecute(SearchScrollRequestBuilder.java:92) at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:62) at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:57)
My scroll code is somewhat like below:
int pagesize = 10000; //I have 5 shards in the cluster.
SearchResponse searchResponse = sourceclient.prepareSearch(indices).setSearchType(SearchType.SCAN)
.setQuery(matchAllQuery()).setSize(pagesize).setScroll(TimeValue.timeValueMinutes(2)).execute().actionGet();
while (true)
{
searchResponse = sourceclient.prepareSearchScroll(searchResponse.getScrollId())
.setScroll(TimeValue.timeValueMinutes(2)).execute().actionGet();
for (SearchHit hit : searchResponse.getHits())
{
//doing something using hit here.
}
if (searchResponse.getHits().hits().length == 0)
{
break;
}
}
I tried to reduce (set to 100 or 1000) or increase (increase to 10000 or higher) the pagesize, but got the same problem. I don't know why this happening... Don't know much about scroll search, please give me some clue..
Thanks a ton,
Spancer