src/Console/ElasticMigrateCommand.php
protected function createTargetIndex()
    {
        $targetIndex = $this->argument('target-index');

        $sourceIndexConfigurator = $this->getModel()
            ->getIndexConfigurator();

        $payload = (new RawPayload())
            ->set('index', $targetIndex)
            ->setIfNotEmpty('body.settings', $sourceIndexConfigurator->getSettings())
            ->setIfNotEmpty('body.mappings._default_', $sourceIndexConfigurator->getDefaultMapping())
            ->get();

        ElasticClient::indices()
            ->create($payload);

        $this->info(sprintf(
            'The %s index was created.',
            $targetIndex
        ));
    }
protected function createTargetIndex()
    {
        $targetIndex = $this->argument('target-index');

        $sourceIndexConfigurator = $this->getModel()
            ->getIndexConfigurator();

        $payload = (new RawPayload())
            ->set('index', $targetIndex)
            ->setIfNotEmpty('body.settings', $sourceIndexConfigurator->getSettings())
            ->setIfNotEmpty('body.mappings._default_', $sourceIndexConfigurator->getDefaultMapping())
            ->get();

        ElasticClient::indices()
            ->create($payload);

        $this->info(sprintf(
            'The %s index was created.',
            $targetIndex
        ));
    }
protected function createTargetIndex ( ) { $ targetIndex = $ this -> argument ( 'target-index' ) ; $ sourceIndexConfigurator = $ this -> getModel ( ) -> getIndexConfigurator ( ) ; $ payload = ( new RawPayload ( ) ) -> set ( 'index' , $ targetIndex ) -> setIfNotEmpty ( 'body.settings' , $ sourceIndexConfigurator -> getSettings ( ) ) -> setIfNotEmpty ( 'body.mappings._default_' , $ sourceIndexConfigurator -> getDefaultMapping ( ) ) -> get ( ) ; ElasticClient :: indices ( ) -> create ( $ payload ) ; $ this -> info ( sprintf ( 'The %s index was created.' , $ targetIndex ) ) ; }
Create a target index.

@return void
Create a target index .