follow redirect, do not verify ssl certificates, use final after-redirect url
[phinde.git] / bin / setup.php
1 #!/usr/bin/env php
2 <?php
3 namespace phinde;
4 //configure the elasticsearch index
5 set_include_path(__DIR__ . '/../src/' . PATH_SEPARATOR . get_include_path());
6 require_once __DIR__ . '/../data/config.php';
7 require_once 'HTTP/Request2.php';
8 require_once 'Elasticsearch/Request.php';
9
10 //delete old index
11 $r = new Elasticsearch_Request(
12     $GLOBALS['phinde']['elasticsearch'],
13     \HTTP_Request2::METHOD_DELETE
14 );
15 $r->allow404 = true;
16 $r->send();
17
18 //recreate it
19 $r = new Elasticsearch_Request(
20     $GLOBALS['phinde']['elasticsearch'],
21     \HTTP_Request2::METHOD_PUT
22 );
23 $r->setBody(
24     file_get_contents(__DIR__ . '/../data/elasticsearch-mapping.json')
25 );
26 $r->send();
27 ?>