diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2016-02-01 20:18:59 +0100 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2016-02-01 20:18:59 +0100 |
| commit | 7b4425b096fa8c18d0db9fd9b1ae96d63ee8af55 (patch) | |
| tree | 2dc5d998a1fd0238592b451ff88b5c4cec064f9b /bin/setup.php | |
| download | phinde-7b4425b096fa8c18d0db9fd9b1ae96d63ee8af55.tar.gz phinde-7b4425b096fa8c18d0db9fd9b1ae96d63ee8af55.zip | |
first kinda working version
Diffstat (limited to 'bin/setup.php')
| -rwxr-xr-x | bin/setup.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/setup.php b/bin/setup.php new file mode 100755 index 0000000..7dacedd --- /dev/null +++ b/bin/setup.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +<?php +namespace phinde; +//configure the elasticsearch index +set_include_path(__DIR__ . '/../src/' . PATH_SEPARATOR . get_include_path()); +require_once __DIR__ . '/../data/config.php'; +require_once 'HTTP/Request2.php'; +require_once 'Elasticsearch/Request.php'; + +//delete old index +$r = new Elasticsearch_Request( + $GLOBALS['phinde']['elasticsearch'], + \HTTP_Request2::METHOD_DELETE +); +$r->allow404 = true; +$r->send(); + +//recreate it +$r = new Elasticsearch_Request( + $GLOBALS['phinde']['elasticsearch'], + \HTTP_Request2::METHOD_PUT +); +$r->setBody( + file_get_contents(__DIR__ . '/../data/elasticsearch-mapping.json') +); +$r->send(); +?> |
