Skip to content

Instantly share code, notes, and snippets.

@webmasterkai
Last active December 16, 2015 15:19
Show Gist options
  • Save webmasterkai/5455394 to your computer and use it in GitHub Desktop.
Save webmasterkai/5455394 to your computer and use it in GitHub Desktop.
clicking the "add" or "remove" button to a cape item
{"add": {
"script": "\tif(ctx._source.containsKey('cape_io')) {\n\t\tctx._source.cape_io.added += add;\n\t}\n\telse {\n\t\tctx._source.cape_io = upsert;\n\t\tctx._source.cape_io.added += add;\n\t}\n\t",
"params": {
"add": {
"query": "jobs_northmpls",
"removed": 1366835680,
"user": "northmpls.org"
},
"upsert": {
"removed": [],
"added": []
}
}
},
"remove": {
"script": "\tif(ctx._source.containsKey('cape_io')) {\n\t\tctx._source.cape_io.removed += remove;\n\t}\n\telse {\n\t\tctx._source.cape_io = upsert;\n\t\tctx._source.cape_io.removed += remove;\n\t}\n\t",
"params": {
"remove": {
"query": "jobs_northmpls",
"removed": 1366835680,
"user": "northmpls.org"
},
"upsert": {
"removed": [],
"added": []
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment