Mahdi
Mahdi

Reputation: 223

haystack elasticsearch connection refused

When I run python manage.py rebuild_index I get the following error:

Failed to clear Elasticsearch index: HTTPConnectionPool(host='127.0.0.1', port=9200): Max retries exceeded with url: /haystack (Caused by : [Errno 111] Connection refused)

My elasticsearch setting:

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

It is worth to mention that I have indexed my data once before and all things went correct but I dont know why when came back to project and restarted django project it went wrong!

Thanks in advence

Upvotes: 4

Views: 3971

Answers (2)

jaywhy13
jaywhy13

Reputation: 1116

In my case this was solved by just increasing the default timeout of 10s to 60s.

HAYSTACK_CONNECTIONS = {
'default': {
    'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
    'URL': 'http://127.0.0.1:9200/',
    'INDEX_NAME': 'index_name',
    'TIMEOUT' : 60 
},

Upvotes: 2

jamesc
jamesc

Reputation: 6328

It looks like you've forgotten to start ElasticSearch when you've returned to the project because the local connection is refused.

If you installed from the .deb file, then it should be wired into Ubuntu's service command so you can start it with

$ sudo service elasticsearch start

If you used the tarball, make sure you start it with something like:

$ bin/elasticsearch

More information in Installation docs http://www.elasticsearch.org/guide/reference/setup/installation/

Upvotes: 6

Related Questions