@@ -3,21 +3,21 @@  | 
                                                    ||
| 3 | 3 | require_once dirname(__DIR__) . '/app_config.php';  | 
                                                        
| 4 | 4 | require_once $config['base_dir'] . '/lib/vendor/autoload.php';  | 
                                                        
| 5 | 5 | |
| 6 | -define('BASE_HREF',$config['base_url']); | 
                                                        |
| 6 | +define('BASE_HREF', $config['base_url']); | 
                                                        |
| 7 | 7 | |
| 8 | 8 | session_start();  | 
                                                        
| 9 | 9 | |
| 10 | -if(isset($_GET['ES_SERVER'])){ | 
                                                        |
| 10 | +if (isset($_GET['ES_SERVER'])) { | 
                                                        |
| 11 | 11 | $_SESSION['ES_SERVER'] = $_GET['ES_SERVER'];  | 
                                                        
| 12 | 12 | }  | 
                                                        
| 13 | -if(isset($_SESSION['ES_SERVER'])){ | 
                                                        |
| 13 | +if (isset($_SESSION['ES_SERVER'])) { | 
                                                        |
| 14 | 14 | $config['es_server'] = $_SESSION['ES_SERVER'];  | 
                                                        
| 15 | 15 | }  | 
                                                        
| 16 | 16 | |
| 17 | -$ES = \Elasticsearch\ClientBuilder::create()->setHosts([ $config['es_server']])->build();  | 
                                                        |
| 17 | +$ES = \Elasticsearch\ClientBuilder::create()->setHosts([$config['es_server']])->build();  | 
                                                        |
| 18 | 18 | |
| 19 | 19 | $RSlim = new \RSlim\RSlim($config);  | 
                                                        
| 20 | 20 |  $RSlim->register("get", '/', 'es/root'); | 
                                                        
| 21 | 21 |  $RSlim->register("get", "/{index}/{type}", "es/type"); | 
                                                        
| 22 | -$RSlim->register("get", "/delete/{index}/{type}/{id}", "es/doc.delete",'json'); | 
                                                        |
| 22 | +$RSlim->register("get", "/delete/{index}/{type}/{id}", "es/doc.delete", 'json'); | 
                                                        |
| 23 | 23 | $RSlim->run();  | 
                                                        
| 24 | 24 | \ No newline at end of file  | 
                                                        
@@ -2,15 +2,15 @@ discard block  | 
                                                    ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | |
| 5 | -function app_content( $request, $args ){ | 
                                                        |
| 5 | +function app_content($request, $args) { | 
                                                        |
| 6 | 6 | |
| 7 | 7 | global $ES;  | 
                                                        
| 8 | 8 | |
| 9 | 9 | $index = $args['index'];  | 
                                                        
| 10 | 10 | $type = $args['type'];  | 
                                                        
| 11 | 11 | $params = [];  | 
                                                        
| 12 | - $from = $request->getParam( 'from', 0 );  | 
                                                        |
| 13 | - $sort = $request->getParam( 'sort', '' );  | 
                                                        |
| 12 | +    $from = $request->getParam('from', 0); | 
                                                        |
| 13 | +    $sort = $request->getParam('sort', ''); | 
                                                        |
| 14 | 14 | $size = 25;  | 
                                                        
| 15 | 15 | |
| 16 | 16 | $documents = [];  | 
                                                        
@@ -22,15 +22,15 @@ discard block  | 
                                                    ||
| 22 | 22 | $params['size'] = $size;  | 
                                                        
| 23 | 23 | |
| 24 | 24 | $results = $ES->search($params);  | 
                                                        
| 25 | -    foreach ($results['hits']['hits'] as $doc){ | 
                                                        |
| 25 | +    foreach ($results['hits']['hits'] as $doc) { | 
                                                        |
| 26 | 26 | $doc['_source']['_id'] = $doc['_id'];  | 
                                                        
| 27 | - $documents[]=$doc['_source'];  | 
                                                        |
| 27 | + $documents[] = $doc['_source'];  | 
                                                        |
| 28 | 28 | }  | 
                                                        
| 29 | 29 | $params['search_type'] = 'count';  | 
                                                        
| 30 | 30 | $count = $ES->search($params);  | 
                                                        
| 31 | 31 | $nof = 0;  | 
                                                        
| 32 | -    if( isset( $count['hits']['total'] ) ){ | 
                                                        |
| 33 | - $nof = (int) $count['hits']['total'];  | 
                                                        |
| 32 | +    if (isset($count['hits']['total'])) { | 
                                                        |
| 33 | + $nof = (int) $count['hits']['total'];  | 
                                                        |
| 34 | 34 | }  | 
                                                        
| 35 | - return ['app_title'=>$index."/".$type ,'data'=>[ 'index' => $index, 'type' => $type, 'documents'=> $documents, 'from' => $from, 'nof'=>$nof, 'size' => $size,'sort'=>$sort]];  | 
                                                        |
| 35 | + return ['app_title'=>$index . "/" . $type, 'data'=>['index' => $index, 'type' => $type, 'documents'=> $documents, 'from' => $from, 'nof'=>$nof, 'size' => $size, 'sort'=>$sort]];  | 
                                                        |
| 36 | 36 | }  | 
                                                        
| 37 | 37 | \ No newline at end of file  | 
                                                        
@@ -1,22 +1,22 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | |
| 3 | -function app_content( $request, $args ){ | 
                                                        |
| 3 | +function app_content($request, $args) { | 
                                                        |
| 4 | 4 | |
| 5 | 5 | global $ES;  | 
                                                        
| 6 | 6 | |
| 7 | 7 | $indices = $ES->indices()->getAliases();  | 
                                                        
| 8 | 8 | $indexes = [];  | 
                                                        
| 9 | -    foreach ($indices as $index => $alieses){ | 
                                                        |
| 10 | -        if(strpos($index, ".") !==0 ){ | 
                                                        |
| 9 | +    foreach ($indices as $index => $alieses) { | 
                                                        |
| 10 | +        if (strpos($index, ".") !== 0) { | 
                                                        |
| 11 | 11 | $params['index'] = $index;  | 
                                                        
| 12 | 12 | $index_data = [];  | 
                                                        
| 13 | - $index_data['name']=$index;  | 
                                                        |
| 13 | + $index_data['name'] = $index;  | 
                                                        |
| 14 | 14 | $index_info = $ES->indices()->getMapping($params);  | 
                                                        
| 15 | -            foreach ( $index_info[$index]['mappings'] as $type => $type_info ){ | 
                                                        |
| 16 | -                if( $type == '_default_' ){ continue; } | 
                                                        |
| 15 | +            foreach ($index_info[$index]['mappings'] as $type => $type_info) { | 
                                                        |
| 16 | +                if ($type == '_default_') { continue; } | 
                                                        |
| 17 | 17 | $index_data['types'][] = $type;  | 
                                                        
| 18 | 18 | }  | 
                                                        
| 19 | - $indexes[]=$index_data;  | 
                                                        |
| 19 | + $indexes[] = $index_data;  | 
                                                        |
| 20 | 20 | }  | 
                                                        
| 21 | 21 | }  | 
                                                        
| 22 | 22 | return ['data'=>['indexes' => $indexes], 'app_title'=>'Indexes'];  | 
                                                        
@@ -1,6 +1,6 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | |
| 3 | -function app_content($request, $args){ | 
                                                        |
| 3 | +function app_content($request, $args) { | 
                                                        |
| 4 | 4 | |
| 5 | 5 | global $ES;  | 
                                                        
| 6 | 6 | |
@@ -9,7 +9,7 @@ discard block  | 
                                                    ||
| 9 | 9 | $id = $args['id'];  | 
                                                        
| 10 | 10 | |
| 11 | 11 | $params = [];  | 
                                                        
| 12 | - $params['index']= $index;  | 
                                                        |
| 12 | + $params['index'] = $index;  | 
                                                        |
| 13 | 13 | $params['type'] = $type;  | 
                                                        
| 14 | 14 | $params['id'] = $id;  | 
                                                        
| 15 | 15 | $results = $ES->delete($params);  | 
                                                        
@@ -1,6 +1,6 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | |
| 3 | -$config =[  | 
                                                        |
| 3 | +$config = [  | 
                                                        |
| 4 | 4 | 'base_dir' => dirname(dirname(__DIR__)),  | 
                                                        
| 5 | 5 | 'base_url' => 'http://127.0.0.1:8080',  | 
                                                        
| 6 | 6 | 'app_name' => 'Elastico',  |