public function addToIndex()
    {
        if ($this->isEmpty()) {
            return null;
        }

        $params = array();

        foreach ($this->all() as $item) {
            $params['body'][] = array(
                'index' => array(
                    '_id' => $item->getKey(),
                    '_type' => $item->getTypeName(),
                    '_index' => $item->getIndexName(),
                ),
            );

            $params['body'][] = $item->getIndexDocumentData();
        }

        return $this->getElasticSearchClient()->bulk($params);
    }
public function addToIndex()
    {
        if ($this->isEmpty()) {
            return null;
        }

        $params = array();

        foreach ($this->all() as $item) {
            $params['body'][] = array(
                'index' => array(
                    '_id' => $item->getKey(),
                    '_type' => $item->getTypeName(),
                    '_index' => $item->getIndexName(),
                ),
            );

            $params['body'][] = $item->getIndexDocumentData();
        }

        return $this->getElasticSearchClient()->bulk($params);
    }
public function addToIndex ( ) { if ( $ this -> isEmpty ( ) ) { return null ; } $ params = array ( ) ; foreach ( $ this -> all ( ) as $ item ) { $ params [ 'body' ] [ ] = array ( 'index' => array ( '_id' => $ item -> getKey ( ) , '_type' => $ item -> getTypeName ( ) , '_index' => $ item -> getIndexName ( ) , ) , ) ; $ params [ 'body' ] [ ] = $ item -> getIndexDocumentData ( ) ; } return $ this -> getElasticSearchClient ( ) -> bulk ( $ params ) ; }
Add To Index

Add all documents in this collection to to the Elasticsearch document index.

@return null|array
Add To Index