Managing Elasticsearch in Django like a pro

Alternative to django-haystack

pip install elasticsearch-dsl

Configuring the index and document

Management Commands

Abstract Index

Use Cases

- Simple Indexingpython3 manage.py index_documents- Updating (remove stale and index newly updated in last 24hrs)
maybe you want to setup a cron to run every night.
python3 manage.py index_documents --remove --age 2- Clear everything and rebuildpython3 manage.py index_documents --clear_index- Specify only a single index (if you have multiple setup)python3 manage.py index_documents --index blog

Final Thoughts

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store