gpt4 book ai didi

elasticsearch - 带有嵌套对象的Elasticsearch function_score

转载 作者:行者123 更新时间:2023-12-02 22:25:27 34 4
gpt4 key购买 nike

我有一个查询问题。我使用查询来提升没有nested_objects的文档。现在,我使用nested_objects并将查询更改为使用嵌套过滤器,但没有任何改进。
我得到了我期望的文档,但是没有_score更改。

难道我做错了什么 ??

GET index/type/_search
{
"query": {
"function_score": {
"filter": {
"bool": {
"must": [
{
"term": {
"parent.child": "test"
}
}
]
}
},
"functions": [
{
"boost_factor": "100",
"filter": {
"nested": {
"path": "parent",
"filter": {
"bool": {
"must": [
{
"term": {
"child": "test"
}
}
]
}
}
}
}
}
],
"score_mode": "sum"
}
},
"sort": "_score",
"from": 0,
"size": 320
}

编辑:
可能是由

nested filter

A nested filter behaves much like a nested query, except that it doesn’t accept the score_mode parameter. It can only be used in “filter context” — such as inside a filtered query —  and it behaves like any other filter: it includes or excludes, but it doesn’t score.

While the results of the nested filter itself are not cached, the usual caching rules apply to the filter inside the nested filter.

http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/nested-query.html

最佳答案

如文档所述:

嵌套过滤器

嵌套过滤器的行为与嵌套查询非常相似,只是它不接受score_mode参数。它只能在“过滤器上下文”中使用,例如在已过滤的查询中使用,并且其行为类似于任何其他过滤器:包括或排除,但不会给评分。

尽管不缓存嵌套过滤器本身的结果,但通常的缓存规则适用于嵌套过滤器内部的过滤器。

http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/nested-query.html

关于elasticsearch - 带有嵌套对象的Elasticsearch function_score,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25182929/

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