elasticsearch/elasticsearch — pull request #8173 by nirmalc (2014-10-21 02:41:09+00:00)
Title: This adds ability to specify 'named' threadpool to searches.

Named threadpools needs to be configured in yml explicitly .

For eg:

threadpool:
fred:
type: fixed
size: 30

[ Here fred , named threadpool is configured with default size of 30]

SearchRequestBuilder and ScrollRequestBuilder takes threadpool name ,
but defaults to SEARCH. REST API accepts new http parameter 'threadpool'
which can take name of threadpool to run queries.

curl -XPUT "http://localhost:9200/movies/movie/1" -d'
> {
> "title": "The Godfather",
> "director": "Francis Ford Coppola",
> "year": 1972,
> "genres": ["Crime", "Drama"]
> }'

Call with 'custom' threadpool
++

curl 'localhost:9200/_search?q=*&threadpool=fred'
{"took":3,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":1.0,"hits":[{"_index":"movies","_type":"movie","_id":"1","_score":1.0,"_source":
{
"title": "The Godfather",
"director": "Francis Ford Coppola",
"year": 1972,
"genres": ["Crime", "Drama"]
}

Invalid threadpool name
++

curl 'localhost:9200/_search?q=*&threadpool=barney
'
{"error":"SearchPhaseExecutionException[Failed to execute phase [query],
all shards failed; shardFailures {[J8vv81u1SKK5BUizD5Yppw][movies][0]:
ElasticsearchIllegalArgumentException[No executor found for
[pollois]]}{[J8vv81u1SKK5BUizD5Yppw][movies][1]:
ElasticsearchIllegalArgumentException[No executor found for
[pollois]]}{[J8vv81u1SKK5BUizD5Yppw][movies][2]:
ElasticsearchIllegalArgumentException[No executor found for
[pollois]]}{[J8vv81u1SKK5BUizD5Yppw][movies][3]:
ElasticsearchIllegalArgumentException[No executor found for
[pollois]]}{[J8vv81u1SKK5BUizD5Yppw][movies][4]:
ElasticsearchIllegalArgumentException[No executor found for
[pollois]]}]","status":400}

default call
++

curl 'localhost:9200/_search?q=*'
{"took":3,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":1.0,"hits":[{"_index":"movies","_type":"movie","_id":"1","_score":1.0,"_source":
{
"title": "The Godfather",
"director": "Francis Ford Coppola",
"year": 1972,
"genres": ["Crime", "Drama"]

}

Thanks to way original code is done - _stats shows new threadpool stats