gpt4 book ai didi

elasticsearch - 使用过滤器的constant_score和bool查询之间是否存在性能差异?

转载 作者:行者123 更新时间:2023-12-03 02:30:45 32 4
gpt4 key购买 nike

关于“性能差异”,到目前为止,我还没有读过任何可靠的东西。

根据其官方文档,作为bool query中使用的过滤器

The clause (query) must appear in matching documents. However unlike must the score of the query will be ignored. Filter clauses are executed in filter context, meaning that scoring is ignored and clauses are considered for caching.



至于 constant score query

Filter queries do not calculate relevance scores. To speed up performance, Elasticsearch automatically caches frequently used filter queries.



只是一个猜测

常量查询将不计算(TF-IDF或更高级的algs),而 bool(boolean) 查询将进行计算,但返回0(忽略它);因此常量查询的性能更高。

除了指定分数以外,您还必须使用常数分数查询而不是 bool(boolean) 查询, bool(boolean) 查询只会返回0。

我刚刚读过的QA: Elasticsearch : constant_score query vs bool.filter query

最佳答案

不,因为它们相同,所以没有性能差异。

再次基于其官方文档讨论filter context:

In a filter context, a query clause answers the question “Does this document match this query clause?” The answer is a simple Yes or No — no scores are calculated.





Filter context is in effect whenever a query clause is passed to a filter parameter, such as the filter or must_not parameters in the bool query, the filter parameter in the constant_score query, or the filter aggregation.

关于elasticsearch - 使用过滤器的constant_score和bool查询之间是否存在性能差异?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60070503/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com