src/TweetNest.php
public function save()
    {   
        $result = null; 
        $i = 0;
        foreach (
            $iterator = new RecursiveIteratorIterator(
                new RecursiveDirectoryIterator(
                    $this->_dir, 
                    RecursiveDirectoryIterator::SKIP_DOTS
                ),
                RecursiveIteratorIterator::SELF_FIRST
            ) as $item
        ) {
            if (!$item->isDir()) { 
                $filename = $this->_dir . 
                            DIRECTORY_SEPARATOR . 
                            $iterator->getSubPathName(); 
                $_tweet = file_get_contents($filename); 
                $tweet = json_decode($_tweet, TRUE);  
                $params = ['index' => $this->_esindex,
                            'type' => $this->_estype,
                            'body' => $tweet];
                $result = $this->_es->index($params); 
                $i++;
            }
        }
        return $i;
    }
public function save()
    {   
        $result = null; 
        $i = 0;
        foreach (
            $iterator = new RecursiveIteratorIterator(
                new RecursiveDirectoryIterator(
                    $this->_dir, 
                    RecursiveDirectoryIterator::SKIP_DOTS
                ),
                RecursiveIteratorIterator::SELF_FIRST
            ) as $item
        ) {
            if (!$item->isDir()) { 
                $filename = $this->_dir . 
                            DIRECTORY_SEPARATOR . 
                            $iterator->getSubPathName(); 
                $_tweet = file_get_contents($filename); 
                $tweet = json_decode($_tweet, TRUE);  
                $params = ['index' => $this->_esindex,
                            'type' => $this->_estype,
                            'body' => $tweet];
                $result = $this->_es->index($params); 
                $i++;
            }
        }
        return $i;
    }
public function save ( ) { $ result = null ; $ i = 0 ; foreach ( $ iterator = new RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ this -> _dir , RecursiveDirectoryIterator :: SKIP_DOTS ) , RecursiveIteratorIterator :: SELF_FIRST ) as $ item ) { if ( ! $ item -> isDir ( ) ) { $ filename = $ this -> _dir . DIRECTORY_SEPARATOR . $ iterator -> getSubPathName ( ) ; $ _tweet = file_get_contents ( $ filename ) ; $ tweet = json_decode ( $ _tweet , TRUE ) ; $ params = [ 'index' => $ this -> _esindex , 'type' => $ this -> _estype , 'body' => $ tweet ] ; $ result = $ this -> _es -> index ( $ params ) ; $ i ++ ; } } return $ i ; }
Save tweets in elasticsearch

@return int
Save tweets in elasticsearch