public function addToIndex()
{
if (!$this->exists) {
throw new Exception('Document does not exist.');
}
$params = $this->getBasicEsParams();
// Get our document body data.
$params['body'] = $this->getIndexDocumentData();
// The id for the document must always mirror the
// key for this model, even if it is set to something
// other than an auto-incrementing value. That way we
// can do things like remove the document from
// the index, or get the document from the index.
$params['id'] = $this->getKey();
return $this->getElasticSearchClient()->index($params);
}