# Scroll randomly failing on some shards

**URL:** https://discuss.elastic.co/t/scroll-randomly-failing-on-some-shards/118927
**Category:** Elasticsearch
**Created:** [February 7, 2018, 9:05pm UTC](https://discuss.elastic.co/t/scroll-randomly-failing-on-some-shards/118927 "2018-02-07T21:05:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![alissonsales](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alissonsales/32/15867_2.png) [@alissonsales](https://discuss.elastic.co/u/alissonsales)
#### Post date: [February 7, 2018, 9:05pm UTC](https://discuss.elastic.co/t/scroll-randomly-failing-on-some-shards/118927/1 "2018-02-07T21:05:30Z")

</div>

Hi,

I'm experiencing a weird behaviour while scrolling elasticsearch (v5.5.2).

I have an application that performs multiple search/scrolls hourly for analytics purposes and sometimes the query/scroll fails on some shards.

Here's an example of the output I consider invalid:

```auto
{
  "_scroll_id": "<a scroll id>",
  "took": 153057,
  "timed_out": false,
  "_shards": {
    "total": 3,
    "successful": 2,
    "failed": 1,
    "failures": [
      {
        "shard": 17,
        "index": "<my index>",
        "node": "<node id>",
        "reason": {
          "type": "search_context_missing_exception",
          "reason": "No search context found for id [3122061]"
        }
      }
    ]
  }
}

```

This happens with different queries and other shards fail randomly as well. This same query/scroll was performed successfully some time before and also later.

Anyone has any idea about why elasticsearch would fail like this?

I know that one of the possible reasons of this error `No search context found for id [...]` is probably because the scroll expired on that shard, but I guess that doesn't make a lot of sense, since the other shards returned the results successfully?

Unfortunately I couldn't find a way to reproduce this issue.

The way I'm protecting the app to process "bad data" is by checking if the returned `_shards.failed` is 0 and `_shards.total` is equal to `_shards.successful`.

Thanks in advance for any thoughts on this.

---

<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 7, 2018, 9:05pm UTC](https://discuss.elastic.co/t/scroll-randomly-failing-on-some-shards/118927/2 "2018-03-07T21:05:45Z")

</div>

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