Elasticsearch version (bin/elasticsearch --version):
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.6.4</version>
</dependency>
Plugins installed: [<search-guard-client-version>5.6.4-23</search-guard-client-version>]
JVM version (java -version): openjdk version "1.8.0_151"
OS version (uname -a if on a Unix-like system): Linux 4.4.92-31-default #1 x86_64 x86_64 x86_64 GNU/Linux
Description of the problem including expected versus actual behavior: When I am trying to use scroll for any search query with enabled profile, scroll request throws the next exception:
! java.lang.IllegalStateException: The collector can only be set once.
! at org.elasticsearch.search.profile.query.QueryProfiler.setCollector(QueryProfiler.java:52)
! at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:419)
! ... 15 common frames omitted
! Causing: org.elasticsearch.search.query.QueryPhaseExecutionException: Query Failed [Failed to execute main query]
! at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:447)
! at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:114)
! at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:327)
! at org.elasticsearch.action.search.SearchTransportService$8.messageReceived(SearchTransportService.java:360)
! at org.elasticsearch.action.search.SearchTransportService$8.messageReceived(SearchTransportService.java:357)
! at com.floragunn.searchguard.ssl.transport.SearchGuardSSLRequestHandler.messageReceivedDecorate(SearchGuardSSLRequestHandler.java:178)
! at com.floragunn.searchguard.transport.SearchGuardRequestHandler.messageReceivedDecorate(SearchGuardRequestHandler.java:101)
! at com.floragunn.searchguard.ssl.transport.SearchGuardSSLRequestHandler.messageReceived(SearchGuardSSLRequestHandler.java:92)
! at com.floragunn.searchguard.SearchGuardPlugin$3$1.messageReceived(SearchGuardPlugin.java:376)
! at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69)
! at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:644)
! at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638)
! at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
! at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
! at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
! at java.lang.Thread.run(Thread.java:748)
! Causing: org.elasticsearch.transport.RemoteTransportException: [server1][ip:9300][indices:data/read/search[phase/query/scroll]]
! Causing: org.elasticsearch.action.search.SearchPhaseExecutionException: all shards failed
! at org.elasticsearch.action.search.SearchScrollAsyncAction.onShardFailure(SearchScrollAsyncAction.java:269)
! at org.elasticsearch.action.search.SearchScrollAsyncAction$1.onFailure(SearchScrollAsyncAction.java:202)
! at org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:51)
! at com.floragunn.searchguard.transport.SearchGuardInterceptor$RestoringTransportResponseHandler.handleException(SearchGuardInterceptor.java:163)
! at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1067)
! at org.elasticsearch.transport.TransportService$DirectResponseChannel.processException(TransportService.java:1171)
! at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1149)
! at org.elasticsearch.transport.TransportService$7.onFailure(TransportService.java:655)
! at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.onFailure(ThreadContext.java:623)
! at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:39)
! at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
! at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
! ... 1 common frames omitted
Steps to reproduce:
Any index with 2 shard and 2 replicas and >50 documents with any content.
final SearchRequestBuilder reqBuilder = mElasticClient.prepareSearch(
"some-index")
.setPreference("session-1")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(QueryBuilders.matchAllQuery())
.setProfile(true)
.setScroll(new Scroll(TimeValue.timeValueMinutes(1)))
.setFrom(0);
SearchResponse response = reqBuilder.get();
final String scrollId = response.getScrollId();
mElasticClient.prepareSearchScroll(scrollId)
.setScroll(TimeValue.timeValueMinutes(1))
.get();