src/Console/CreateIndexCommand.php
/**
	 * Execute the console command.
	 *
	 * @return mixed
	 */
Execute the console command.
@return mixed
Execute the console command . @return mixed
public function handle()
	{
		$indexName = $this->argument('index');
		if (!$this->indicesManager->isRegistered($indexName)) {
			$this->error('The index "'.$indexName.'" is not registered in Elasticsearcher"');
			return 1;
		}
		if ($this->indicesManager->exists($indexName)) {
			if ($this->option('f')) {
				$this->indicesManager->delete($indexName);
				$this->info('The index "'.$indexName.'" existed and was dropped.');
			} else {
				$this->error('The index "'.$indexName.'" already exists. Use --f if you want to drop and create.');
				return 1;
			}
		}
		$this->indicesManager->create($indexName);
		$this->info('The index "'.$indexName.'" was created.');
		return 0;
	}
public function handle ( ) { $ indexName = $ this -> argument ( 'index' ) ; if ( ! $ this -> indicesManager -> isRegistered ( $ indexName ) ) { $ this -> error ( 'The index "' . $ indexName . '" is not registered in Elasticsearcher"' ) ; return 1 ; } if ( $ this -> indicesManager -> exists ( $ indexName ) ) { if ( $ this -> option ( 'f' ) ) { $ this -> indicesManager -> delete ( $ indexName ) ; $ this -> info ( 'The index "' . $ indexName . '" existed and was dropped.' ) ; } else { $ this -> error ( 'The index "' . $ indexName . '" already exists. Use --f if you want to drop and create.' ) ; return 1 ; } } $ this -> indicesManager -> create ( $ indexName ) ; $ this -> info ( 'The index "' . $ indexName . '" was created.' ) ; return 0 ; }
Execute the console command.
Execute the console command .