Scroll search got a no node available exception

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

For one thing, the code snippet above initializes the scan via matchAll and
then promptly ignores its search hits (if any). Instead, it dives into the
loop and right away queries using the scroll ID to get and do something
with the next set of hits.

On Wednesday, September 25, 2013 10:53:13 AM UTC-4, spancer ray wrote:

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

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Scroll-search-got-a-no-node-available-exception-tp4041799.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Brian,

Thanks for your reply. I added another one node to my one node cluster, and the error gone. I think it's the weak cluster that made this happen.

Spancer