code: public boolean existsCore(String coreName) {
          try {
              CoreStatus status = CoreAdminRequest.getCoreStatus(coreName, solrClient);
              status.getInstanceDirectory();
          } catch (Exception e) {
              return false;
          }
          return true;
      }
docs: Check if a given core exists.
  
  @param coreName Core name
  @return True or false