/** * Get a document from elasticsearch. * * @param array $payload * @return mixed */ public function get() { if (!$this->indexIsDefined()) { throw new IndexMustBeDefinedException("To get a document, index must be definded", 1); } if (!$this->typeIsDefined()) { throw new TypeMustBeDefinedException("To get a document, type must be defined", 1); } $compiled = $this->grammar->compileGet($this); try { return $this->processor->processGet($this, $this->connection->documentGet($compiled)); } catch (Missing404Exception $e) { return null; } }