Elasticsearch - set max_clause_count

后端 未结 4 1664
名媛妹妹
名媛妹妹 2020-12-06 01:43

I have a pretty big terms query in elasticsearch, so I get too_many_clauses: maxClauseCount is set to 1024

I tried increasing it in the elasticsearch.y

相关标签:
4条回答
  • 2020-12-06 02:24

    If you're looking to make changes to your cloud elasticsearch.yml file in a cloud deployment, see Add Elasticsearch user settings for the steps to follow to achieve this and the changes you're allowed to make. However, note that there is a limit to the settings you're allowed to change in the cloud deployment.

    If you're looking to make changes to your local cluster, you can make the change directly in your elasticsearch,yml file located at "elasticsearch-x.x.x/config/elasticsearc.yml" by simply adding a line of the required setting to the file. For example, if you want to change indices.query.bool.max_clause_count from it's default value of 1024 to 4096, you can add the line indices.query.bool.max_clause_count: 4096 to your elasticsearch.yml file.

    Remember that indices.query.bool.max_clause_count is 1024 be default, though the elasticsearch.yml does explicitly contain a line stating this value, yet it would resort to 1024 being the default value. So the only way to change this value is that you will explicitly add the line "indices.query.bool.max_clause_count: 4096". By including this line and specifying your preferred value in your own elasticsearch.yml file, you have ultimately modified the value "indices.query.bool.max_clause_count" for your cluster.

    The following image shows how this line was appended to a sample elasticsearch.yml file:

    After adding this line and saving the changes to your elasticsearch.yml file, start Elasticsearch, and then Kibana (if you're interacting with ES with Kibana). You can verify your setting by running the command: GET /_cluster/settings/?include_defaults in Kibana or curl -XGET "http://localhost:9200/_cluster/settings/?include_defaults" in your command line. Then, look for max_clause_count in the command's output to verify the value of indices.query.bool.max_clause_count

    0 讨论(0)
  • 2020-12-06 02:32

    this can also be achieved by updating configuration inside elasticsearch.yml file (inside config folder of elastic installation)

    indices.query.bool.max_clause_count:4096
    
    0 讨论(0)
  • 2020-12-06 02:34

    Background

    NOTE: The advice given in this answer only applies to versions of Elasticsearch below 5.5. The method described references a property that was eventually removed in 5.5.

    Search Settings

    The setting index.query.bool.max_clause_count has been removed. In order to set the maximum number of boolean clauses indices.query.bool.max_clause_count should be used instead.

    • Ref - Breaking changes in 5.0 » Settings changes

    Original Answer

    Add the following:

    index.query.bool.max_clause_count: 10240
    

    To the file elasticsearch.yml on each node of the cluster, then of course, restart the nodes (any change in the config file needs a restart).

    0 讨论(0)
  • 2020-12-06 02:34

    In Elasticsearch 5 index.query.bool.max_clause_count has been deprecated/removed.

    Insert in your elasticsearch.yml file indices.query.bool.max_clause_count : n instead (where n - new supported number of clauses).

    NOTE: Here is link to documentation.

    0 讨论(0)
提交回复
热议问题