{"record":{"id":"540b105314367539","repo":"Seldaek/monolog","slug":"error-sending-messages-to-elasticsearch","errorCode":null,"errorMessage":"Error sending messages to Elasticsearch","messagePattern":"Error sending messages to Elasticsearch","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Monolog/Handler/ElasticsearchHandler.php","lineNumber":188,"sourceCode":"                        '_type'  => $record['_type'],\n                    ] : [\n                        '_index' => $record['_index'],\n                    ],\n                ];\n                unset($record['_index'], $record['_type']);\n\n                $params['body'][] = $record;\n            }\n\n            /** @var Elasticsearch */\n            $responses = $this->client->bulk($params);\n\n            if ($responses['errors'] === true) {\n                throw $this->createExceptionFromResponses($responses);\n            }\n        } catch (Throwable $e) {\n            if (! $this->options['ignore_error']) {\n                throw new RuntimeException('Error sending messages to Elasticsearch', 0, $e);\n            }\n        }\n    }\n\n    /**\n     * Creates elasticsearch exception from responses array\n     *\n     * Only the first error is converted into an exception.\n     *\n     * @param mixed[]|Elasticsearch $responses returned by $this->client->bulk()\n     */\n    protected function createExceptionFromResponses($responses): Throwable\n    {\n        foreach ($responses['items'] ?? [] as $item) {\n            if (isset($item['index']['error'])) {\n                return $this->createExceptionFromError($item['index']['error']);\n            }\n        }","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/Seldaek/monolog/blob/57eb1028342134e701e77c617565d51b6e5a2a53/src/Monolog/Handler/ElasticsearchHandler.php#L170-L206","documentation":"Error \"Error sending messages to Elasticsearch\" thrown in Seldaek/monolog.","triggerScenarios":"Thrown at src/Monolog/Handler/ElasticsearchHandler.php:188 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"57eb1028342134e701e77c617565d51b6e5a2a53","analyzedAt":"2026-08-17T02:36:30.259Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}