如何在 Elasticsearch 中设置无痛饱和函数的默认枢轴?

问题描述 投票:0回答:1

我想在 (0,1) 之间标准化我的 Elasticsearch 查询分数,为此我使用 无痛预定义

saturation()
脚本,该脚本将
_score
作为要标准化的 值的参数,并且pivot 的另一个论点如 示例:

{ "_source": ["id", "first_name", "last_name"], "from": 0, "size": 10000, "query": { "script_score": { "query": { // my query here }, "script": { "source": "saturation(_score, 10)" } } } }
当我使用 

10

 或其他数字作为 
pivot 时,它会按预期工作。但是阅读更深入的文档,例如Rank特征查询的饱和度,它说:

如果未提供主值,Elasticsearch 会计算一个默认值,该值等于索引中所有排名特征值的近似几何平均值。如果您没有机会训练良好的枢轴值,我们建议您使用此默认值。

我还没有训练出好的枢轴;做了一些查询,我注意到最大

_score

 有所不同,例如对于某些样本,它只有 10,而其他样本则高于 100。因此,选择任意枢轴可能对某些情况有利,但对其他情况则不利。 .

如何设置上面的查询以使用那里的默认枢轴值?我尝试了一些方法并得到了例外:

saturation(_score)

saturation(_score,)
saturation(_score, null)

elasticsearch ranking-functions
1个回答
0
投票
我怀疑这个用例不可能。这是

ScoreScriptUtils

 上的 
来源:

public final class ScoreScriptUtils { /****** STATIC FUNCTIONS that can be used by users for score calculations **/ public static double saturation(double value, double k) { return value / (k + value); } //...
似乎只能使用 

rank_feature

rank_features
 字段将默认枢轴设置为数值,这与搜索
_score
 不同
    

© www.soinside.com 2019 - 2024. All rights reserved.