# Failed to execute search phase

**URL:** https://discuss.elastic.co/t/failed-to-execute-search-phase/167607
**Category:** Elasticsearch
**Created:** [February 8, 2019, 10:43am UTC](https://discuss.elastic.co/t/failed-to-execute-search-phase/167607 "2019-02-08T10:43:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)
#### Post date: [February 8, 2019, 10:43am UTC](https://discuss.elastic.co/t/failed-to-execute-search-phase/167607/1 "2019-02-08T10:43:16Z")

</div>

We are seeing a lot of warnings in our cluster whenever we use the SCROLL API to search for data.

```auto
[2019-02-08T16:03:53,314][DEBUG][o.e.a.s.TransportSearchScrollAction] [node01] [594681] Failed to execute query phase
org.elasticsearch.transport.RemoteTransportException: [node12][10.131.54.126:9300][indices:data/read/search[phase/query/scroll]]
Caused by: org.elasticsearch.search.SearchContextMissingException: No search context found for id [594681]
	at org.elasticsearch.search.SearchService.getExecutor(SearchService.java:499) ~[elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.search.SearchService.runAsync(SearchService.java:353) ~[elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:428) ~[elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.action.search.SearchTransportService$8.messageReceived(SearchTransportService.java:376) ~[elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.action.search.SearchTransportService$8.messageReceived(SearchTransportService.java:373) ~[elasticsearch-6.5.4.jar:6.5.4]

```

The search is successful and I am able to see the data. But what do these warnings mean?

It is also accompanied by a lot of GC errors too:

```auto
[GC (Allocation Failure) 2019-02-08T15:47:48.183+0530: 17465.903: [ParNew
Desired survivor size 34865152 bytes, new threshold 6 (max 6)
- age 1: 4209728 bytes, 4209728 total
- age 2: 11008 bytes, 4220736 total
- age 3: 101144 bytes, 4321880 total
- age 4: 1328 bytes, 4323208 total
- age 5: 1024 bytes, 4324232 total

```

---

<div class="post-metadata">

### Author: ![dakrone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dakrone/32/23351_2.png) [@dakrone](https://discuss.elastic.co/u/dakrone)
#### Post date: [February 8, 2019, 9:15pm UTC](https://discuss.elastic.co/t/failed-to-execute-search-phase/167607/2 "2019-02-08T21:15:47Z")

</div>

Hi Nachiket,

When this happens, it can sometimes be the case that the TTL set (see: [keeping the scroll context alive](https://www.elastic.co/guide/en/elasticsearch/reference/6.6/search-request-scroll.html#scroll-search-context)) has expired. That would be the first thing to check. When it expires the context is closed and then this is the error you can get when you try to use the same context.

Another thing to check is that you are using the scroll\_id returned from each request, not just the first scroll\_id that you received.

---

<div class="post-metadata">

### Author: ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)
#### Post date: [February 11, 2019, 4:31am UTC](https://discuss.elastic.co/t/failed-to-execute-search-phase/167607/3 "2019-02-11T04:31:13Z")

</div>

Yes, I have set the TTL to 10 seconds. Will try with a higher setting. I am doing this using the python client, so don't want to set it to a higher value.

> [@NerdSec](#):
>
> Caused by: org.elasticsearch.search.SearchContextMissingException: No search context found for id [594681]

What is the 6 digit ID `[594681]` given by the logs? Normally scroll ID is quite huge, isn't it?

---

<div class="post-metadata">

### Author: ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)
#### Post date: [February 11, 2019, 9:58am UTC](https://discuss.elastic.co/t/failed-to-execute-search-phase/167607/4 "2019-02-11T09:58:43Z")

</div>

I kept the scroll context the same and instead of using an array of elasticsearch hosts in the `esclient` library used the co-coordinating node address.

Now I do not receive the scroll context error, however, the GC errors still exist. What could be the reason?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/0/a09b1271388e51e8f0a66b1ea422adde97e25053.png)

---

<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: [March 11, 2019, 9:58am UTC](https://discuss.elastic.co/t/failed-to-execute-search-phase/167607/5 "2019-03-11T09:58:44Z")

</div>

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