Last active
November 15, 2017 20:29
-
-
Save ranjitiyer/34091f4641db5aa67b4e1895a9d2dc64 to your computer and use it in GitHub Desktop.
Elastic Search Cheat Sheet
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
# Delete docs that do not exactly match a phrase | |
POST audiobooks/book/_delete_by_query | |
{ | |
"query": { | |
"bool": { | |
"must_not": [ | |
{"match_phrase": { | |
"language": "English" | |
}} | |
] | |
} | |
} | |
} | |
# Search docs that do not exactly match a phrase | |
GET audiobooks/book/_search | |
{ | |
"query": { | |
"bool": { | |
"must_not": [ | |
{"match_phrase": { | |
"language": "English" | |
}} | |
] | |
} | |
} | |
} | |
# Search docs exactly match a phrase | |
GET audiobooks/book/_search | |
{ | |
"query": { | |
"bool": { | |
"must": [ | |
{"match_phrase": { | |
"language": "English" | |
}} | |
] | |
} | |
} | |
} | |
# Get all docs that have a field | |
GET audiobooks/book/_search | |
{ | |
"query": { | |
"bool": { | |
"must": { | |
"exists": { | |
"field": "sections.url" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment