用 match query 查询字符串"the lord",结果返回
score=8.081023 "The Second Sun" score=5.412263 "Lord of War" score=4.5157876 "The Lord of the Rings: The Two Towers" score=4.120181 "The Lord of the Rings: The Fellowship of the Ring" score=4.120181 "The Lord of the Rings: The Return of the King"
模糊参数改一下,结果也是一样的。刚接触 Elasticsearch,这排序是正常的吗, "The Second Sun" 评分怎么那么高
1
littlehappi 2021-05-11 16:05:57 +08:00
用 match_phrase 试试
|
2
skyleft 2021-05-12 10:12:57 +08:00
按你这个搜出来的应该是这样吧
"hits" : [ { "_index" : "test", "_type" : "1", "_id" : "6NVkW3kBGtH1h4VDFSRZ", "_score" : 0.86009264, "_source" : { "title" : "The Lord of the Rings: The Two Towers" } }, { "_index" : "test", "_type" : "1", "_id" : "6dVkW3kBGtH1h4VDVCSG", "_score" : 0.8239962, "_source" : { "title" : "The Lord of the Rings: The Fellowship of the Ring" } }, { "_index" : "test", "_type" : "1", "_id" : "59VjW3kBGtH1h4VD1iSf", "_score" : 0.65877354, "_source" : { "title" : "Lord of War" } }, { "_index" : "test", "_type" : "1", "_id" : "5NViW3kBGtH1h4VD3SQA", "_score" : 0.35161144, "_source" : { "title" : "The Second Sun" } } |
3
longkas239 OP @skyleft 你用的是 match_phrase 类型吗
|
4
skyleft 2021-05-13 06:43:21 +08:00
@longkas239 match
|