Skip to main content
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

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

Security

Please check SECURITY.rst. If you found or if you think you found a vulnerability please get in touch via admin AT vinta.com.br

Please avoid disclosing any security issue on GitHub or any other public website. We’ll work to swiftly address any possible vulnerability and give credit to reporters (if wanted).

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

Change Log

0.3.0 (2019-07-18)

  • Support for custom Elasticsearch mappings through field_mapping parameter on ZomboDBIndex.

  • Support to limit parameter on search methods.

0.2.1 (2019-06-13)

  • Dropped support for Python 3.4.

  • Added missing imports to docs.

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.

Release files for django-zombodb 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-zombodb 0.3.0
File Size Uploaded
django-zombodb-0.3.0.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-zombodb 0.3.0
File Interpreter ABI Platform
django_zombodb-0.3.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 26.4 kB

Release files / django-zombodb-0.3.0.tar.gz

Download URL django-zombodb-0.3.0.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3d686d86dfe3093448a8630abb37e6d0edc924f0ec52c5d4395dbfb635c3bdc2
BLAKE2b-256 checksum
How to use checksums
918118e58e309eb537cecfd2d7cd5aba24cbea6efbc07f8614f293d1f0812e83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Release files / django_zombodb-0.3.0-py2.py3-none-any.whl

Download URL django_zombodb-0.3.0-py2.py3-none-any.whl
Size 13.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
13170fb63897e93141d71217f21263dec896c3aecb3ae2f0ed06a7e6a53058ed
BLAKE2b-256 checksum
How to use checksums
75540f561c00c5a1fe5fefe856b241fd1f62151283530fce3b25d8faac800cb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page