Elasticsearch 轻量搜索 _search 和 q=
Elasticsearch 全文检索 大约 1824 字轻量搜索
使用_search
curl -X GET "localhost:9200/megacorp/employee/_search?pretty=true"
返回:
{
"took" : 254,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "megacorp",
"_type" : "employee",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"first_name" : "John",
"last_name" : "Smith",
"age" : 25,
"about" : "I love to go rock climbing",
"interests" : [
"sports",
"music"
]
}
}
]
}
}
查询字符串搜索
使用q=
参数
curl -X GET "localhost:9200/megacorp/employee/_search?q=last_name:Smith"
返回:
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : 0.6931472,
"hits" : [
{
"_index" : "megacorp",
"_type" : "employee",
"_id" : "1",
"_score" : 0.6931472,
"_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.6931472,
"_source" : {
"first_name" : "Jane",
"last_name" : "Smith",
"age" : 32,
"about" : "I like to collect rock albums",
"interests" : [
"music"
]
}
}
]
}
}
阅读 3622 · 发布于 2019-04-25
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
软考-系统架构设计师:局域网阅读 1911
-
Java 中的动态代理阅读 2593
-
Linux -bash: locate: command not found阅读 1091
-
H2 Syntax error in SQL statement expected "identifier"阅读 1234
-
Spring AOP 原理阅读 1499
-
Go embed 将资源文件打包到二进制文件中阅读 193
-
Docker 部署 KeyCloak阅读 950
-
IDEA Debug 时模拟抛出异常阅读 2998
-
软考-系统架构设计师:规范化理论-价值与用途阅读 2275
-
Redis 过期时间问题阅读 2228