是时候用 ES 拯救发际线啦

ik中文分词结果得分问题

Elasticsearch | 作者 splivesola | 发布于2018年01月20日 | 阅读数:2469


building_id字段做个如下配置:
'building_id' => array( 'type' => 'string', 'analyzer'=>'ik_smart' )
然后我往里面插入了五个文档:
        '激光器大旅',
'808 激光器2',
'808 大旅',
'808大旅',
'很大旅行再来一个'
搜索的条件如下:
'query' => [ 'match' => [ '
building_id' => '808 大旅' ] ]
结果如下hits部分:
[hits] => Array
(
[0] => Array
(
[_index] => smart
[_type] => smart
[_id] => 1
[_score] => 1.5996621
[_source] => Array
(
[building_id] => 激光器大旅
)
)

[1] => Array
(
[_index] => smart
[_type] => smart
[_id] => 2
[_score] => 1.0151966
[_source] => Array
(
[building_id] => 808 激光器2
)

)

[2] => Array
(
[_index] => smart
[_type] => smart
[_id] => 3
[_score] => 0.7594807
[_source] => Array
(
[building_id] => 808 大旅
)

)

[3] => Array
(
[_index] => smart
[_type] => smart
[_id] => 4
[_score] => 0.7133084
[_source] => Array
(
[building_id] => 808大旅
)

)

)
为何后面两个不是在第一位不是得分最高呢?后面两个有我搜索的所有关键字啊
已邀请:

rockybean - Elastic Certified Engineer, ElasticStack Fans,公众号:ElasticTalk

赞同来自:

 用 explain 看一下,估计你分片数没有设置为1个,你把分片数设置为1个,再试试估计就正常了

要回复问题请先登录注册