ES elasticsearch
阿新 • • 發佈:2019-01-10
GET
/megacorp/employee/1
id查詢GET
/megacorp/employee/_search
查詢所有
GET
/megacorp/employee/_search?q=last_name:Smith
查詢last_name
= Smith
GET
/megacorp/employee/_search
查詢last_name = Smith
{"query":{"match":{
match模糊搜尋、match_phrase 全匹配"last_name":"Smith"}}}
GET
/megacorp/employee/_search
過濾查詢
{"query":{"filtered":{"filter" :{"range":{"age":{"gt":30}}},"query":{"match":{"last_name":"smith"}}}}}GET
/_mget
組查詢{"docs":[{"_index":"website","_type":"blog","_id":2},{"_index":"website","_type":"pageviews","_id":1,"_source":"views"}]}
GET
/website/blog/_mget
組查詢{"ids":["2","1"]}
返回結果{"_index":"megacorp","_type":"employee", "_id":"1","_version":1,"found":true,"_source":{"first_name":"John","last_name":"Smith","age":25,"about":"I love to go rock climbing","interests":["sports","music"]}}
GET
/_search 全部查詢
GET /_search?size=5 查出五個GET /_search?size=5&from=5 從第五個開始查出五個GET /_search?size=5&from=10 從第十個開始查出五個
-
/_search
- Search all types in all indices
-
/gb/_search
-
Search all types in the
gb
index -
/gb,us/_search
-
Search all types in the
gb
us
indices -
/g*,u*/_search
-
Search all types in any indices beginning with
g
or beginning withu
-
/gb/user/_search
-
Search type
user
in thegb
index -
/gb,us/user,tweet/_search
-
Search types
user
andtweet
in thegb
andus
indices -
/_all/user,tweet/_search
-
Search types
user
andtweet
in all indices - 返回結果:
GET /_search?size=5 查出五個GET /_search?size=5&from=5 從第五個開始查出五個GET /_search?size=5&from=10 從第十個開始查出五個