I installed elasticsearch with docker. I can use Elasticsearch on the browser as localhost:9200. I need to use Elasticsearch with php so i used elasticsearch/elasticsearch-php package on my project and when i try to connect Elasticsearch i usually get that error : No alive nodes found in your cluster on line 64.
There are a lots of documents about this error but no document didn't work. Maybe i couldn't. I tried some host like that :
"http://localhost:9200/", "localhost", "docker_elastic_1:9200"
But these hosts are couldn't work.
Can you please help me about this error ?
My code :
$client = \Elasticsearch\ClientBuilder::create()->build();
$params = [
'index' => 'my_index',
];
$response = $client->indices()->create($params);
print_r($response);
