/**
* @param string $typeName
* @return \Elastica\Type
* @throws \Exception
*/
protected function deleteMapping($typeName)
{
$type = new Elastica\Type($this->index, $typeName);
if ($type->exists()) {
try {
$type->delete();
} catch (\Exception $e) {
throw new \Exception('Could not delete type ' . $type->getName() . '');
}
}
$type = new Elastica\Type($this->index, $typeName);
return $type;
}