public function exists() { $response = $this->getClient()->request($this->getName(), Request::HEAD); $info = $response->getTransferInfo(); return (bool) ($info['http_code'] == 200); }
/** * @return Index */ private function getIndex() { if (null === $this->index) { $this->index = $this->client->getIndex($this->indexName); if (!$this->index->exists()) { $this->index->create(); } } return $this->index; }