Seldaek/monolog · error · LogicException

Unsupported elastic search client version

Error message

Unsupported elastic search client version

What it means

Error "Unsupported elastic search client version" thrown in Seldaek/monolog.

Source

Thrown at src/Monolog/Handler/ElasticsearchHandler.php:216

     * @param mixed[]|Elasticsearch $responses returned by $this->client->bulk()
     */
    protected function createExceptionFromResponses($responses): Throwable
    {
        foreach ($responses['items'] ?? [] as $item) {
            if (isset($item['index']['error'])) {
                return $this->createExceptionFromError($item['index']['error']);
            }
        }

        if (class_exists(ElasticInvalidArgumentException::class)) {
            return new ElasticInvalidArgumentException('Elasticsearch failed to index one or more records.');
        }

        if (class_exists(ElasticsearchRuntimeException::class)) {
            return new ElasticsearchRuntimeException('Elasticsearch failed to index one or more records.');
        }

        throw new \LogicException('Unsupported elastic search client version');
    }

    /**
     * Creates elasticsearch exception from error array
     *
     * @param mixed[] $error
     */
    protected function createExceptionFromError(array $error): Throwable
    {
        $previous = isset($error['caused_by']) ? $this->createExceptionFromError($error['caused_by']) : null;

        if (class_exists(ElasticInvalidArgumentException::class)) {
            return new ElasticInvalidArgumentException($error['type'] . ': ' . $error['reason'], 0, $previous);
        }

        if (class_exists(ElasticsearchRuntimeException::class)) {
            return new ElasticsearchRuntimeException($error['type'].': '.$error['reason'], 0, $previous);
        }

View on GitHub (pinned to 57eb102834)

When it happens

Trigger: Thrown at src/Monolog/Handler/ElasticsearchHandler.php:216 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Seldaek/monolog@57eb102834 (2026-08-17). Data as JSON: /api/errors/39f479b9ca7cecba. Report an issue: GitHub.