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"
]
}
}
]
}
}
阅读 889 · 发布于 2019-04-25
————        END        ————
扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
软考-系统架构设计师:DNS协议阅读 1218
-
Linux使用vmstat查看虚拟内存状态阅读 1788
-
MyBatis Cause: java.lang.IndexOutOfBoundsException: Index: 5, Size: 5阅读 2249
-
Golang字符串与字节数组互相转换阅读 497
-
OpenResty使用cjson操作JSON数据阅读 1995
-
Android6.0及以上设备查看流量使用情况阅读 1927
-
Golang时间加减、计算方法耗、毫秒转Time阅读 1053
-
MySQL之MyISAM和InnoDB区别阅读 504
-
Android揭露效果Reveal Effect阅读 522
-
Java注释也会被执行?阅读 630