你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
赞同来自: dongxiao 、ppppenger
PUT test_index { "mappings": { "properties": { "title":{ "type":"text" } } } } POST test_index/_bulk {"index":{"_id":1}} {"title":"bed"} {"index":{"_id":2}} {"title":"dog bed"} POST test_index/_search { "query": { "match_phrase": { "title": "bed" } } }
Ombres
赞同来自: dongxiao
PUT test_index { "mappings": { "properties": { "title": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } } } } } POST test_index/_bulk {"index":{"_id":1}} {"title":"bed"} {"index":{"_id":2}} {"title":"dog bed"} {"index":{"_id":3}} {"title":"bed dog"} POST test_index/_search { "query": { "bool": { "must": [ { "match": { "title": "bed" } } ], "should": [ { "prefix": { "title.keyword": { "value": "bed" } } } ] } } }
{ "took" : 84, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 3, "relation" : "eq" }, "max_score" : 1.1596571, "hits" : [ { "_index" : "test_index", "_type" : "_doc", "_id" : "1", "_score" : 1.1596571, "_source" : { "title" : "bed" } }, { "_index" : "test_index", "_type" : "_doc", "_id" : "3", "_score" : 1.1234324, "_source" : { "title" : "bed dog" } }, { "_index" : "test_index", "_type" : "_doc", "_id" : "2", "_score" : 0.12343237, "_source" : { "title" : "dog bed" } } ] } }
dongxiao
赞同来自: Charles999
赞同来自:
five
要回复问题请先登录或注册
5 个回复
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
赞同来自: dongxiao 、ppppenger
Ombres
赞同来自: dongxiao
通过增加部分结果的评分来修改排序,以下仅为示例 最终结果如下
dongxiao
赞同来自: Charles999
dongxiao
赞同来自:
five
赞同来自: