예제 #1
0
 /**
  * Insert a document into elasticsearch.
  *
  * @param  array  $payload
  * @return mixed
  */
 public function insert(array $payload)
 {
     if (!$this->indexIsDefined()) {
         throw new IndexMustBeDefinedException("To index a document, index must be definded", 1);
     }
     if (!$this->typeIsDefined()) {
         throw new TypeMustBeDefinedException("To index a document, type must be defined", 1);
     }
     $compiled = $this->grammar->compileInsert($this, $payload);
     return $this->processor->processInsert($this, $this->connection->documentInsert($compiled));
 }