/** * @param \Elastica\Bulk\Response $response * @return string */ public function getErrorMessage(Response $response) { $error = $response->getError(); $opType = $response->getOpType(); $data = $response->getData(); $path = ''; if (isset($data['_index'])) { $path .= '/' . $data['_index']; } if (isset($data['_type'])) { $path .= '/' . $data['_type']; } if (isset($data['_id'])) { $path .= '/' . $data['_id']; } $message = "{$opType}: {$path} caused {$error}"; return $message; }