code: private String formatQueryUrl(String index, String type, String id, Object query) {
          String queryUrl = String.format(fullQueryTemplate,
                  index == null ? "_all" : index,
                  type == null ? "_all" : type,
                  id == null ? "" : id,
                  toQueryParams(query));
  
          return queryUrl.endsWith("?") ? queryUrl.substring(0, queryUrl.length() - 1) : queryUrl;
      }
docs: Format the query url template according to the parameters.
  The format will be /{index}/{type}/{id}?{query} if query is not empty (or null) otherwise the format will be /{index}/{type}/{id}
  
  @param index
  @param type
  @param id
  @param query
  @return