Search code examples
pythondjangoelasticsearchdjango-haystack

django-haystack with elastic search not building index for newly created objects


using

Django==1.8
django-haystack==2.3.1

setting.py:

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

Newly created(updated or deleted )objects are not updating in my elastic search index. entering .manage.py rebuild_index command each time when creating or updating objects which working perfectly and updating each change.

Is there any solution to auto rebuild index when changes made to model objects.


Solution

  • You need to have the real time signal processor activated in settings:

    HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'