From 85aab558e09840d43d0bb9f1684beb8ad3ceeb11 Mon Sep 17 00:00:00 2001 From: Erik de Vries Date: Thu, 13 Dec 2018 21:24:29 +0100 Subject: [PATCH] bulk_writer: added clause to varname==ud update to also remove the tokens variable from source --- R/bulk_writer.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/bulk_writer.R b/R/bulk_writer.R index 90c8a9f..63205f3 100644 --- a/R/bulk_writer.R +++ b/R/bulk_writer.R @@ -27,7 +27,7 @@ bulk_writer <- function(x, index = 'maml', varname = 'updated_variable', type) { if (varname == "ud") { return( paste0('{"update": {"_index": "',index,'", "_type": "doc", "_id": "',x[1],'"}} -{ "script" : { "source": "ctx._source.ud = params.code", "lang" : "painless", "params": { "code": ',json,'}}}') +{ "script" : { "source": "ctx._source.ud = params.code; ctx._source.remove(\\"tokens\\")", "lang" : "painless", "params": { "code": ',json,'}}}') ) } if (type == 'set') {