如果bool查询的查询条件过多会导致TooManyClauses问题:
1
2"caused_by":{"type":"too_many_clauses","reason":"maxClauseCount is set to 1024"}}}],
"caused_by":{"type":"query_shard_exception","reason":"failed to create query:解决方式在配置文件 Elasticsearch.yml中配置:
- index.query.bool.max_clause_count: 10240
设置最大限制bool查询的条数,过多会导致性能比较慢。
在ElasticSearch 5之后参数有所改动,提示如下:
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.