Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
elasticsearch delete by query
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