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.transport.RequestHandlerRegistry.processMessageReceived(
	at org.elasticsearch.transport.TcpTransport$RequestHandler.doRun(
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$


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


Elasticsearch version (5.2.0):

JVM version (1.8):

OS version (Red Hat 4.4.6-3):

someone has any idea?

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 -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.