Elasticsearch:太多碎片

时间:2017-02-11 06:07:03

标签: python elasticsearch lucene sharding

我尝试通过执行以下操作来访问索引中最常用的10个术语:

POST _search/
{  
  "size":0,
  "aggs":{  
     "top-terms-aggregation":{  
        "terms":{  
           "field":"author_wording",
           "size":10
        }
     }
  }
} 

但是我收到以下错误:

{
    "type": "illegal_argument_exception",
    "reason": "Trying to query 1157 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."
  }

问题是我没有配置那么多碎片。在我的索引中,我的设置中只定义了一个分片:

"index" : {
    "number_of_shards" : 1,
    "number_of_replicas" : 0
 }

这个错误来自哪里?如何减少碎片数?

1 个答案:

答案 0 :(得分:1)

如果您对碎片的内容感兴趣,可以使用cat api:

GET /_cat/shards