Answer the question
In order to leave comments, you need to log in
I can't connect to elasticsearch using docker, what could be the reason?
With these options, I can not create a connection to the database: localhost, 0.0.0.0, simpledocker2_elastics
In Http.php line 187:
<i>Couldn't connect to host, Elasticsearch down?</i>
ERROR [elastica] Elastica Request Failure ["exception" => Elastica\Exception\Connection\HttpException { …},"request" => ["path" => "app","method" => "DELETE","data" => [],"query" => [],"contentType" => "application/json","connection" => ["config" => ["headers" => [],"curl" => []],"host" => "0.0.0.0","port" => 9200,"ssl" => false,"logger" => "fos_elastica.logger","compression" => false,"retryOnConflict" => 0,"enabled" => false]],"retry" => false]
fos_elastica:
clients:
default: { host: 0.0.0.0, port: 9200}
Answer the question
In order to leave comments, you need to log in
Add links to php-fpm in docker-compose.yml and connect to:
$hosts = [
'elasticsearch'
];
$client = ClientBuilder::create()->setHosts($hosts)->build();
What is the second config? 0.0.0.0 - the host is specified only in the elastic server parameters so that it "listens" to all addresses, and not to any specific one. In the client, you must specify EITHER the IP address of the elastic (host or container), OR the name of the container (service) - if the elastic is running in the
localhost container and 127.0.0.1 for the container, this is, quite logically, the same container. In which NATURALLY elastic is not running. So it's pointless to do so. But there is an exception - when containers are launched without network isolation ( --net host
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question