private void writeStrictFormatting ( List < Object > list , Object paramExtractor , String scriptToUse ) { if ( HAS_SCRIPT ) { /* * { * "script":{ * "inline": "...", * "lang": "...", * "params": ..., * }, * "upsert": {...} * } */ list . add ( scriptToUse ) ; if ( HAS_LANG ) { list . add ( SCRIPT_LANG_5X ) ; } if ( paramExtractor != null ) { list . add ( ",\"params\":" ) ; list . add ( paramExtractor ) ; } list . add ( "}" ) ; if ( UPSERT ) { list . add ( ",\"upsert\":" ) ; } } else { /* * { * "doc_as_upsert": true, * "doc": {...} * } */ list . add ( "{" ) ; if ( UPSERT ) { list . add ( "\"doc_as_upsert\":true," ) ; } list . add ( "\"doc\":" ) ; } }
Script format meant for versions 2 . x to 5 . x . Required format for 5 . x and above .