Unable to Connect with elastic cloud

Uncaught Elastic\Transport\Exception\NoNodeAvailableException: No alive nodes. All the 1 nodes seem to be down.

My php client is hosted at 000webhost and i am creating client with api key and cloud id but it is throwing this error

Hi @Mohd_Ahmad Welcome to the Community and Thanks for Trying Elastic Cloud.

  1. Is your Elastic Cloud Deployment Healthy / Green Yes / No

  1. Can you curl your elastic Cloud From the Server where the PHP is running

curl -u elastic:password https://mydeployment1235.es.us-west1.gcp.cloud.es.io

  1. iI that work then You need to share your PHP code

First of all thank you for your warm welcome.

  1. Yes my elastic cloud deployment is healthy
  2. I am using 000webhost which is free to host a php website so i don't have a terminal so i tried this code to run as index.php :
<?php echo 'welcome'; require_once '../phpelasticsearch/vendor/autoload.php'; // assuming Guzzle is installed via Composer use GuzzleHttp\Client; $client = new Client([ 'base_uri' => 'https://sma-sjmc.es.asia-south1.gcp.elastic-cloud.com', 'auth' => ['elastic', '##########################'] ]); $response = $client->get('/'); echo $response->getBody(); ?>

And getting this error:

have a look: I had tried to curl using my local machine terminal and it is responding.
I am even able to connect by the php client in my local machine

Apologies I know nothing about your hosting env... Nor the other tool guzzle...

The guzzle does not look like it is executing the curl correctly.

Your cluster appears healthy I think you may need to visit the forums about those tools.

Or you could try PHP on your local machine to test. Then translate up to.your hosting

Actually i had tried in my local to connect my elastic cloud and it is working fine but when i am hosting my php client it is not working and giving the error i have posted earlier

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.