elasticsearch - 在 Elasticsearch 中无法更改 “maxClauseCount”值

标签 elasticsearch elasticsearch-5

我正在使用ES 5.2.0,在执行某些查询时出现以下异常:

 Caused by: NotSerializableExceptionWrapper[too_many_clauses: maxClauseCount is set to 1024]
    at org.apache.lucene.search.BooleanQuery$Builder.add(BooleanQuery.java:125)
    at org.elasticsearch.index.query.BoolQueryBuilder.addBooleanClauses(BoolQueryBuilder.java:449)
    at org.elasticsearch.index.query.BoolQueryBuilder.doToQuery(BoolQueryBuilder.java:418)

为了解决这个问题。我正在尝试通过运行以下查询来更改“indices.query.bool.max_clause_count”的值

请求:
PUT http://localhost:9200/_all/_settings?preserve_existing=true  
{"indices.query.bool.max_clause_count" : "100000"}

响应:
{
  "error": {
    "root_cause": [
      {
        "type": "remote_transport_exception",
        "reason": "[06LrSZC][localhost:9300][indices:admin/settings/update]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "unknown setting [index.indices.query.bool.max_clause_count] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
  },
  "status": 400
}

我曾经解决过的引用资料却无法:

https://www.elastic.co/guide/en/elasticsearch/reference/5.0/breaking_50_settings_changes.html#_search_settings

https://discuss.elastic.co/t/5-0-0-alpha2-how-to-set-index-query-bool-max-clause-count/49816

https://github.com/elastic/elasticsearch/pull/18341

请让我知道执行此操作的正确请求JSON。

最佳答案

indices.query.bool.max_clause_count是静态设置,因此您应该在elasticsearch群集的每个节点的elasticsearch.yml文件中进行设置。您必须重新启动集群。

使用以下行更新您的elasticsearch.yml文件:

indices.query.bool.max_clause_count: 100000

注意:仅动态设置可以使用API​​更新

关于elasticsearch - 在 Elasticsearch 中无法更改 “maxClauseCount”值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43916076/

相关文章:

powershell - 将Elasticsearch 5.6.4作为Windows服务安装时出错

json - 使用 json 文件在 elasticsearch 中定义映射

elasticsearch - 在 Elasticsearch 查询中指定返回字段时,有没有办法不返回数组?

elasticsearch - 将.keyword附加到NEST elasticsearch查询中的字段名

elasticsearch - Elasticsearch无法启动-CreateJavaVM失败

mysql - Elastic Search 中的表情符号 - 如何让它们可搜索

spring-boot - Spring Data Elasticsearch返回空的聚合桶

elasticsearch - 为什么 Painless 编译器会提示 `new` 关键字?

elasticsearch - 在Elasticsearch中,自动生成的ID在整个集群中是否唯一?

Elasticsearch:为什么完全匹配比部分匹配得分低