protected function getIndex() { $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.'); } return new Search_Elastic_Index($connection, 'test_index'); }
function testObtainStatus() { $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->assertEquals(200, $status->status); }
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->connection = $connection; }
function setUp() { $connection = new Search_Elastic_Connection('http://localhost:9200'); $connection->startBulk(100); $status = $connection->getStatus(); if (!$status->ok) { $this->markTestSkipped('ElasticSearch needs to be available on localhost:9200 for the test to run.'); } $this->index = new Search_Elastic_Index($connection, 'test_index'); $this->index->destroy(); }
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.'); } if (version_compare($status->version->number, '1.1.0') < 0) { $this->markTestSkipped('Elasticsearch 1.1+ required'); } $this->index = new Search_Elastic_Index($connection, 'test_index'); $this->index->destroy(); $factory = $this->index->getTypeFactory(); $this->index->addDocument(array('object_type' => $factory->identifier('wiki page'), 'object_id' => $factory->identifier('HomePage'), 'contents' => $factory->plaintext('Hello World'))); }
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'); }
private function getElasticConnection($useMasterOnly) { global $prefs; static $connections = []; $target = $prefs['unified_elastic_url']; if (!$useMasterOnly && $prefs['federated_elastic_url']) { $target = $prefs['federated_elastic_url']; } if (!empty($connections[$target])) { return $connections[$target]; } $connection = new Search_Elastic_Connection($target); $connection->startBulk(); $connection->persistDirty(TikiLib::events()); $connections[$target] = $connection; return $connection; }
private function getElasticConnection() { global $prefs; $connection = new Search_Elastic_Connection($prefs['unified_elastic_url']); $connection->startBulk(); return $connection; }
public function createIndex($location, $index, $type, array $mapping) { $connection = new Search_Elastic_Connection($location); $connection->mapping($index, $type, $mapping); }