src/Marshaler/Elastica/DocumentMarshaler.php
public function marshal(Message $message, Document $document = null)
    {
        $document = $document ?: new Document();
        return $document->setData($this->doMarshal($message));
    }
public function marshal(Message $message, Document $document = null)
    {
        $document = $document ?: new Document();
        return $document->setData($this->doMarshal($message));
    }
@param Message  $message
@param Document $document

@return Document

@throws \Exception
@throws GdbotsPbjException