Last active
August 29, 2015 13:57
-
-
Save belo82/9742377 to your computer and use it in GitHub Desktop.
Elasticsearch API cheatsheet
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
# find documents which don't contain field 'non_existing_field' | |
POST /twitter/tweet/_search | |
{ | |
"query": { | |
"bool": { | |
"must": { | |
"match_all": {} | |
}, | |
"must_not": { | |
"prefix": { | |
"non_existing_field": "" | |
} | |
} | |
} | |
} | |
} | |
# get all terms stored in field 'content' | |
POST /twitter/tweet/_search | |
{ | |
"query" : { | |
"query_string" : { | |
"query": "xyz" | |
} | |
}, | |
"script_fields": { | |
"terms" : { | |
"script": "doc[field].values", | |
"params": { | |
"field": "content" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment