testConnection(); if ($open[0]) { $this->info($open[1]); } else { $this->error($open[1]); return 1; // Exit with error code } // Attempt to create or update index $this->warn('Index already exists, attempting to update...'); try { $update = $openSearch->updateIndex(); if (!empty($update['settings']) && $update['settings']['acknowledged']) { $this->info('Index settings updated successfully'); } if (!empty($update['mappings']) && $update['mappings']['acknowledged']) { $this->info('Index mappings updated successfully'); } if (empty($update['settings']) && empty($update['mappings'])) { $this->warn('No settings or mappings provided for update'); } } catch (\Exception $updateException) { $this->error('Failed to update index: ' . $updateException->getMessage()); return 1; } return 0; } }