本文整理匯總了PHP中Elastica\Index::addAlias方法的典型用法代碼示例。如果您正苦於以下問題:PHP Index::addAlias方法的具體用法?PHP Index::addAlias怎麽用?PHP Index::addAlias使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Elastica\Index
的用法示例。
在下文中一共展示了Index::addAlias方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUp
protected function setUp()
{
parent::setUp();
$this->_index1 = $this->_createIndex('indices_filter_1');
$this->_index2 = $this->_createIndex('indices_filter_2');
$this->_index1->addAlias("indices_filter");
$this->_index2->addAlias("indices_filter");
$docs = array(new Document("1", array("color" => "blue")), new Document("2", array("color" => "green")), new Document("3", array("color" => "blue")), new Document("4", array("color" => "yellow")));
$this->_index1->getType("test")->addDocuments($docs);
$this->_index2->getType("test")->addDocuments($docs);
$this->_index1->refresh();
$this->_index2->refresh();
}
示例2: moveAliasBetweenIndices
/**
* @param ElasticIndex $oldIndex
* @param ElasticIndex $newIndex
*/
private function moveAliasBetweenIndices(ElasticIndex $oldIndex, ElasticIndex $newIndex)
{
$oldIndex->removeAlias(MappingCreator::ELASTIC_ALIAS);
$newIndex->addAlias(MappingCreator::ELASTIC_ALIAS);
}