Yet another "No Nodes Alive Exception" discussion

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?

Where is your PHP application running? It is running on another container on the same network?

What do you have you elasticsearch logs?

This seems more a docker issue than a Elasticsearch issue.

And now I get to feel silly! I had forgotten to include nginx on the network when I was shifting things around to correct another error. Thank you very much for the help, I was looking entirely in the wrong place due to all the other pages on the net pointing me elsewhere.

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