Closed
Description
Summary of problem or feature request
When document with specified id is not found there is an php exception inside Transport.php
vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php:127
Cannot use object of type Elasticsearch\Common\Exceptions\Missing404Exception as array
vendor/react/promise/src/RejectedPromise.php:28
$this->reason =
Elasticsearch\Common\Exceptions\Missing404Exception Object
(
[message:protected] => {"_index":"myindex","_type":"_doc","_id":"1","found":false}
[string:Exception:private] =>
[code:protected] => 404
[file:protected] => /home/myuser/www/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php
[line:protected] => 633
[trace:Exception:private] => Array
*RECURSION*
[previous:Exception:private] =>
)
This is the problem, you use object as array:
vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php:127
if (!(isset($response['code']) && $response['code'] >=400 && $response['code'] < 500)) {
Code snippet of problem
$client is \Elasticsearch\Client
$client->get([1, 'myindex'])
System details
PHP 7.4.9
Ubuntu 20.04
Elastic 7.8.0
elasticsearch/elasticsearch v7.9.0
ezimuel/ringphp 1.1.2
ezimuel/guzzlestreams 3.0.1
react/promise v2.8.0