elasticsearch exceptions ConnectionError elasticsearch exceptions ConnectionError elasticsearch elasticsearch

elasticsearch exceptions ConnectionError


Connection refused means just that, that the TCP connection to the Elasticsearch HTTP service was refused. The reason can be a number of things, for instance that you are using the wrong host or port for the HTTP endpoint, or that the elasticsearch node is not running for some reason.

Before you try to use Haystack, test that elasticsearch works by issuing a direct HTTP request with something like:

curl -X GET http://192.168.77.88:9200/_cat/indices

Where 192.168.77.88 is the IP address of your elasticsearch node, and 9200 is the TCP port. When that succeeds, check and double check that you have the same URL configuration in you Haystack config.

HAYSTACK_CONNECTIONS = {    'default': {        'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',        'URL': 'http://192.168.77.88:9200/',        'INDEX_NAME': 'haystack',    },}


I had the same problem. Just got it resolved by actually running the Elasticsearch on port 9200. If you are on windows, goto the bin directory of Elasticsearch installation and run the batch file of whichever Elasticsearch version you are using.