我有一個文件,其中包含許多字段,其中之一是country
。有許多相同的文檔country
。Elasticsearch - 類似國家
當我爲Belgium
例如做match query
,或反對country
fuzzy
搜索和查詢,它返回的文件,這些文件匹配Belgium
國家名單,但他們都有不同的分數。我相信這是因爲tdidf的相似性和存在belgium
在其他領域的文件等
我想它在這種情況下返回相同的分數。我應該使用什麼相似性?
更新
我接下來的6個文件:
{country:"Austria", title: "house"}
{country:"Austria", title: "Austria village"}
{country: "Germany", title: "deutch hotel" }
{country:"Austria", title: ""}
{country: "USA", title: "Usa hotel" }
{country: "USA", title: "Usa another hotel" }
當我執行匹配查詢對國家:
{
query: {match: {country: "Austria"}}
}
我reveice下一結果:
[ {
"_index" : "elasticdemo_docs",
"_type" : "doc",
"_id" : "1",
"_score" : 1.0, "_source" : {country:"Austria", title: "Austria village"}
}, {
"_index" : "elasticdemo_docs",
"_type" : "doc",
"_id" : "2",
"_score" : 0.30685282, "_source" : {country:"Austria", title: "house"}
}, {
"_index" : "elasticdemo_docs",
"_type" : "doc",
"_id" : "3",
"_score" : 0.30685282, "_source" : {country:"Austria", title: ""}
} ]
我想爲所有3個文件接收相同的_score
,因爲它們全都具有Austria
作爲國家/地區。我應該使用什麼相似性?
你回來的分數是多少?百分比等 – Drewness
是否有你爲什麼使用查詢而不是過濾器的原因?過濾器不會影響評分。 –
它是由lucene計算的默認分數。 我需要使用查詢,因爲我正在使用模糊搜索 – Alex