src/Managers/DocumentManager.php
/**
     * Create Elasticsearch documents for multiple item.
     *
     * @param \iterable $items.
     * @return array Empty array for empty items, Elasticsearch response otherwise.
     * @throws InvalidArgumentException When items belong to different indices.
     */
Create Elasticsearch documents for multiple item.
@param \iterable $items.
@return array Empty array for empty items, Elasticsearch response otherwise.
@throws InvalidArgumentException When items belong to different indices.
Create Elasticsearch documents for multiple item . @param \ iterable $items . @return array Empty array for empty items Elasticsearch response otherwise . @throws InvalidArgumentException When items belong to different indices .
public function bulkCreate($items)
    {
        $indexName = null;
        foreach ($items as $item) {
            $indexName = $this->getIndexName($item);
            break;
        }
        if (!is_null($indexName)) {
            $documents = $this->toDocuments($items);
            return $this->manager->bulkIndex(
                $indexName,
                self::TYPE,
                $documents
            );
        }
        return [];
    }
public function bulkCreate ( $ items ) { $ indexName = null ; foreach ( $ items as $ item ) { $ indexName = $ this -> getIndexName ( $ item ) ; break ; } if ( ! is_null ( $ indexName ) ) { $ documents = $ this -> toDocuments ( $ items ) ; return $ this -> manager -> bulkIndex ( $ indexName , self :: TYPE , $ documents ) ; } return [ ] ; }
Create Elasticsearch documents for multiple item.
Create Elasticsearch documents for multiple item .
// Get index name from first item.