Skip to content

Commit e55da77

Browse files
committed
Elasticsearch no longer supports deleting maps
1 parent 5a6e299 commit e55da77

File tree

1 file changed

+10
-28
lines changed

1 file changed

+10
-28
lines changed

src/Console/MapCommand.php

+10-28
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class MapCommand extends AbstractCommand
1010
* @var string
1111
*/
1212
protected $signature = 'hunt:map
13-
{action : Mapping action to perform (add or remove)}
14-
{model : Name or comma separated names of the model(s) to initialize}';
13+
{model : Name or comma separated names of the model(s) to initialize}
14+
{--l|locales= : Single or comma separated locales}';
1515

1616
/**
1717
* The console command description.
@@ -25,21 +25,23 @@ class MapCommand extends AbstractCommand
2525
*/
2626
public function handle()
2727
{
28-
$action = $this->getActionArgument(['add', 'remove']);
28+
// Process any locales
29+
if (empty($locales = $this->getLocales()) === false) {
30+
foreach ($locales as $locale) {
31+
$this->setSystemLocale($locale);
2932

30-
foreach ($this->getModelArgument() as $model) {
31-
if ($model = $this->validateModel("\\App\\{$model}")) {
32-
$this->$action($model);
33+
$this->processModels('add');
3334
}
3435
}
36+
else {
37+
$this->processModels('add');
38+
}
3539
}
3640

3741
/**
3842
* Add ElasticSearch model mapping.
3943
*
4044
* @param string $model
41-
*
42-
* @return bool
4345
*/
4446
protected function add($model)
4547
{
@@ -53,24 +55,4 @@ protected function add($model)
5355

5456
$this->output->writeln("<info>success</info>");
5557
}
56-
57-
/**
58-
* Remove ElasticSearch model mapping.
59-
*
60-
* @param string $model
61-
*
62-
* @return bool
63-
*/
64-
protected function remove($model)
65-
{
66-
if ($this->hunter->typeExists($model) === false) {
67-
return $this->error("[{$model}] not mapped");
68-
}
69-
70-
$this->output->write("Removing [{$model}] map...");
71-
72-
$this->hunter->deleteMapping($model);
73-
74-
$this->output->writeln("<info>success</info>");
75-
}
7658
}

0 commit comments

Comments
 (0)