Skip to main content

Easy Django integration with Elasticsearch through ZomboDB Postgres Extension

Project description

PyPI Status Build Status Documentation Status Coverage Status

Easy Django integration with Elasticsearch through ZomboDB Postgres Extension. Thanks to ZomboDB, your Django models are synced with Elasticsearch after every transaction! Searching is also very simple: you can make Elasticsearch queries by just calling one of the search methods on your querysets. Couldn’t be easier!


The full documentation is at


  • Python: 3.4, 3.5, 3.6, 3.7

  • Django: 2.0, 2.1, 2.2


  1. Install ZomboDB (instructions here)

  2. Install django-zombodb:

pip install django-zombodb
  1. Add the SearchQuerySet and the ZomboDBIndex to your model:

from django_zombodb.indexes import ZomboDBIndex
from django_zombodb.querysets import SearchQuerySet

class Restaurant(models.Model):
    name = models.TextField()

    objects = models.Manager.from_queryset(SearchQuerySet)()

    class Meta:
        indexes = [
  1. Make the migrations:

python makemigrations
  1. Add django_zombodb.operations.ZomboDBExtension() as the first operation of the migration you’ve just created:

import django_zombodb.operations

class Migration(migrations.Migration):

    dependencies = [
        ('restaurants', '0001_initial'),

    operations = [
        django_zombodb.operations.ZomboDBExtension(),  # <<< here
  1. Run the migrations (Postgres user must be SUPERUSER to create the ZomboDB extension):

python migrate
  1. Done! Now you can make Elasticsearch queries directly from your model:

Restaurant.objects.filter(is_open=True).query_string_search("brazil* AND coffee~")

Full Example


Running Tests

You need to have Elasticsearch and Postgres instances running on default ports. Also, you need ZomboDB installed. Then just do:


Change Log

0.2.0 (2019-03-01)

  • Removed parameter url from ZomboDBIndex. This simplifies the support of multiple deployment environments (local, staging, production), because the ElasticSearch URL isn’t copied to inside migrations code (see Issue #17).

0.1.0 (2019-02-01)

  • First release on PyPI.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-zombodb-0.2.0.tar.gz (10.9 kB view hashes)

Uploaded source

Built Distribution

django_zombodb-0.2.0-py2.py3-none-any.whl (12.1 kB view hashes)

Uploaded 3 7

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page