Ejemplo n.º 1
0
 public function delete($id)
 {
     $path = $this->_getPath($id);
     $request = new Garp_Service_Elasticsearch_Request('DELETE', $path);
     $response = $request->execute();
     return $response->isOk();
 }
Ejemplo n.º 2
0
 public function remap()
 {
     $mappingJson = $this->_getMapping();
     $mapping = json_decode($mappingJson, true);
     foreach ($mapping as $type => $typeMapping) {
         $path = '/' . $type . '/_mapping';
         $typeMappingJson = json_encode(array($type => $typeMapping));
         $request = new Garp_Service_Elasticsearch_Request('PUT', $path, $mapping);
         $response = $request->execute();
     }
     return true;
 }
Ejemplo n.º 3
0
 public function testRequestShouldNotHaveDuplicateSlashes()
 {
     // only test ElasticSearch in a project that uses ElasticSearch
     if (!isset(Zend_Registry::get('config')->elasticsearch)) {
         return;
     }
     $method = Garp_Service_Elasticsearch_Request::GET;
     $request = new Garp_Service_Elasticsearch_Request($method, self::BOGUS_PATH);
     $url = $request->getUrl();
     // strip off the protocol, cause those duplicate slashes don't count.
     $url = substr($url, 7);
     $containsDuplicateSlashes = strpos($url, '//') !== false;
     $this->assertFalse($containsDuplicateSlashes, "Does the following request url contain duplicate slashes?\n" . $url);
 }