# Failed to execute fetch phase SearchContextMissingException

**URL:** <https://discuss.elastic.co/t/failed-to-execute-fetch-phase-searchcontextmissingexception/135590>\
**Category:** Elasticsearch\
**Created:** [June 12, 2018, 7:29pm UTC](https://discuss.elastic.co/t/failed-to-execute-fetch-phase-searchcontextmissingexception/135590 "2018-06-12T19:29:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![meetdave2611997](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@meetdave2611997](https://discuss.elastic.co/u/meetdave2611997)\
**Post date:** [June 12, 2018, 7:29pm UTC](https://discuss.elastic.co/t/failed-to-execute-fetch-phase-searchcontextmissingexception/135590/1 "2018-06-12T19:29:28Z")

</div>

Hello,

We are constantly seeing below errors in elasticsearch log file. We want to know what could be the root cause of this problem and how to prevent these type of errors?

```
[2018-06-12T19:03:21,239][DEBUG][o.e.a.s.TransportSearchAction] [master-ip-x-x-x-x] [21240589] Failed to execute fetch phase
org.elasticsearch.transport.RemoteTransportException: [data-ip-x-x-x-x][x-x-x-x:9300][indices:data/read/search[phase/fetch/id]]
Caused by: org.elasticsearch.search.SearchContextMissingException: No search context found for id [21240589]
        at org.elasticsearch.search.SearchService.findContext(SearchService.java:442) ~[elasticsearch-5.4.1.jar:5.4.1]
        at org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:409) ~[elasticsearch-5.4.1.jar:5.4.1]
        at org.elasticsearch.action.search.SearchTransportService$12.messageReceived(SearchTransportService.java:402) ~[elasticsearch-5.4.1.jar:5.4.1]
        at org.elasticsearch.action.search.SearchTransportService$12.messageReceived(SearchTransportService.java:399) ~[elasticsearch-5.4.1.jar:5.4.1]
        at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler$1.doRun(SecurityServerTransportInterceptor.java:258) ~[?:?]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-5.4.1.jar:5.4.1]
        at org.elasticsearch.common.util.concurrent.EsExecutors$1.execute(EsExecutors.java:110) ~[elasticsearch-5.4.1.jar:5.4.1]
        at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler.lambda$messageReceived$0(SecurityServerTransportInterceptor.java:307) ~[?:?]
        at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:59) ~[elasticsearch-5.4.1.jar:5.4.1]
        at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile.lambda$authorizeAsync$5(ServerTransportFilter.java:191) ~[?:?]
        at org.elasticsearch.xpack.security.authz.AuthorizationUtils$AsyncAuthorizer.maybeRun(AuthorizationUtils.java:127) ~[?:?]
        at org.elasticsearch.xpack.security.authz.AuthorizationUtils$AsyncAuthorizer.setRunAsRoles(AuthorizationUtils.java:121) ~[?:?]
        at org.elasticsearch.xpack.security.authz.AuthorizationUtils$AsyncAuthorizer.authorize(AuthorizationUtils.java:109) ~[?:?]
        at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile.authorizeAsync(ServerTransportFilter.java:193) ~[?:?]
        at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile.lambda$inbound$2(ServerTransportFilter.java:162) ~[?:?]
        at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:59) ~[elasticsearch-5.4.1.jar:5.4.1]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$authenticateAsync$0(AuthenticationService.java:192) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$lookForExistingAuthentication$2(AuthenticationService.java:212) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lookForExistingAuthentication(AuthenticationService.java:224) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.authenticateAsync(AuthenticationService.java:190) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.access$000(AuthenticationService.java:147) ~[?:?]
        at org.elasticsearch.xpack.security.authc.AuthenticationService.authenticate(AuthenticationService.java:118) ~[?:?]
        at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile.inbound(ServerTransportFilter.java:145) ~[?:?]
        at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler.messageReceived(SecurityServerTransportInterceptor.java:314) ~[?:?]
        at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.4.1.jar:5.4.1]
        at org.elasticsearch.transport.TcpTransport$RequestHandler.doRun(TcpTransport.java:1528) ~[elasticsearch-5.4.1.jar:5.4.1]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638) ~[elasticsearch-5.4.1.jar:5.4.1]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-5.4.1.jar:5.4.1]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_151]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_151]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_151]

```

Thanks!

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [June 12, 2018, 8:09pm UTC](https://discuss.elastic.co/t/failed-to-execute-fetch-phase-searchcontextmissingexception/135590/2 "2018-06-12T20:09:41Z")

</div>

Are you using [scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/search-request-scroll.html)?

---

<div class="post-metadata">

**Author:** ![meetdave2611997](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@meetdave2611997](https://discuss.elastic.co/u/meetdave2611997)\
**Post date:** [June 13, 2018, 10:33am UTC](https://discuss.elastic.co/t/failed-to-execute-fetch-phase-searchcontextmissingexception/135590/3 "2018-06-13T10:33:29Z")

</div>

@Igor_Motov No we are not using scroll API

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [June 13, 2018, 2:22pm UTC](https://discuss.elastic.co/t/failed-to-execute-fetch-phase-searchcontextmissingexception/135590/4 "2018-06-13T14:22:51Z")

</div>

Long running query or non-trivial network equipment (like load balancer, "smart"switches, etc ) between nodes? 3rd party plugins?

---

<div class="post-metadata">

**Author:** ![meetdave2611997](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@meetdave2611997](https://discuss.elastic.co/u/meetdave2611997)\
**Post date:** [June 13, 2018, 2:49pm UTC](https://discuss.elastic.co/t/failed-to-execute-fetch-phase-searchcontextmissingexception/135590/5 "2018-06-13T14:49:58Z")

</div>

No third party plugins and also nodes are connected directly with each other. Not sure about long running searches but we see too many search rejection in thread\_pool

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [June 13, 2018, 3:19pm UTC](https://discuss.elastic.co/t/failed-to-execute-fetch-phase-searchcontextmissingexception/135590/6 "2018-06-13T15:19:10Z")

</div>

Yes, this is possible when the cluster is overloaded with search traffic. Perhaps, it's time to increase the cluster capacity?

---

<div class="post-metadata">

**Author:** ![meetdave2611997](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@meetdave2611997](https://discuss.elastic.co/u/meetdave2611997)\
**Post date:** [June 13, 2018, 10:19pm UTC](https://discuss.elastic.co/t/failed-to-execute-fetch-phase-searchcontextmissingexception/135590/7 "2018-06-13T22:19:54Z")

</div>

@Igor_Motov We are currently using hot warm architecture. We have 6 hot data nodes and 8 warm nodes. How can we overcome this problem without increasing cluster capacity? Can you provide us some guide how can we improve searching?

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [June 15, 2018, 2:29pm UTC](https://discuss.elastic.co/t/failed-to-execute-fetch-phase-searchcontextmissingexception/135590/8 "2018-06-15T14:29:19Z")

</div>

Sorry, I cannot really make any performance tuning suggestions based on a single stacktrace and the number of nodes. That's just not enough information. We would need to look at your cluster stats, analyze your queries, etc...

---

<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 13, 2018, 2:29pm UTC](https://discuss.elastic.co/t/failed-to-execute-fetch-phase-searchcontextmissingexception/135590/9 "2018-07-13T14:29:21Z")

</div>

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