Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't connect to host, Elasticsearch down? #2177

Open
murilolivorato opened this issue Jun 28, 2023 · 3 comments
Open

Couldn't connect to host, Elasticsearch down? #2177

murilolivorato opened this issue Jun 28, 2023 · 3 comments

Comments

@murilolivorato
Copy link

hello , I am using docker .
I havve to use the pssword to connect with elast search .
I do link this with -elasticsearch-php class

$client = ClientBuilder::create()->setHosts(['http://elasticsearch:9200'])->setBasicAuthentication('elastic', 'changeme')
            ->build();

but in this class , it is giving this error -

Couldn't connect to host, Elasticsearch down?

this is the code -

  $elastica = new ElasticaClient();
        $index = $elastica->getIndex('pets');
        $doggType = $index->getType('dog');

        dd($doggType->getMapping());

where could I add the host information ?
this one -

setHosts(['http://elasticsearch:9200'])->setBasicAuthentication('elastic', 'changeme')

@ruflin
Copy link
Owner

ruflin commented Jun 28, 2023

Can you reach your elasticsearch host with curl? Did you used by chance https and not http?

@akeebismail
Copy link

Can you reach your elasticsearch host with curl? Did you used by chance https and not http?

Yes, having same issue.
I was able to reach the host with curl

curl -XGET localhost:9200/
{
  "name" : "38506bccd3c1",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "i_xNEd1yQDqcdHipJAxPyw",
  "version" : {
    "number" : "7.16.2",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "2b937c44140b6559905130a8650c64dbd0879cfb",
    "build_date" : "2021-12-18T19:42:46.604893745Z",
    "build_snapshot" : false,
    "lucene_version" : "8.10.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

but I got Couldn't connect to host, Elasticsearch down through Elastica.

Please help.

@ruflin
Copy link
Owner

ruflin commented Feb 12, 2024

@akeebismail Can you share the Elastica code you are using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants