我有以下情况-我需要将bool查询更改为过滤器,以检查其速度是否更快。
问题是,我们经常使用minimum_should_match
参数,通常使用1或0作为值。 bool(boolean) 过滤器显然不支持minimum_should_match
-它给了我nested: QueryParsingException[[index_name] [bool] filter does not support [minimum_should_match]
错误。那我该怎么办?有什么解决方法吗?我们使用Elasticsearch 1.7.1
最佳答案
在典型情况下,您不需要minimum_should_match
。
这可能无法完全回答您的问题,因为这仅是0
和1
的解决方案。
我不知道它不受支持。但是,请注意,对于1
和0
,您不需要此选项,因为默认值为1,而0为无效;它被忽略,就好像它是1。从docs:
No matter what number the calculation arrives at, a value greater than the number of optional clauses, or a value less than 1 will never be used. (ie: no matter how low or how high the result of the calculation result is, the minimum number of required matches will never be lower than 1 or greater than the number of clauses.
关于elasticsearch - Elasticsearch bool过滤器和minimum_should_match选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32568802/