php - No alive nodes. All the 1 nodes seem to be down

one text

I am trying to use Elasticsearch 8.1 using laravel. My elasticsearch instance is running at port 9200. https://localhost:9200 returns me

{
  "name" : "node-1",
  "cluster_name" : "my-application",
  "cluster_uuid" : "7wIGGqhBS5OXfV0E4J53GQ",
  "version" : {
    "number" : "8.0.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "801d9ccc7c2ee0f2cb121bbe22ab5af77a902372",
    "build_date" : "2022-02-24T13:55:40.601285296Z",
    "build_snapshot" : false,
    "lucene_version" : "9.0.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

Inside Laravel, I have following lines of code.

$hosts = [
    'http://127.0.0.1:9200',
];
$client = ClientBuilder::create()
    ->setSSLVerification(false)
    ->setHosts($hosts)
    ->build();

$params = [
    'index' => 'sample_index',
    'id' => 'sample_id',
    'body' => [
        'name' => 'Sample Product',
        'description' => 'My description...',
        'price' => '3400',
        'stock' => '150',
    ]
];
$response = $client->index($params);
dump($response);

The $response I get is No alive nodes. All the 1 nodes seem to be down. From the dump command above this is request made which is not requesting 9200 (not sure if this is correct or not).

Request made to elastic

Source