code: public static MultiSearchScriptTemplateRequest parseRequest(final RestRequest restRequest, final boolean allowExplicitIndex)
              throws IOException {
          final MultiSearchScriptTemplateRequest multiRequest = new MultiSearchScriptTemplateRequest();
          if (restRequest.hasParam("max_concurrent_searches")) {
              multiRequest.maxConcurrentSearchRequests(restRequest.paramAsInt("max_concurrent_searches", 0));
          }
  
          RestMultiSearchAction.parseMultiLineRequest(restRequest, multiRequest.indicesOptions(), allowExplicitIndex,
                  (searchRequest, bytes) -> {
                      try {
                          final SearchScriptTemplateRequest searchTemplateRequest = RestSearchScriptTemplateAction.parse(bytes);
                          if (searchTemplateRequest.getScript() != null) {
                              searchTemplateRequest.setRequest(searchRequest);
                              multiRequest.add(searchTemplateRequest);
                          } else {
                              throw new IllegalArgumentException("Malformed search template");
                          }
                      } catch (final IOException e) {
                          throw new ElasticsearchParseException("Exception when parsing search template request", e);
                      }
                  });
          return multiRequest;
      }
docs: Parses a {@link RestRequest} body and returns a {@link MultiSearchScriptTemplateRequest}