Elasticsearch bool filter and minimum_should_match option

时间:2015-09-14 15:44:22

标签: elasticsearch

I have a following situation - I need to change my bool query to a filter in order to check if it's faster.
Problem is, we use minimum_should_match parameter a lot, typically with 1 or 0 as a value. Bool filter does not support minimum_should_match, apparently - it gives me nested: QueryParsingException[[index_name] [bool] filter does not support [minimum_should_match] error. So what do I do? Are there any workarounds?
We use Elasticsearch 1.7.1

1 个答案:

答案 0 :(得分:1)

在典型情况下,您不需要minimum_should_match

这可能无法完全回答您的问题,因为它只是01的解决方案。

我不知道它不受支持;但请注意,对于10,您不需要该选项,因为1是默认值,0是无效的;它会被忽略,就好像它是1.来自docs

  

无论计算到达的是什么数字,都将永远不会使用大于可选子句数的值或小于1的值。 (即:无论计算结果的结果有多低或多高,所需匹配的最小数量绝不会低于1 或大于条款数。