/** * Creates a backup job * * @param string $source * @param string $host * @param int $port * @return RestoreJob * @throws \Exception * @author Daniel Wendlandt */ public function createJob($source, $host, $port = 9200) { $restoreJob = new RestoreJob(); $restoreJob->setHost($host); $restoreJob->setPort($port); $restoreJob->setSource(dirname($source)); $restoreJob->setName(basename($source)); $restoreJob->setServerInfo($this->elastic->getServerInfo($host, $port)); $restoreJob->setMappings($this->filesystem->loadMappings($restoreJob->getPath())); if (!VersionHelper::isVersionAllowed($restoreJob->getServerInfo()->version)) { throw new \Exception('Elasticsearch version ' . $restoreJob->getServerInfo()->version . ' is not supported by this tool'); } return $restoreJob; }