public function find($className, $id, $routing = null)
    {
        $type = $this->resolveTypeName($className);

        $params = [
            'index' => $this->getIndexName(),
            'type' => $type,
            'id' => $id,
        ];

        if ($routing) {
            $params['routing'] = $routing;
        }

        try {
            $result = $this->getClient()->get($params);
        } catch (Missing404Exception $e) {
            return null;
        }

        return $this->getConverter()->convertToDocument($result, $this);
    }
public function find($className, $id, $routing = null)
    {
        $type = $this->resolveTypeName($className);

        $params = [
            'index' => $this->getIndexName(),
            'type' => $type,
            'id' => $id,
        ];

        if ($routing) {
            $params['routing'] = $routing;
        }

        try {
            $result = $this->getClient()->get($params);
        } catch (Missing404Exception $e) {
            return null;
        }

        return $this->getConverter()->convertToDocument($result, $this);
    }
public function find ( $ className , $ id , $ routing = null ) { $ type = $ this -> resolveTypeName ( $ className ) ; $ params = [ 'index' => $ this -> getIndexName ( ) , 'type' => $ type , 'id' => $ id , ] ; if ( $ routing ) { $ params [ 'routing' ] = $ routing ; } try { $ result = $ this -> getClient ( ) -> get ( $ params ) ; } catch ( Missing404Exception $ e ) { return null ; } return $ this -> getConverter ( ) -> convertToDocument ( $ result , $ this ) ; }
Returns a single document by ID. Returns NULL if document was not found.

@param string $className Document class name or Elasticsearch type name
@param string $id        Document ID to find
@param string $routing   Custom routing for the document

@return object
Returns a single document by ID . Returns NULL if document was not found .