pythondjangodjango-haystack

Django Haystack - No module named 'haystack.backends.elasticsearch5_backend'


Im following the install instructions as per the haystack documentation http://docs.haystacksearch.org/en/master/tutorial.html#installation and the search engine installation https://django-haystack.readthedocs.io/en/master/installing_search_engines.html#elasticsearch

I have installed Elasticsearch 5.1.16 which is listed as compatible and have put the settings in, the installation guide only has examples for Elasticsearch versions 1 and 2 but states that 5 is supported.

so I changed to version 5 in the settings

    'default': {
        'ENGINE': 'haystack.backends.elasticsearch5_backend.Elasticsearch5SearchEngine',
        'URL': 'http://127.0.0.1:9200/',
        'INDEX_NAME': 'haystack',
    },
}

I have also gone through the repo and can see that version 5 is in there

enter image description here

but when I start my server I receive the error:

return _bootstrap._gcd_import(name[level:], package, level)
    ModuleNotFoundError: No module named 'haystack.backends.elasticsearch5_backend'

but then when I traverse the folder structure it hasn't installed the version 5 files

root@4c1197e002e8:/myapp/# ls /usr/local/lib/python3.6/site-packages/haystack/backends/
__init__.py                __pycache__/               elasticsearch2_backend.py  elasticsearch_backend.py   simple_backend.py          solr_backend.py            whoosh_backend.py

and im using the same version as the git repo that has the 5 backend in it?

root@4c1197e002e8:/myapp/# pip freeze | grep hay django-haystack==2.8.1

EDIT: its also already installed into my installed apps:

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.humanize',
    'haystack',
...

anyone help me out whats missing here? Thanks


Solution

  • I just did a pip install git+https://github.com/django-haystack/django-haystack and now the version5 backend is in there.