Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vintasoftware/django-zombodb
Easy Django integration with Elasticsearch through ZomboDB Postgres Extension
https://github.com/vintasoftware/django-zombodb
django elasticsearch postgresql zombodb
Last synced: 1 day ago
JSON representation
Easy Django integration with Elasticsearch through ZomboDB Postgres Extension
- Host: GitHub
- URL: https://github.com/vintasoftware/django-zombodb
- Owner: vintasoftware
- License: mit
- Created: 2019-02-01T23:15:22.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-28T15:24:24.000Z (almost 2 years ago)
- Last Synced: 2024-12-16T03:10:34.504Z (10 days ago)
- Topics: django, elasticsearch, postgresql, zombodb
- Language: Python
- Homepage: https://django-zombodb.readthedocs.io
- Size: 588 KB
- Stars: 151
- Watchers: 30
- Forks: 10
- Open Issues: 23
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
- Security: SECURITY.rst
Awesome Lists containing this project
README
==============
django-zombodb
==============.. image:: https://badge.fury.io/py/django-zombodb.svg
:target: https://badge.fury.io/py/django-zombodb
:alt: PyPI Status.. image:: https://travis-ci.org/vintasoftware/django-zombodb.svg?branch=master
:target: https://travis-ci.org/vintasoftware/django-zombodb
:alt: Build Status.. image:: https://readthedocs.org/projects/django-zombodb/badge/?version=latest
:target: https://django-zombodb.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status.. image:: https://codecov.io/gh/vintasoftware/django-zombodb/branch/master/graph/badge.svg
:target: https://codecov.io/gh/vintasoftware/django-zombodb
:alt: Coverage Status.. image:: https://img.shields.io/github/license/vintasoftware/django-zombodb.svg
:alt: GitHubEasy 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 ``_.
Requirements
------------* **Python**: 3.5, 3.6, 3.7
* **Django**: 2.0, 2.1, 2.2
* **Postgres** and **Elasticsearch**: same as `ZomboDB current requirements `_Quickstart
----------1. Install ZomboDB (instructions `here `_)
2. Install django-zombodb:
::
pip install django-zombodb
3. Add the ``SearchQuerySet`` and the ``ZomboDBIndex`` to your model:
.. code-block:: python
from django_zombodb.indexes import ZomboDBIndex
from django_zombodb.querysets import SearchQuerySetclass Restaurant(models.Model):
name = models.TextField()objects = models.Manager.from_queryset(SearchQuerySet)()
class Meta:
indexes = [
ZomboDBIndex(fields=[
'name',
]),
]4. Make the migrations:
::
python manage.py makemigrations
5. Add ``django_zombodb.operations.ZomboDBExtension()`` as the first operation of the migration you've just created:
.. code-block:: python
import django_zombodb.operations
class Migration(migrations.Migration):
dependencies = [
('restaurants', '0001_initial'),
]operations = [
django_zombodb.operations.ZomboDBExtension(), # <<< here
]6. Run the migrations (Postgres user must be SUPERUSER to create the ZomboDB extension):
::
python manage.py migrate
7. Done! Now you can make Elasticsearch queries directly from your model:
.. code-block:: python
Restaurant.objects.filter(is_open=True).query_string_search("brazil* AND coffee~")
Full Example
------------Check ``_
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.brPlease 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]