Skip to content

Commit

Permalink
update command names
Browse files Browse the repository at this point in the history
  • Loading branch information
basemkhirat committed Feb 24, 2017
1 parent 2540450 commit 4fa9125
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 28 deletions.
36 changes: 20 additions & 16 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,54 +181,58 @@ These are all available commands:
##### List All indices on server.

```
php artisan es:indices
php artisan es:indices:list
+--------+--------+----------+------------------------+-----+-----+------------+--------------+------------+----------------+
| health | status | index | uuid | pri | rep | docs.count | docs.deleted | store.size | pri.store.size |
+--------+--------+----------+------------------------+-----+-----+------------+--------------+------------+----------------+
| green | open | my_index | 5URW60KJQNionAJgL6Q2TQ | 1 | 0 | 0 | 0 | 260b | 260b |
+--------+--------+----------+------------------------+-----+-----+------------+--------------+------------+----------------+
+----------------------+--------+--------+----------+------------------------+-----+-----+------------+--------------+------------+----------------+
| configured (es.php) | health | status | index | uuid | pri | rep | docs.count | docs.deleted | store.size | pri.store.size |
+----------------------+--------+--------+----------+------------------------+-----+-----+------------+--------------+------------+----------------+
| yes | green | open | my_index | 5URW60KJQNionAJgL6Q2TQ | 1 | 0 | 0 | 0 | 260b | 260b |
+----------------------+--------+--------+----------+------------------------+-----+-----+------------+--------------+------------+----------------+
```

##### Create a new index using defined settings and mapping in `es.php` config file.
##### Create indices defined in `es.php` config file.

Note that creating operation skips the index if exists.

```
# Create all indices in config file.
php artisan es:index:create
php artisan es:indices:create
# Create only 'my_index' index in config file
php artisan es:index:create my_index
php artisan es:indices:create my_index
```

##### Update index using defined settings and mapping in `es.php` config file.
##### Update indices defined in `es.php` config file.

Note that updating operation recreates the index if exists.

```
# Update all indices in config file.
php artisan es:index:update
php artisan es:indices:update
# Update only 'my_index' index in config file
php artisan es:index:update my_index
php artisan es:indices:update my_index
```

##### Drop index.

Running Drop command with `--force` option will skip all confirmation messages.
Running drop command with `--force` option will skip all confirmation messages.

```
# Drop all indices in config file.
php artisan es:index:drop
php artisan es:indices:drop
# Drop specific index on sever. Not matter to be in config file.
# Drop specific index on sever. Not matter to be exist in config file.
php artisan es:index:drop my_index
php artisan es:indices:drop my_index
```

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/CreateIndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CreateIndexCommand extends Command
*
* @var string
*/
protected $signature = 'es:index:create {index?}{--connection= : Elasticsearch connection}';
protected $signature = 'es:indices:create {index?}{--connection= : Elasticsearch connection}';

/**
* The console command description.
Expand Down
5 changes: 1 addition & 4 deletions src/Commands/DropIndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class DropIndexCommand extends Command
*
* @var string
*/
protected $signature = 'es:index:drop {index?}
protected $signature = 'es:indices:drop {index?}
{--connection= : Elasticsearch connection}
{--force : Drop indices without any confirmation messages}';

Expand Down Expand Up @@ -47,11 +47,8 @@ public function handle()
continue;
}


if($force or $this->confirm("Are you sure to drop \"$index\" index")) {

// Create index with settings from config file

$this->info("Dropping index: {$index}");

$client->indices()->delete(['index' => $index]);
Expand Down
12 changes: 8 additions & 4 deletions src/Commands/ListIndicesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ListIndicesCommand extends Command
*
* @var string
*/
protected $signature = 'es:indices {--connection= : Elasticsearch connection}';
protected $signature = 'es:indices:list {--connection= : Elasticsearch connection}';

/**
* The console command description.
Expand All @@ -26,7 +26,7 @@ class ListIndicesCommand extends Command
* Indices headers
* @var array
*/
protected $headers = ["health", "status", "index", "uuid", "pri", "rep", "docs.count", "docs.deleted", "store.size", "pri.store.size"];
protected $headers = ["configured (es.php)", "health", "status", "index", "uuid", "pri", "rep", "docs.count", "docs.deleted", "store.size", "pri.store.size"];


/**
Expand Down Expand Up @@ -73,13 +73,17 @@ function getIndices($indices){
foreach ($line_array as $item){

if(trim($item) != ""){

$row[] = $item;

}

}

if(in_array($row[2], array_keys(config("es.indices")))){
$row = array_prepend($row, "yes");
}else{
$row = array_prepend($row, "no");
}

$data[] = $row;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Commands/UpdateIndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class UpdateIndexCommand extends Command
*
* @var string
*/
protected $signature = 'es:index:update {index?}{--connection= : Elasticsearch connection}';
protected $signature = 'es:indices:update {index?}{--connection= : Elasticsearch connection}';

/**
* The console command description.
Expand Down Expand Up @@ -52,7 +52,7 @@ public function handle()

$this->warn("Index \"{$index}\" exists, dropping!");

$this->call("es:index:drop", [
$this->call("es:indices:drop", [
"index" => $index,
"--force" => true
]);
Expand All @@ -61,7 +61,7 @@ public function handle()

// Create index with settings from config file

$this->call("es:index:create", [
$this->call("es:indices:create", [
"index" => $index
]);

Expand Down

0 comments on commit 4fa9125

Please sign in to comment.