/**
* Create the mapping for the type.
*
* @param \Cake\ElasticSearch\Datasource\Connection $db The Elasticsearch
* connection
* @return void
*/
public function create(Connection $db)
{
if (empty($this->schema)) {
return;
}
$index = $db->getIndex();
if (!$index->exists()) {
$index->create();
}
$type = $index->getType($this->table);
$mapping = new ElasticaMapping();
$mapping->setType($type);
$mapping->setProperties($this->schema);
$mapping->send();
$this->created[] = $db->configName();
}