Skip to content

Commit

Permalink
small refacto in JsonScriptTemplateBulk preProcess
Browse files Browse the repository at this point in the history
  • Loading branch information
lucebert committed Mar 30, 2020
1 parent 553f0d9 commit 9b64aa6
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 9b64aa6

Please sign in to comment.