Elasticsearch报错action.search.shard_count.limit


查ES报错

action.search.shard_count.limit

这个参数主要用于限制一次操作过多的分片,防止过多的占用内存和CPU资源。默认情况下ES不限制搜索请求牵涉到的分片数量,你可以设置软限制 action.search.shard_count.limit 来拒绝命中太多分片的请求。

如果看到错误日志如下,修改此参数可以解决问题。

"reason" : "Trying to query 1344 shards, which is over the limit of 1000. This limit exists because querying 
many shards at the same time can make the job of the coordinating node very CPU and/or memory 
intensive. It is usually a better idea to have a smaller number of larger shards. Update 
[action.search.shard_count.limit] to a greater value if you really want to query that many shards at the same time."

 

解决方法:
curl -u es:es -XPUT 'http://localhost:9200/_cluster/settings' -H 'Content-Type: application/json' -d' 
{
    "persistent" : {
        "action.search.shard_count.limit" : "2000"
 }

你可能感兴趣的:(开发,Elasticsearch,shard_count)