src/Console/ElasticMigrateCommand.php
protected function updateTargetIndexMapping()
    {
        $sourceModel = $this->getModel();
        $sourceIndexConfigurator = $sourceModel->getIndexConfigurator();

        $targetIndex = $this->argument('target-index');
        $targetType = $sourceModel->searchableAs();

        $mapping = array_merge_recursive(
            $sourceIndexConfigurator->getDefaultMapping(),
            $sourceModel->getMapping()
        );

        if (empty($mapping)) {
            $this->warn(sprintf(
                'The %s mapping is empty.',
                get_class($sourceModel)
            ));

            return;
        }

        $payload = (new RawPayload())
            ->set('index', $targetIndex)
            ->set('type', $targetType)
            ->set('body.'.$targetType, $mapping)
            ->get();

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

        $this->info(sprintf(
            'The %s mapping was updated.',
            $targetIndex
        ));
    }
protected function updateTargetIndexMapping()
    {
        $sourceModel = $this->getModel();
        $sourceIndexConfigurator = $sourceModel->getIndexConfigurator();

        $targetIndex = $this->argument('target-index');
        $targetType = $sourceModel->searchableAs();

        $mapping = array_merge_recursive(
            $sourceIndexConfigurator->getDefaultMapping(),
            $sourceModel->getMapping()
        );

        if (empty($mapping)) {
            $this->warn(sprintf(
                'The %s mapping is empty.',
                get_class($sourceModel)
            ));

            return;
        }

        $payload = (new RawPayload())
            ->set('index', $targetIndex)
            ->set('type', $targetType)
            ->set('body.'.$targetType, $mapping)
            ->get();

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

        $this->info(sprintf(
            'The %s mapping was updated.',
            $targetIndex
        ));
    }
protected function updateTargetIndexMapping ( ) { $ sourceModel = $ this -> getModel ( ) ; $ sourceIndexConfigurator = $ sourceModel -> getIndexConfigurator ( ) ; $ targetIndex = $ this -> argument ( 'target-index' ) ; $ targetType = $ sourceModel -> searchableAs ( ) ; $ mapping = array_merge_recursive ( $ sourceIndexConfigurator -> getDefaultMapping ( ) , $ sourceModel -> getMapping ( ) ) ; if ( empty ( $ mapping ) ) { $ this -> warn ( sprintf ( 'The %s mapping is empty.' , get_class ( $ sourceModel ) ) ) ; return ; } $ payload = ( new RawPayload ( ) ) -> set ( 'index' , $ targetIndex ) -> set ( 'type' , $ targetType ) -> set ( 'body.' . $ targetType , $ mapping ) -> get ( ) ; ElasticClient :: indices ( ) -> putMapping ( $ payload ) ; $ this -> info ( sprintf ( 'The %s mapping was updated.' , $ targetIndex ) ) ; }
Update the target index mapping.

@return void
Update the target index mapping .