# Documentation: "Search concurrency and parallelism"

**URL:** <https://discuss.elastic.co/t/documentation-search-concurrency-and-parallelism/161430>\
**Category:** Elasticsearch\
**Created:** [December 19, 2018, 1:37am UTC](https://discuss.elastic.co/t/documentation-search-concurrency-and-parallelism/161430 "2018-12-19T01:37:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexisWilke](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexiswilke/32/38600_2.png) [@AlexisWilke](https://discuss.elastic.co/u/AlexisWilke)\
**Post date:** [December 19, 2018, 1:37am UTC](https://discuss.elastic.co/t/documentation-search-concurrency-and-parallelism/161430/1 "2018-12-19T01:37:06Z")

</div>

I read the documentation about the concurrency and parallelism in a few places, such as this one:

> **[Search APIs | Elasticsearch Guide \[6.5\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/6.5/search.html)**

Where the `max_concurrent_shard_requests` is define like so:

> The request parameter `max_concurrent_shard_requests` can be used to control the maximum number of concurrent shard requests the search API will execute for the request. This parameter should be used to protect a single request from overloading a cluster (e.g., a default request will hit all indices in a cluster which could cause shard request rejections if the number of shards per node is high). This default is based on the number of data nodes in the cluster but at most `256` .

Look at the code, it feels like the documentation is lying big time.

The current code (from github master) says:

```
private int maxConcurrentShardRequests = 0;
[...]
public int getMaxConcurrentShardRequests() {
    return maxConcurrentShardRequests == 0 ? 5 : maxConcurrentShardRequests;
}

public void setMaxConcurrentShardRequests(int maxConcurrentShardRequests) {
    if (maxConcurrentShardRequests < 1) {
        throw new IllegalArgumentException("maxConcurrentShardRequests must be >= 1");
    }
    this.maxConcurrentShardRequests = maxConcurrentShardRequests;
}

```

In other words, the default is 5. No number of shards or nodes or whatever involved. Also, the set function does not have an upper limit. You can set it to 1,000 and the value will be accepted.

Did I read that right? Should we have a documentation fix?

Note that on the other hand, this description from `elasticsearch/rest-api-spec/src/main/resources/rest-api-spec/api/search.json` go the default right, it looks like:

```
    "max_concurrent_shard_requests" : {
      "type" : "number",
      "description" : "The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests",
      "default" : "The default is 5."
    },

```

Note that I also checked the master version of the documentation:

> **[Search APIs | Elasticsearch Guide \[master\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/master/search.html)**

and it was also not updated. As mentioned there are a few other pages that mention this parameter with the wrong information.

Thank you.  
Alexis

---

<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:** [January 16, 2019, 1:37am UTC](https://discuss.elastic.co/t/documentation-search-concurrency-and-parallelism/161430/2 "2019-01-16T01:37:45Z")

</div>

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