Created
June 16, 2017 13:15
-
-
Save yanglikun/8f353c681547415c878a90e1b6af1842 to your computer and use it in GitHub Desktop.
es-query-simple
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##search scope | |
GET /_mapping | |
#cluster | |
GET /_search | |
#specific index | |
GET /get-together/_search | |
#specific index and type | |
GET /get-together/event/_search | |
#specific type | |
GET /_all/event/_search | |
#specific type | |
GET /*/event/_search | |
#multiple index and type | |
GET /get-together,blog/event,a_type/_search | |
# alias | |
##url-based | |
GET /get-together/_search?from=10&size=10 | |
GET /get-together/_search?sort=date:asc | |
GET /get-together/_search?sort=date:asc&_source=title,date | |
GET /get-together/_search?sort=date:asc&q=title:elasticsearch | |
##body-based | |
GET /get-together/_search | |
{ | |
"query": { | |
"match_all": {} | |
}, | |
"from": 10, | |
"size": 20 | |
} | |
#return specific fields | |
GET /get-together/_search | |
{ | |
"query": { | |
"match_all": {} | |
}, | |
"_source": ["date","title"] | |
} | |
#return specific fields with wildcard | |
GET /get-together/_search | |
{ | |
"query": { | |
"match_all": {} | |
}, | |
"_source": ["d*"] | |
} | |
#include and exclude | |
GET /get-together/_search | |
{ | |
"query": { | |
"match_all": {} | |
}, | |
"_source": { | |
"include": ["d*","title"], | |
"exclude": ["desc*"] | |
} | |
} | |
# sort | |
GET /get-together/group/_search | |
{ | |
"query": { | |
"match_all": {} | |
}, | |
"sort": [ | |
{"created_on":"asc"}, | |
{"name":"desc"}, | |
"_score" | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment