Elasticsearch 全文搜索 query->match
Elasticsearch 全文检索 大约 1443 字全文搜索
query
->match
curl -X GET "localhost:9200/megacorp/employee/_search?pretty=true" -H 'Content-Type: application/json' -d'
{
"query" : {
"match" : {
"about" : "rock climbing"
}
}
}
'
返回:
{
"took" : 9,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : 1.4167402,
"hits" : [
{
"_index" : "megacorp",
"_type" : "employee",
"_id" : "1",
"_score" : 1.4167402,
"_source" : {
"first_name" : "John",
"last_name" : "Smith",
"age" : 25,
"about" : "I love to go rock climbing",
"interests" : [
"sports",
"music"
]
}
},
{
"_index" : "megacorp",
"_type" : "employee",
"_id" : "2",
"_score" : 0.45895916,
"_source" : {
"first_name" : "Jane",
"last_name" : "Smith",
"age" : 32,
"about" : "I like to collect rock albums",
"interests" : [
"music"
]
}
}
]
}
}
相关性得分
Elasticsearch 默认按照相关性得分排序,即每个文档跟查询的匹配程度。第一个最高得分的结果很明显:John Smith 的 about 属性清楚地写着 “rock climbing” 。
但为什么 Jane Smith 也作为结果返回了呢?原因是她的 about 属性里提到了 “rock” 。因为只有 “rock” 而没有 “climbing” ,所以她的相关性得分低于 John 的。
阅读 1637 · 发布于 2019-04-25
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓
昵称:
随便看看
换一批
-
Linux 之 CentOS 安装 JDK 及 JRE阅读 3065
-
Oracle ORA-01502: index 'INDEX_NAME' or partition of such index is in unusable state阅读 2846
-
Kubernetes 数据存储 Secret阅读 1318
-
Go 加密算法之 md5阅读 1880
-
Java 删除非空文件夹阅读 1725
-
HTML 自定义表单验证信息阅读 1346
-
走进 Spring Boot 第一步之 Java Properties 类阅读 2727
-
Java 查看虚拟机日志阅读 151
-
Nginx 负载均衡 WebSocket 请求阅读 2711
-
Linux 之校准服务器时间阅读 3054