Rather than preventing the Exception from being thrown, one way would be to simply deal with it with a "Try, throw and catch" block like this:
try {
$docPre = $elasticaType->getDocument(1);
} catch (Exception $e) {
$docPre = NULL;
}
if ($docPre != NULL) {
//do some stuff...
} else {
//do something else...
}