From: Christian Weiske Date: Wed, 5 Nov 2014 12:35:48 +0000 (+0100) Subject: make phorkie compatible with elasticsearch 1.3 X-Git-Tag: v0.5.0~16 X-Git-Url: https://git.cweiske.de/phorkie.git/commitdiff_plain/3208b3513fb9a8d0e5b4e00701d0e902c1b6107a make phorkie compatible with elasticsearch 1.3 --- diff --git a/src/phorkie/Database/Adapter/Elasticsearch/Indexer.php b/src/phorkie/Database/Adapter/Elasticsearch/Indexer.php index e93cfa7..6da974a 100644 --- a/src/phorkie/Database/Adapter/Elasticsearch/Indexer.php +++ b/src/phorkie/Database/Adapter/Elasticsearch/Indexer.php @@ -117,30 +117,15 @@ class Database_Adapter_Elasticsearch_Indexer implements Database_IIndexer public function deleteAllRepos() { $r = new Database_Adapter_Elasticsearch_HTTPRequest( - $this->searchInstance . 'repo/_query', + $this->searchInstance . 'repo', \HTTP_Request2::METHOD_DELETE ); - $r->allow404 = true; - $r->setBody( - json_encode( - (object)array( - 'match_all' => (object)array() - ) - ) - ); $r->send(); + $r = new Database_Adapter_Elasticsearch_HTTPRequest( - $this->searchInstance . 'file/_query', + $this->searchInstance . 'file', \HTTP_Request2::METHOD_DELETE ); - $r->allow404 = true; - $r->setBody( - json_encode( - (object)array( - 'match_all' => (object)array() - ) - ) - ); $r->send(); } @@ -161,19 +146,10 @@ class Database_Adapter_Elasticsearch_Indexer implements Database_IIndexer { //delete files of that repository $r = new Database_Adapter_Elasticsearch_HTTPRequest( - $this->searchInstance . 'file/_query', + $this->searchInstance . 'file/_query' + . '?q=_parent:' . $repo->id, \HTTP_Request2::METHOD_DELETE ); - $r->allow404 = true; - $r->setBody( - json_encode( - (object)array( - 'field' => (object)array( - '_parent' => $repo->id - ) - ) - ) - ); $r->send(); }