user1328021
user1328021

Reputation: 9810

Setting up elasticsearch with Haystack

I used to be using Whoosh as a search backend but now I'm switching to elasticsearch and trying to get things working.

When trying to rebuild the index I get the error:

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8000): Max retries exceeded with url: /_bulk?op_type=create (Caused by <class 'socket.error'>: [Errno 61] Connection refused)

The following is in my settings.py:

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

My question is, what is URL used for and what do I put here? I'm running things locally for development and I'm deployed on Heroku.

Upvotes: 1

Views: 1916

Answers (1)

toto_tico
toto_tico

Reputation: 19027

The port should be 9200.

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

Also, you have to be sure that you are using the development version (2.0) of haystack.


Edit:

You probably want to make sure first that ElasticSearch is running by executing the following command:

curl -XGET 'http://127.0.0.1:9200/my_index/_mapping?pretty=1'

Upvotes: 4

Related Questions