docs: private void writeLegacyFormatting(List<Object> list, Object paramExtractor) {
          if (paramExtractor != null) {
              list.add("{\"params\":");
              list.add(paramExtractor);
              list.add(",");
          }
          else {
              list.add("{");
          }
  
          if (HAS_SCRIPT) {
              /*
               * {
               *   "params": ...,
               *   "lang": "...",
               *   "script": "...",
               *   "upsert": {...}
               * }
               */
              if (HAS_LANG) {
                  list.add(SCRIPT_LANG_1X);
              }
              list.add(SCRIPT_1X);
              if (UPSERT) {
                  list.add(",\"upsert\":");
              }
          }
          else {
              /*
               * {
               *   "doc_as_upsert": true,
               *   "doc": {...}
               * }
               */
              if (UPSERT) {
                  list.add("\"doc_as_upsert\":true,");
              }
              list.add("\"doc\":");
          }
      }