This Django app allows you to utilize Celery for automatically updating and deleting objects in a Django Simple Elasticsearch search index.
- Django 1.4+
- Django Simple Elasticsearch 0.9.16
- Celery 3.X
Use your favorite Python package manager to install the app from PyPI, e.g.:
pip install celery-simple-elasticsearch
By default a few dependencies will automatically be installed:
- django-appconf -- An app to gracefully handle application settings.
- django-celery-transactions -- An app that "holds on to Celery tasks until the current database transaction is committed, avoiding potential race conditions as described in Celery's user guide."
Add
'celery_simple_elasticsearch'
to theINSTALLED_APPS
settingINSTALLED_APPS = [ # .. 'celery_simple_elasticsearch', ]
Alter all of your
ElasticsearchIndexMixin
subclasses to also inherit fromcelery_simple_elasticsearch.indexes.CelerySearchIndex
from django.db import models from celery_simple_elasticsearch.indexes import CelerySearchIndex from simple_elasticsearch.mixins import ElasticsearchIndexMixin class Person(CelerySearchIndex, ElasticsearchIndexMixin, models.Model): first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30)
Ensure your Celery instance is running.
This app is a blatant rip-off of Celery Haystack. A great basis, but I didn't want Haystack users to have all the celery goodness to themselves.
Please use the Github issue tracker for any bug reports or feature requests.