Giter Club home page Giter Club logo

django-zombodb's Introduction

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 at transaction time! 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: [email protected]

django-zombodb's People

Contributors

fjsj avatar gtsalles avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.