Skip to content

Commit

Permalink
small refacto in JsonScriptTemplateBulk preProcess
Browse files Browse the repository at this point in the history
  • Loading branch information
luc committed Mar 30, 2020
1 parent 98d9993 commit 441cfd5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ protected Object preProcess(Object object, BytesArray storage) {

BytesArray ba = null;
if (ConfigurationOptions.ES_OPERATION_UPSERT.equals(settings.getOperation())) {
ba = storage;
if (settings.hasScriptUpsert()) {
ba = storage;
jsonWriter.convert("{}", ba);
scratchPad.reset();
ba = scratchPad;
} else ba = storage;
}
}
else {
scratchPad.reset();
Expand All @@ -65,7 +65,6 @@ protected Object preProcess(Object object, BytesArray storage) {
}

jsonExtractors.process(ba);

return storage;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ private void writeLegacyFormatting(List<Object> list, Object paramExtractor) {
* "params": ...,
* "lang": "...",
* "script": "...",
* "scripted_upsert":true,
* "upsert": {...}
* }
*/
Expand Down Expand Up @@ -180,12 +181,12 @@ private void writeStrictFormatting(List<Object> list, Object paramExtractor, Str
if (HAS_SCRIPT) {
/*
* {
* "scripted_upsert":true,
* "script":{
* "inline": "...",
* "lang": "...",
* "params": ...,
* },
* "scripted_upsert":true,
* "upsert": {...}
* }
*/
Expand Down

0 comments on commit 441cfd5

Please sign in to comment.