protected function getIndex()
 {
     $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.');
     }
     return new Search_Elastic_Index($connection, 'test_index');
 }
Exemple #2
0
 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();
 }
Exemple #3
0
 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;
 }