4 class Database_Adapter_Elasticsearch_Setup implements Database_ISetup
6 public function __construct()
8 $this->searchInstance = $GLOBALS['phorkie']['cfg']['elasticsearch'];
11 public function setup()
13 $r = new \HTTP_Request2(
14 $this->searchInstance . '/_mapping', \HTTP_Request2::METHOD_GET
17 if ($res->getStatus() == 404) {
22 public function reset()
24 $r = new \HTTP_Request2(
25 $this->searchInstance,
26 \HTTP_Request2::METHOD_DELETE
30 $r = new Database_Adapter_Elasticsearch_HTTPRequest(
31 $this->searchInstance,
32 \HTTP_Request2::METHOD_PUT
37 //mapping for repositories
38 $r = new Database_Adapter_Elasticsearch_HTTPRequest(
39 $this->searchInstance . 'repo/_mapping',
40 \HTTP_Request2::METHOD_PUT
45 'repo' => (object)array(
46 '_timestamp' => (object)array(
50 'properties' => (object)array(
51 'id' => (object)array(
54 'description' => (object)array(
58 'crdate' => (object)array(
62 'tstamp' => (object)array(
74 $r = new Database_Adapter_Elasticsearch_HTTPRequest(
75 $this->searchInstance . 'file/_mapping',
76 \HTTP_Request2::METHOD_PUT
81 'file' => (object)array(
82 '_parent' => (object)array(
85 'properties' => (object)array(
86 'name' => (object)array(
90 'extension' => (object)array(
94 'content' => (object)array(