Skip to content

Instantly share code, notes, and snippets.

@craigeddy
Created February 27, 2024 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigeddy/41051acbf4b6929b9c6129953b8160c9 to your computer and use it in GitHub Desktop.
Save craigeddy/41051acbf4b6929b9c6129953b8160c9 to your computer and use it in GitHub Desktop.
POST subjects/_update_by_query
{
"query": {
"match": {
"handleList.platform": "0"
}
},
"script": {
"source": """if (ctx._source.handleList != null) {
for (int i=ctx._source.handleList.length-1; i>=0; i--) {
if (ctx._source.handleList[i]['platform'] == "0") {
ctx._source.handleList[i]['platform'] = "TikTok";
break;
}}}""",
"lang": "painless"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment