Last active
September 7, 2017 19:13
-
-
Save jworl/f5ff917ab98abf7d00c106da1bd7c291 to your computer and use it in GitHub Desktop.
elasticsearch delete by query
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
ES_DELETE_QUERY(){ | |
INDEX=$1 | |
KEY=$2 | |
VALUE=$3 | |
curl -XPOST 'localhost:9200/${INDEX}/_delete_by_query?scroll_size=5000&pretty' -H 'Content-Type: application/json' -d' | |
{ | |
"query": { | |
"match": { | |
"${KEY}": "${VALUE}" | |
} | |
} | |
} | |
' | |
} | |
ES_DELETE_REGEX(){ | |
INDEX=$1 | |
KEY=$2 | |
REGEX=$3 | |
curl -XPOST 'localhost:9200/${INDEX}/_delete_by_query?scroll_size=5000&pretty' -H 'Content-Type: application/json' -d' | |
{ | |
"query": { | |
"regexp":{ | |
"${KEY}": "${REGEX}" | |
} | |
} | |
} | |
' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment