Skip to content
Easy Django integration with Elasticsearch through ZomboDB Postgres Extension
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
django_zombodb Bump version: 0.1.4 → 0.2.0 Mar 1, 2019
docs Bump version: 0.1.4 → 0.2.0 Mar 1, 2019
example Remove url param from ZomboDBIndex, always use settings.ZOMBODB_ELAST… Mar 1, 2019
requirements
tests Remove url param from ZomboDBIndex, always use settings.ZOMBODB_ELAST… Mar 1, 2019
.bumpversion.cfg Bump version: 0.1.4 → 0.2.0 Mar 1, 2019
.coveragerc
.editorconfig Bare bones working first version Feb 1, 2019
.flake8
.gitignore
.isort.cfg Various small fixes for correct isort and prospector, also fixed requ… Feb 7, 2019
.prospector.yml Fix compatibility with Django >= 2.2 Feb 15, 2019
.travis.yml Fix compatibility with Django >= 2.2 Feb 15, 2019
AUTHORS.rst Bare bones working first version Feb 1, 2019
CHANGELOG.rst Bump version: 0.1.4 → 0.2.0 Mar 1, 2019
CONTRIBUTING.rst
LICENSE
MANIFEST.in Bare bones working first version Feb 1, 2019
Makefile Fix Makefile install_requirements Feb 14, 2019
README.rst README: MIT license badge and Commercial Support section Mar 7, 2019
requirements.txt
runtests.py
setup.cfg Bare bones working first version Feb 1, 2019
setup.py Fix setup.py classifiers Feb 13, 2019
test_manage.py SearchQuerySetTests Feb 12, 2019
tox.ini Fix compatibility with Django >= 2.2 Feb 15, 2019

README.rst

django-zombodb

PyPI Status Build Status Documentation Status Coverage Status

GitHub

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!

Documentation

The full documentation is at https://django-zombodb.readthedocs.io.

Requirements

  • Python: 3.4, 3.5, 3.6, 3.7
  • Django: 2.0, 2.1, 2.2

Quickstart

  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 = [
            ZomboDBIndex(fields=[
                'name',
            ]),
        ]
  1. Make the migrations:
python manage.py 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 manage.py 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

Check https://github.com/vintasoftware/django-zombodb/tree/master/example

Running Tests

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

python runtests.py

Commercial Support

This project is maintained by Vinta Software and other contributors. We are always looking for exciting work, so if you need any commercial support, feel free to get in touch: contact@vinta.com.br

You can’t perform that action at this time.