# SearchContextMissingException: No search context found for id

**URL:** <https://discuss.elastic.co/t/searchcontextmissingexception-no-search-context-found-for-id/10068>\
**Category:** Elasticsearch\
**Created:** [December 13, 2012, 3:42pm UTC](https://discuss.elastic.co/t/searchcontextmissingexception-no-search-context-found-for-id/10068 "2012-12-13T15:42:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Reynolds](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@James\_Reynolds](https://discuss.elastic.co/u/James_Reynolds)\
**Post date:** [December 13, 2012, 3:42pm UTC](https://discuss.elastic.co/t/searchcontextmissingexception-no-search-context-found-for-id/10068/1 "2012-12-13T15:42:04Z")

</div>

Hello all:

We've been having periodic trouble with the below exception, and with  
little luck trying to track it down.

Generally speaking, this seems to happen on parent / child queries.  
Initially, we'll get this exception (and many more like it) and then search  
will return the results for a time (maybe like a half hour or so) and then  
we'll get the errors again.

The incantation for elasticsearch looks like this:

/usr/java/default/bin/java -Xms12g -Xmx12g -Xss256k

> -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC  
> -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly  
> -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch  
> -Des.path.home=/opt/elasticsearch -cp  
> :/opt/elasticsearch/lib/elasticsearch-0.20.0.RC1.jar:/opt/elasticsearch/lib/_:/opt/elasticsearch/lib/sigar/_  
> org.elasticsearch.bootstrap.Elasticsearch

the yml looks like this:

# Unicast Discovery (disable multicast)

> #discovery.zen.ping.multicast.enabled: false  
> #discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
> 
> # Name your cluster here to whatever.
> 
> cluster.name: XXXXX-search-qa  
> node.name: "Router QA"  
> node.master: true  
> node.data: false
> 
> discovery.zen.minimum\_master\_nodes: 1  
> discovery.zen.ping.unicast.hosts: ["x.compute-1.internal",  
> "y.ec2.internal", "z.ec2.internal", "a.compute-1.internal",  
> "b.compute-1.internal",  
> "c.ec2.internal" ]
> 
> #internal ip of this router  
> #m.ec2.internal  
> network.bind\_host: kk.kkk.ll.llll  
> http.port: 9500  
> #field cache configuration  
> index.cache.field.max\_size: 20000  
> index.cache.field.expire: 10m

This is the traceback:

> [2012-12-13 15:16:05,196][DEBUG][action.search.type] [Router QA]  
> [1107156] Failed to execute fetch phase  
> org.elasticsearch.transport.RemoteTransportException: [Master01  
> QA][inet[/XXXXXXXX:9300]][search/phase/fetch/id]  
> Caused by: org.elasticsearch.search.SearchContextMissingException: No  
> search context found for id [1107156]  
> at  
> org.elasticsearch.search.SearchService.findContext(SearchService.java:459)  
> at  
> org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:432)  
> at  
> org.elasticsearch.search.action.SearchServiceTransportAction$SearchFetchByIdTransportHandler.messageReceived(SearchServiceTransportAction.java:634)  
> at  
> org.elasticsearch.search.action.SearchServiceTransportAction$SearchFetchByIdTransportHandler.messageReceived(SearchServiceTransportAction.java:623)  
> at  
> org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:268)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:662)

--

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [December 13, 2012, 4:11pm UTC](https://discuss.elastic.co/t/searchcontextmissingexception-no-search-context-found-for-id/10068/2 "2012-12-13T16:11:18Z")

</div>

Do these parent/child queries take a long time to complete?  
Also do see a lot of `Failed to send release search context` warnings  
in your log files?

Martijn

On 13 December 2012 16:42, James Reynolds [eire1130@gmail.com](mailto:eire1130@gmail.com) wrote:

> Hello all:
> 
> We've been having periodic trouble with the below exception, and with little  
> luck trying to track it down.
> 
> Generally speaking, this seems to happen on parent / child queries.  
> Initially, we'll get this exception (and many more like it) and then search  
> will return the results for a time (maybe like a half hour or so) and then  
> we'll get the errors again.
> 
> The incantation for elasticsearch looks like this:
> 
> > /usr/java/default/bin/java -Xms12g -Xmx12g -Xss256k  
> > -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC  
> > -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly  
> > -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch  
> > -Des.path.home=/opt/elasticsearch -cp  
> > :/opt/elasticsearch/lib/elasticsearch-0.20.0.RC1.jar:/opt/elasticsearch/lib/_:/opt/elasticsearch/lib/sigar/_  
> > org.elasticsearch.bootstrap.Elasticsearch
> 
> the yml looks like this:
> 
> > # Unicast Discovery (disable multicast)
> > 
> > #discovery.zen.ping.multicast.enabled: false  
> > #discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
> > 
> > # Name your cluster here to whatever.
> > 
> > cluster.name: XXXXX-search-qa  
> > node.name: "Router QA"  
> > node.master: true  
> > node.data: false
> > 
> > discovery.zen.minimum\_master\_nodes: 1  
> > discovery.zen.ping.unicast.hosts: ["x.compute-1.internal",  
> > "y.ec2.internal", "z.ec2.internal", "a.compute-1.internal",  
> > "b.compute-1.internal",  
> > "c.ec2.internal" ]
> > 
> > #internal ip of this router  
> > #m.ec2.internal  
> > network.bind\_host: kk.kkk.ll.llll  
> > http.port: 9500  
> > #field cache configuration  
> > index.cache.field.max\_size: 20000  
> > index.cache.field.expire: 10m
> 
> This is the traceback:
> 
> > [2012-12-13 15:16:05,196][DEBUG][action.search.type] [Router QA]  
> > [1107156] Failed to execute fetch phase  
> > org.elasticsearch.transport.RemoteTransportException: [Master01  
> > QA][inet[/XXXXXXXX:9300]][search/phase/fetch/id]  
> > Caused by: org.elasticsearch.search.SearchContextMissingException: No  
> > search context found for id [1107156]  
> > at  
> > org.elasticsearch.search.SearchService.findContext(SearchService.java:459)  
> > at  
> > org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:432)  
> > at  
> > org.elasticsearch.search.action.SearchServiceTransportAction$SearchFetchByIdTransportHandler.messageReceived(SearchServiceTransportAction.java:634)  
> > at  
> > org.elasticsearch.search.action.SearchServiceTransportAction$SearchFetchByIdTransportHandler.messageReceived(SearchServiceTransportAction.java:623)  
> > at  
> > org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:268)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> > at java.lang.Thread.run(Thread.java:662)
> 
> --

--  
Met vriendelijke groet,

Martijn van Groningen

--

---

<div class="post-metadata">

**Author:** ![James\_Reynolds](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@James\_Reynolds](https://discuss.elastic.co/u/James_Reynolds)\
**Post date:** [December 13, 2012, 4:29pm UTC](https://discuss.elastic.co/t/searchcontextmissingexception-no-search-context-found-for-id/10068/3 "2012-12-13T16:29:01Z")

</div>

Thank you for the response.

I do not see any "Failed to send release search context" in the logs on any  
of the boxes.

Really, the only error I see is the ones I copied below.

The parent/child queries return reasonably fast once they are "warmed", but  
if it's been a few minutes since the last query, it can take a few seconds  
to return.

On Thursday, December 13, 2012 11:11:18 AM UTC-5, Martijn v Groningen wrote:

> Do these parent/child queries take a long time to complete?  
> Also do see a lot of `Failed to send release search context` warnings  
> in your log files?
> 
> Martijn
> 
> On 13 December 2012 16:42, James Reynolds \<[eire...@gmail.com](mailto:eire...@gmail.com) \<javascript:\>\>  
> wrote:
> 
> > Hello all:
> > 
> > We've been having periodic trouble with the below exception, and with  
> > little  
> > luck trying to track it down.
> > 
> > Generally speaking, this seems to happen on parent / child queries.  
> > Initially, we'll get this exception (and many more like it) and then  
> > search  
> > will return the results for a time (maybe like a half hour or so) and  
> > then  
> > we'll get the errors again.
> > 
> > The incantation for elasticsearch looks like this:
> > 
> > > /usr/java/default/bin/java -Xms12g -Xmx12g -Xss256k  
> > > -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC  
> > > -XX:CMSInitiatingOccupancyFraction=75  
> > > -XX:+UseCMSInitiatingOccupancyOnly  
> > > -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch  
> > > -Des.path.home=/opt/elasticsearch -cp
> 
> :/opt/elasticsearch/lib/elasticsearch-0.20.0.RC1.jar:/opt/elasticsearch/lib/_:/opt/elasticsearch/lib/sigar/_
> 
> > > org.elasticsearch.bootstrap.Elasticsearch
> > 
> > the yml looks like this:
> > 
> > > # Unicast Discovery (disable multicast)
> > > 
> > > #discovery.zen.ping.multicast.enabled: false  
> > > #discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
> > > 
> > > # Name your cluster here to whatever.
> > > 
> > > cluster.name: XXXXX-search-qa  
> > > node.name: "Router QA"  
> > > node.master: true  
> > > node.data: false
> > > 
> > > discovery.zen.minimum\_master\_nodes: 1  
> > > discovery.zen.ping.unicast.hosts: ["x.compute-1.internal",  
> > > "y.ec2.internal", "z.ec2.internal", "a.compute-1.internal",  
> > > "b.compute-1.internal",  
> > > "c.ec2.internal" ]
> > > 
> > > #internal ip of this router  
> > > #m.ec2.internal  
> > > network.bind\_host: kk.kkk.ll.llll  
> > > http.port: 9500  
> > > #field cache configuration  
> > > index.cache.field.max\_size: 20000  
> > > index.cache.field.expire: 10m
> > 
> > This is the traceback:
> > 
> > > [2012-12-13 15:16:05,196][DEBUG][action.search.type] [Router QA]  
> > > [1107156] Failed to execute fetch phase  
> > > org.elasticsearch.transport.RemoteTransportException: [Master01  
> > > QA][inet[/XXXXXXXX:9300]][search/phase/fetch/id]  
> > > Caused by: org.elasticsearch.search.SearchContextMissingException: No  
> > > search context found for id [1107156]  
> > > at
> 
> org.elasticsearch.search.SearchService.findContext(SearchService.java:459)
> 
> > > ```
> > > at 
> > > 
> > > ```
> 
> org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:432)
> 
> > > ```
> > > at 
> > > 
> > > ```
> 
> org.elasticsearch.search.action.SearchServiceTransportAction$SearchFetchByIdTransportHandler.messageReceived(SearchServiceTransportAction.java:634)
> 
> > > ```
> > > at 
> > > 
> > > ```
> 
> org.elasticsearch.search.action.SearchServiceTransportAction$SearchFetchByIdTransportHandler.messageReceived(SearchServiceTransportAction.java:623)
> 
> > > ```
> > > at 
> > > 
> > > ```
> 
> org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:268)
> 
> > > ```
> > > at 
> > > 
> > > ```
> 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 
> > > ```
> > > at 
> > > 
> > > ```
> 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 
> > > ```
> > > at java.lang.Thread.run(Thread.java:662) 
> > > 
> > > ```
> > 
> > --
> 
> --  
> Met vriendelijke groet,
> 
> Martijn van Groningen

--

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [December 13, 2012, 5:48pm UTC](https://discuss.elastic.co/t/searchcontextmissingexception-no-search-context-found-for-id/10068/4 "2012-12-13T17:48:51Z")

</div>

Your nodes in your cluster aren't under heavy load or scarce resource  
(e.g. low available memory)?

I see that you're running with 0.20.0.RC1. Recently 0.20.1 has been  
released. Although I don't have prove that a bug related to this has  
been fixed, it might be a good idea to upgrade anyway.

Martijn

On 13 December 2012 17:29, James Reynolds [eire1130@gmail.com](mailto:eire1130@gmail.com) wrote:

> Thank you for the response.
> 
> I do not see any "Failed to send release search context" in the logs on any  
> of the boxes.
> 
> Really, the only error I see is the ones I copied below.
> 
> The parent/child queries return reasonably fast once they are "warmed", but  
> if it's been a few minutes since the last query, it can take a few seconds  
> to return.
> 
> On Thursday, December 13, 2012 11:11:18 AM UTC-5, Martijn v Groningen wrote:
> 
> > Do these parent/child queries take a long time to complete?  
> > Also do see a lot of `Failed to send release search context` warnings  
> > in your log files?
> > 
> > Martijn
> > 
> > On 13 December 2012 16:42, James Reynolds [eire...@gmail.com](mailto:eire...@gmail.com) wrote:
> > 
> > > Hello all:
> > > 
> > > We've been having periodic trouble with the below exception, and with  
> > > little  
> > > luck trying to track it down.
> > > 
> > > Generally speaking, this seems to happen on parent / child queries.  
> > > Initially, we'll get this exception (and many more like it) and then  
> > > search  
> > > will return the results for a time (maybe like a half hour or so) and  
> > > then  
> > > we'll get the errors again.
> > > 
> > > The incantation for elasticsearch looks like this:
> > > 
> > > > /usr/java/default/bin/java -Xms12g -Xmx12g -Xss256k  
> > > > -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC  
> > > > -XX:CMSInitiatingOccupancyFraction=75  
> > > > -XX:+UseCMSInitiatingOccupancyOnly  
> > > > -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch  
> > > > -Des.path.home=/opt/elasticsearch -cp
> > > > 
> > > > :/opt/elasticsearch/lib/elasticsearch-0.20.0.RC1.jar:/opt/elasticsearch/lib/_:/opt/elasticsearch/lib/sigar/_  
> > > > org.elasticsearch.bootstrap.Elasticsearch
> > > 
> > > the yml looks like this:
> > > 
> > > > # Unicast Discovery (disable multicast)
> > > > 
> > > > #discovery.zen.ping.multicast.enabled: false  
> > > > #discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
> > > > 
> > > > # Name your cluster here to whatever.
> > > > 
> > > > cluster.name: XXXXX-search-qa  
> > > > node.name: "Router QA"  
> > > > node.master: true  
> > > > node.data: false
> > > > 
> > > > discovery.zen.minimum\_master\_nodes: 1  
> > > > discovery.zen.ping.unicast.hosts: ["x.compute-1.internal",  
> > > > "y.ec2.internal", "z.ec2.internal", "a.compute-1.internal",  
> > > > "b.compute-1.internal",  
> > > > "c.ec2.internal" ]
> > > > 
> > > > #internal ip of this router  
> > > > #m.ec2.internal  
> > > > network.bind\_host: kk.kkk.ll.llll  
> > > > http.port: 9500  
> > > > #field cache configuration  
> > > > index.cache.field.max\_size: 20000  
> > > > index.cache.field.expire: 10m
> > > 
> > > This is the traceback:
> > > 
> > > > [2012-12-13 15:16:05,196][DEBUG][action.search.type] [Router QA]  
> > > > [1107156] Failed to execute fetch phase  
> > > > org.elasticsearch.transport.RemoteTransportException: [Master01  
> > > > QA][inet[/XXXXXXXX:9300]][search/phase/fetch/id]  
> > > > Caused by: org.elasticsearch.search.SearchContextMissingException: No  
> > > > search context found for id [1107156]  
> > > > at
> > > > 
> > > > org.elasticsearch.search.SearchService.findContext(SearchService.java:459)  
> > > > at
> > > > 
> > > > org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:432)  
> > > > at
> > > > 
> > > > org.elasticsearch.search.action.SearchServiceTransportAction$SearchFetchByIdTransportHandler.messageReceived(SearchServiceTransportAction.java:634)  
> > > > at
> > > > 
> > > > org.elasticsearch.search.action.SearchServiceTransportAction$SearchFetchByIdTransportHandler.messageReceived(SearchServiceTransportAction.java:623)  
> > > > at
> > > > 
> > > > org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:268)  
> > > > at
> > > > 
> > > > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
> > > > at
> > > > 
> > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> > > > at java.lang.Thread.run(Thread.java:662)
> > > 
> > > --
> > 
> > --  
> > Met vriendelijke groet,
> > 
> > Martijn van Groningen

--  
Met vriendelijke groet,

Martijn van Groningen

--

---

<div class="post-metadata">

**Author:** ![mkocic](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@mkocic](https://discuss.elastic.co/u/mkocic)\
**Post date:** [February 1, 2013, 3:27pm UTC](https://discuss.elastic.co/t/searchcontextmissingexception-no-search-context-found-for-id/10068/5 "2013-02-01T15:27:04Z")

</div>

Hi,

I got same problem. I have three EC2 instance nodes (8GB) with 5 shareds and 1 replica (es 0.20.2). And my queries need too long to respond. I need to wait from 10 to 240 sec. Also I have 4 000 000 records and also i have constantly adding new documents.

Thank you,  
Milan

---

<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:53am UTC](https://discuss.elastic.co/t/searchcontextmissingexception-no-search-context-found-for-id/10068/6 "2017-07-06T02:53:31Z")

</div>


