haystack elasticsearch连接拒绝

Mah*_*hdi 4 django django-haystack elasticsearch

当我运行时,python manage.py rebuild_index我收到以下错误:

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',
>      },  }
Run Code Online (Sandbox Code Playgroud)

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

jam*_*esc 6

当您返回项目时,您似乎忘记启动ElasticSearch,因为本地连接被拒绝.

如果你从.deb文件安装,那么它应该连接到Ubuntu的service命令,所以你可以启动它

$ sudo service elasticsearch start
Run Code Online (Sandbox Code Playgroud)

如果您使用了tarball,请确保使用以下内容启动它:

$ bin/elasticsearch
Run Code Online (Sandbox Code Playgroud)

安装文档中的更多信息http://www.elasticsearch.org/guide/reference/setup/installation/