public function importIndex(
        Manager $manager,
        $filename,
        OutputInterface $output,
        $options
    ) {
        $reader = $this->getReader($manager, $this->getFilePath($filename), $options);

        $progress = new ProgressBar($output, $reader->count());
        $progress->setRedrawFrequency(100);
        $progress->start();

        $bulkSize = $options['bulk-size'];
        foreach ($reader as $key => $document) {
            $data = $document['_source'];
            $data['_id'] = $document['_id'];

            if (array_key_exists('fields', $document)) {
                $data = array_merge($document['fields'], $data);
            }

            $manager->bulk('index', $document['_type'], $data);

            if (($key + 1) % $bulkSize == 0) {
                $manager->commit();
            }

            $progress->advance();
        }

        $manager->commit();

        $progress->finish();
        $output->writeln('');
    }
public function importIndex(
        Manager $manager,
        $filename,
        OutputInterface $output,
        $options
    ) {
        $reader = $this->getReader($manager, $this->getFilePath($filename), $options);

        $progress = new ProgressBar($output, $reader->count());
        $progress->setRedrawFrequency(100);
        $progress->start();

        $bulkSize = $options['bulk-size'];
        foreach ($reader as $key => $document) {
            $data = $document['_source'];
            $data['_id'] = $document['_id'];

            if (array_key_exists('fields', $document)) {
                $data = array_merge($document['fields'], $data);
            }

            $manager->bulk('index', $document['_type'], $data);

            if (($key + 1) % $bulkSize == 0) {
                $manager->commit();
            }

            $progress->advance();
        }

        $manager->commit();

        $progress->finish();
        $output->writeln('');
    }
public function importIndex ( Manager $ manager , $ filename , OutputInterface $ output , $ options ) { $ reader = $ this -> getReader ( $ manager , $ this -> getFilePath ( $ filename ) , $ options ) ; $ progress = new ProgressBar ( $ output , $ reader -> count ( ) ) ; $ progress -> setRedrawFrequency ( 100 ) ; $ progress -> start ( ) ; $ bulkSize = $ options [ 'bulk-size' ] ; foreach ( $ reader as $ key => $ document ) { $ data = $ document [ '_source' ] ; $ data [ '_id' ] = $ document [ '_id' ] ; if ( array_key_exists ( 'fields' , $ document ) ) { $ data = array_merge ( $ document [ 'fields' ] , $ data ) ; } $ manager -> bulk ( 'index' , $ document [ '_type' ] , $ data ) ; if ( ( $ key + 1 ) % $ bulkSize == 0 ) { $ manager -> commit ( ) ; } $ progress -> advance ( ) ; } $ manager -> commit ( ) ; $ progress -> finish ( ) ; $ output -> writeln ( '' ) ; }
Imports Elasticsearch index data.

@param Manager         $manager
@param string          $filename
@param OutputInterface $output
@param array           $options
Imports Elasticsearch index data .