# Using scrolls in Java,but the search results not stable

**URL:** <https://discuss.elastic.co/t/using-scrolls-in-java-but-the-search-results-not-stable/11843>\
**Category:** Elasticsearch\
**Created:** [May 7, 2013, 2:54am UTC](https://discuss.elastic.co/t/using-scrolls-in-java-but-the-search-results-not-stable/11843 "2013-05-07T02:54:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![no1zhangye](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@no1zhangye](https://discuss.elastic.co/u/no1zhangye)\
**Post date:** [May 7, 2013, 2:54am UTC](https://discuss.elastic.co/t/using-scrolls-in-java-but-the-search-results-not-stable/11843/1 "2013-05-07T02:54:54Z")

</div>

## I use the same query to search something by scrolls for many times,each time the search result are big different.i check the ES log find somethig like this: ========================es log=================================== [2013-05-06 11:57:08,774][DEBUG][action.search.type] [node6] [1924] Failed to execute query phase org.elasticsearch.transport.RemoteTransportException: [node3][inet[/10.0.0.3:9300]][search/phase/scan/scroll] Caused by: org.elasticsearch.search.SearchContextMissingException: No search context found for id [1924] at org.elasticsearch.search.SearchService.findContext(SearchService.java:459) at org.elasticsearch.search.SearchService.executeScan(SearchService.java:208) at org.elasticsearch.search.action.SearchServiceTransportAction$SearchScanScrollTransportHandler.messageReceived(SearchServiceTransportAction.java:697) at org.elasticsearch.search.action.SearchServiceTransportAction$SearchScanScrollTransportHandler.messageReceived(SearchServiceTransportAction.java:686) at org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:268) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722)

javacode like this:

SearchResponse response =  
client.prepareSearch(getIndexNames(query)).setTypes("post")  
.setSearchType(SearchType.SCAN)  
.setScroll(new TimeValue(1000))  
.setQuery(qb)setSize(5000).execute().actionGet();  
......  
response = client.prepareSearchScroll(response.getScrollId())  
.setScroll(new TimeValue(1000000))  
.execute()  
.actionGet();  
......

--  
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:** ![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:38am UTC](https://discuss.elastic.co/t/using-scrolls-in-java-but-the-search-results-not-stable/11843/2 "2017-07-06T02:38:01Z")

</div>


