Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Elastic Search Cheat Sheet
# 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