嘿~ 今天天气不错嘛

ElasticSearch布尔查询超限

Elasticsearch | 作者 hyzz | 发布于2020年04月24日 | 阅读数:1657

各位老师好,在使用ES过程中发现ES查询报错,报错信息是“type":"too_many_clauses","reason":"too_many_clauses: maxClauseCount is set to 1024"”,报错原因是布尔查询中的term超过了1024个限制,但是无法更改index.query.bool.max_clause_count配置参数,想请教一下是否有什么好的解决办法。
现在的查询为"query":{
"bool":{
"should":{}---->超过1024个term
}
}
 
如果改成"query":{
"bool":{
"bool":{
"should":{},   ---->对查询条件做切割 比如600条
"should":{}    ---->对查询条件做切割 比如600条
}
}
}可以吗,或者说有什么更优的解决方案,谢谢各位老师
 
 
已邀请:

tacsklet - 公司有用到es

赞同来自:

should换成terms查询看看行不行,这个没有1024的限制,好像条件多的时候terms性能更好。

hyzz

赞同来自:

还有老师可以帮忙解答一下这个问题吗,谢谢

要回复问题请先登录注册