# Scroll search got a no node available exception

**URL:** <https://discuss.elastic.co/t/scroll-search-got-a-no-node-available-exception/13751>\
**Category:** Elasticsearch\
**Created:** [September 25, 2013, 2:53pm UTC](https://discuss.elastic.co/t/scroll-search-got-a-no-node-available-exception/13751 "2013-09-25T14:53:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![spancer\_ray](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spancer_ray/32/76303_2.png) [@spancer\_ray](https://discuss.elastic.co/u/spancer_ray)\
**Post date:** [September 25, 2013, 2:53pm UTC](https://discuss.elastic.co/t/scroll-search-got-a-no-node-available-exception/13751/1 "2013-09-25T14:53:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![brian\_yoder](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@brian\_yoder](https://discuss.elastic.co/u/brian_yoder)\
**Post date:** [September 25, 2013, 3:06pm UTC](https://discuss.elastic.co/t/scroll-search-got-a-no-node-available-exception/13751/2 "2013-09-25T15:06:05Z")

</div>

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](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](http://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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spancer\_ray](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spancer_ray/32/76303_2.png) [@spancer\_ray](https://discuss.elastic.co/u/spancer_ray)\
**Post date:** [September 30, 2013, 3:35am UTC](https://discuss.elastic.co/t/scroll-search-got-a-no-node-available-exception/13751/3 "2013-09-30T03:35:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:14am UTC](https://discuss.elastic.co/t/scroll-search-got-a-no-node-available-exception/13751/4 "2017-07-06T02:14:18Z")

</div>


