Skip to content

Instantly share code, notes, and snippets.

@AviranAbady
Created May 13, 2021 08:47
Show Gist options
  • Save AviranAbady/f45975c519e2a0e5c0c1edf1a0c0b060 to your computer and use it in GitHub Desktop.
Save AviranAbady/f45975c519e2a0e5c0c1edf1a0c0b060 to your computer and use it in GitHub Desktop.
Elasticsearch update by query using params to set an object
POST management_users/_update_by_query
{
"script": {
"source": "ctx._source.web_permissions=params.web_permissions",
"params": {
"web_permissions": {
"allowed_actions": [],
"permissions_group_name": "full_control",
"permissions_group_id": "f-AbVXgBawR5qZFRXLTM",
"permissions_group_label": "Full control"
}
}
},
"query": {
"bool": {
"must_not": {
"exists": {
"field": "web_permissions"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment