function setUp() { $connection = new Search_Elastic_Connection('http://localhost:9200'); $status = $connection->getStatus(); if (!$status->ok) { $this->markTestSkipped('ElasticSearch needs to be available on localhost:9200 for the test to run.'); } $this->indexA = new Search_Elastic_Index($connection, 'test_index_a'); $this->indexA->destroy(); $factory = $this->indexA->getTypeFactory(); $this->indexA->addDocument(array('object_type' => $factory->identifier('wiki page'), 'object_id' => $factory->identifier('PageA'), 'contents' => $factory->plaintext('Hello World A'), 'url' => $factory->identifier('PageA'))); $this->indexB = new Search_Elastic_Index($connection, 'test_index_b_foo'); $this->indexB->destroy(); $factory = $this->indexB->getTypeFactory(); $this->indexB->addDocument(array('object_type' => $factory->identifier('wiki page'), 'object_id' => $factory->identifier('PageB'), 'contents' => $factory->plaintext('Hello World B'), 'url' => $factory->identifier('PageB'))); $this->indexC = new Search_Elastic_Index($connection, 'test_index_c'); $this->indexC->destroy(); $factory = $this->indexC->getTypeFactory(); $this->indexC->addDocument(array('object_type' => $factory->identifier('wiki page'), 'object_id' => $factory->identifier('PageB'), 'contents' => $factory->plaintext('Hello World C'), 'url' => $factory->identifier('/PageC'))); $connection->refresh('*'); $connection->assignAlias('test_index_b', 'test_index_b_foo'); }