Skip to content

Instantly share code, notes, and snippets.

@belo82
Last active August 29, 2015 13:57
Show Gist options
  • Save belo82/9742377 to your computer and use it in GitHub Desktop.
Save belo82/9742377 to your computer and use it in GitHub Desktop.
Elasticsearch API cheatsheet
# 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