Documentation: "Search concurrency and parallelism"

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

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:

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

Thank you.

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