You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the current version requires PHP 7.2 or something, so you could just use a union on all of those types or even just catch ElasticsearchException instead.
If there's a workaround for this for the time being, I'd love to hear it.
@joshua-bn I'm so sorry for the delay of my answer. If you want to know more about the ping result you can read the lastConnection from the client transport, as follows:
try {
$result = $client->ping();
} catch (NoNodesAvailableException$e) {
// no nodes available (ES is offline?)
}
$conn = $client->transport->getLastConnection();
$response = $conn->getLastRequestInfo()['response'];
print_r($response['status']); // HTTP status codeprint_r($response['headers']); // HTTP headersprint_r($response['body']); // HTTP response bodyprint_r($response['curl']['error']); // specific error message from cURL
We are working on the next 8.x version of the client and we will use the elastic/transport library that is PSR-7 and PSR-18 compliant. This means, you will be able to introspect the PSR-7 response on each endpoint result, using an approach like the one that we provided for elastic/enterprise-search-phphere.
Let me know if you need more information and sorry again for having miss this issue.
Summary of problem or feature request
Ping currently returns a boolean after swallowing the exceptions. I'd like to know why it failed so I can log that and take appropriate actions.
Code snippet of problem
Instead of this
I want this:
Then, to save code, you can have
ping()
wrappingCheck()
(or whatever name).ping()
would just catch the exceptions frompingCheck()
:System details
The text was updated successfully, but these errors were encountered: