/** * @var Extension * @var bool */ public function indexExtension(Extension $extension, $update = false) { $id = $extension->getName(); $packageDocument = new \Elastica\Document($id, ['id' => $id, 'name' => $id, 'description' => $extension->getDescription(), 'tags' => $extension->getVersions(), 'keywords' => $extension->getKeywords(), 'stars' => $extension->getStars()]); $elasticaIndex = $this->client->getIndex('packages'); $elasticaType = $elasticaIndex->getType('packages'); if ($update) { $elasticaType->updateDocument($packageDocument); } else { $elasticaType->addDocument($packageDocument); } $elasticaType->getIndex()->refresh(); }