私は2つの文書を持っています:
{
id: 7,
title: 'Wet',
description: 'asdfasdfasdf'
}
{
id: 6
title: 'Wet wet',
description: 'asdfasdfasdf'
}
2 番目の文書の余分な単語を除いて、それらはほとんど同じです。
私のクエリはこれです:
var qobject = {
query:{
custom_score:{
query:{
multi_match:{
query: q, //I searched for "wet"
fields: ['title','description'],
}
},
script: '_score '
}
}
}
OK、このクエリを実行すると、次の結果が得られます。
{ total: 2,
max_score: 1.8472979,
hits:
[ { _index: 'products',
_type: 'products',
_id: '7',
_score: 1.9808292,
_source: [Object] },
{ _index: 'products',
_type: 'products',
_id: '6',
_score: 1.7508222,
_source: [Object] } ] }
ID 7 が ID 6 よりも上位にランクされるのはなぜですか? スコアの背後にある理由は何ですか? 2語あるから6の方が上じゃない?
より多くの単語 = より多くの重みが必要な場合はどうすればよいですか? それを変更するには、クエリをどうすればよいですか?
説明は以下です。
"_explanation": {
"value": 1.9808292,
"description": "custom score, product of:",
"details": [
{
"value": 1.9808292,
"description": "script score function: composed of:",
"details": [
{
"value": 1.9808292,
"description": "fieldWeight(title:wet in 0), product of:",
"details": [
{
"value": 1,
"description": "tf(termFreq(title:wet)=1)"
},
{
"value": 1.9808292,
"description": "idf(docFreq=2, maxDocs=8)"
},
{
"value": 1,
"description": "fieldNorm(field=title, doc=0)"
}
]
}
]
},
{
"value": 1,
"description": "queryBoost"
}
]
}
"_explanation": {
"value": 1.7508222,
"description": "custom score, product of:",
"details": [
{
"value": 1.7508222,
"description": "script score function: composed of:",
"details": [
{
"value": 1.7508222,
"description": "fieldWeight(title:wet in 0), product of:",
"details": [
{
"value": 1.4142135,
"description": "tf(termFreq(title:wet)=2)"
},
{
"value": 1.9808292,
"description": "idf(docFreq=2, maxDocs=8)"
},
{
"value": 0.625,
"description": "fieldNorm(field=title, doc=0)"
}
]
}
]
},
{
"value": 1,
"description": "queryBoost"
}
]
}