2014-02-25 104 views
1

我有一个文件,其中包含许多字段,其中之一是country。有许多相同的文档countryElasticsearch - 类似国家

当我为Belgium例如做match query,或反对countryfuzzy搜索和查询,它返回的文件,这些文件匹配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作为国家/地区。我应该使用什么相似性?

+0

你回来的分数是多少?百分比等 – Drewness

+0

是否有你为什么使用查询而不是过滤器的原因?过滤器不会影响评分。 –

+0

它是由lucene计算的默认分数。 我需要使用查询,因为我正在使用模糊搜索 – Alex

回答