Hello there! I'm new here, and I've come here for help. As the name implies, I'm getting a "No nodes alive" error in a simple, single node elasticsearch php application. I have researched the issue for hours, it apparently has something to do with using the wrong host, but I have tried every solution I have seen on the net and none works. So I give up, and leave it to far smarter people. Here's the code...
Init.php:
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Elasticsearch\ClientBuilder;
$es = Clientbuilder::create()->setHosts(['http://es01:9200'])->build();
Relevant docker compose bits:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.10
container_name: es01
environment:
- node.name=es01
- xpack.security.enabled=false
- discovery.type=single-node
- bootstrap.memory_lock=true
ports:
- "127.0.0.1:9200:9200"
networks:
- elastic
kib01:
image: docker.elastic.co/kibana/kibana:7.17.10
container_name: kib01
ports:
- "127.0.0.1:5601:5601"
volumes:
- ./www:/usr/share/tcc/kibana.yml
environment:
ELASTICSEARCH_HOSTS: http://es01:9200
depends_on:
- es01
networks:
- elastic
As you can see, not a complex use, but I tend to always run into the most extreme, obscure and obnoxious versions of every error ever. In the client builder, I have attempted localhost, 127.0.0.1 and es01, with and without http. I also only get the error when I actually attempt to perform a search, not when loading the page.
So, could anyone please help me sort this thing out?