# Elasticsearch 7.17.1 - shards skipped even if they contain data

**URL:** https://discuss.elastic.co/t/elasticsearch-7-17-1-shards-skipped-even-if-they-contain-data/361649
**Category:** Elasticsearch
**Created:** [June 18, 2024, 1:48pm UTC](https://discuss.elastic.co/t/elasticsearch-7-17-1-shards-skipped-even-if-they-contain-data/361649 "2024-06-18T13:48:15Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mihail-ca](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@mihail-ca](https://discuss.elastic.co/u/mihail-ca)
#### Post date: [June 18, 2024, 1:48pm UTC](https://discuss.elastic.co/t/elasticsearch-7-17-1-shards-skipped-even-if-they-contain-data/361649/1 "2024-06-18T13:48:15Z")

</div>

Hello,

We have the following document in Elasticsearch 7.17.1:

```auto
{
  "_index": "operate-list-view-8.1.0_2024-06-13",
  "_type": "_doc",
  "_id": "2251800712733897",
  "_score": 1.0,
  "_source": {
    "id": "2251800712733897",
    "key": 2251800712733897,
    "partitionId": 1,
    "processDefinitionKey": 2251800347125543,
    "state": "COMPLETED",
    "incident": false,
    "joinRelation": {
      "name": "processInstance",
      "parent": null
    },
    "processInstanceKey": 2251800712733897
  }
}

```

We want to search for this document, and we use the following request:

```auto
POST http: //localhost:9200/operate-list-view*/_search?pretty=true 
{
  "size": 50,
  "query": {
    "constant_score": {
      "filter": {
        "bool": {
          "must": [
            {
            "term": {
              "joinRelation": {
                "value": "processInstance",
                "boost": 1.0
              }
            }
          },
            {
              "terms": {
                "id": [
                  "2251800712733897"
                ],
                "boost": 1.0
              }
            }
          ],
          "adjust_pure_negative": true,
          "boost": 1.0
        }
      },
      "boost": 1.0
    }
  }
}

```

As you can see, the document matches the request. However, the response we get is:

```auto
{
    "took": 4,
    "timed_out": false,
    "_shards": {
        "total": 91,
        "successful": 91,
        "skipped": 90,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 0,
            "relation": "eq"
        },
        "max_score": null,
        "hits": []
    }
}

```

So no documents found, and for some unknown reason, **90 shards are skipped**.

If we use the same request, but just remove the **joinRelation** filter:

```auto
{
  "term": {
    "joinRelation": {
      "value": "processInstance",
      "boost": 1.0
    }
  }
}

```

Then the document is found (because no shards are skipped in this case):

```auto
{
  "size": 50,
  "query": {
    "constant_score": {
      "filter": {
        "bool": {
          "must": [
            {
              "terms": {
                "id": [
                  "2251800712733897"
                ],
                "boost": 1.0
              }
            }
          ],
          "adjust_pure_negative": true,
          "boost": 1.0
        }
      },
      "boost": 1.0
    }
  }
}

```

Response:

```auto
{
  "took": 29,
  "timed_out": false,
  "_shards": {
    "total": 91,
    "successful": 91,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 1,
      "relation": "eq"
    },
    "max_score": 1.0,
    "hits": [
      ...
    ]
  }
}

```

So the questions are:

- Why are 90 shards skipped in the first case, even if the document clearly exist ? Where should we look for to see what could be the cause of skipped shards ? The documentation is pretty vague about this: **\_shards.skipped** : Number of shards that skipped the request because a lightweight check helped realize that no documents could possibly match on this shard.

- Is there a way to force Elasticsearch not to skip shards, via cluster settings or at least at request level ?

Thank you
