public function delete($id) { $path = $this->_getPath($id); $request = new Garp_Service_Elasticsearch_Request('DELETE', $path); $response = $request->execute(); return $response->isOk(); }
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; }
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); }