Java scroll api doesn't match curl scroll

I use scroll command to pull data, such as
curl localhost:9200/customer/_search?scroll=3m -d '{"size":50,"sort":[{"_doc":{"order":"asc"}}],"query":{"match_all":{}}}'.
No matter how many times I executed the command, the scroll _id didn't change.
But, when I used the command by java api, the scroll _id changed. Because I used multi thread to get data by same scrollId, an error occred.

Caused by: SearchContextMissingException[No search context found for id [180930541]]
	at org.elasticsearch.search.SearchService.findContext(SearchService.java:510)
	at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:286)
	at org.elasticsearch.action.search.SearchTransportService$8.messageReceived(SearchTransportService.java:314)
	at org.elasticsearch.action.search.SearchTransportService$8.messageReceived(SearchTransportService.java:311)
	at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69)
	at org.elasticsearch.transport.TcpTransport$RequestHandler.doRun(TcpTransport.java:1488)
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:596)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

java:

QueryBuilder qb = matchAllQuery();
 SearchResponse scrollResp = source_client.prepareSearch(index)
                .setScroll(new TimeValue(60000))
                .addSort(FieldSortBuilder.DOC_FIELD_NAME, SortOrder.ASC)
                .setQuery(qb)
                .setSize(5000).get();

**:

Elasticsearch version (5.2.0):

JVM version (1.8):

OS version (Red Hat 4.4.6-3):

someone has any idea?
thks!

I am sorry, it's an expressed error.
I mean that after i get a scroll_id by command
(curl localhost:9200/customer/_search?scroll=3m -d '{"size":50,"sort":[{"_doc":{"order":"asc"}}],"query":{"match_all":{}}}'),
next i get the rest result by command(curl 100.110.6.105:9200/_search/scroll -d '{"scroll":"1m","scroll_id":"xxxx"}').
I can get result by same scroll_id. But this isn't suitable for java API.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.