/** * Convenience method to add a 'add documents' command. * * If you need more control, like choosing a key for the command you need to * create you own command instance and use the add method. * * @param array $documents * @param boolean $overwrite * @param int $commitWithin * * @return self Provides fluent interface */ public function addDocuments($documents, $overwrite = null, $commitWithin = null) { $add = new AddCommand(); if (null !== $overwrite) { $add->setOverwrite($overwrite); } if (null !== $commitWithin) { $add->setCommitWithin($commitWithin); } $add->addDocuments($documents); return $this->add(null, $add); }