django-drf-elasticsearch icon indicating copy to clipboard operation
django-drf-elasticsearch copied to clipboard

Django REST Framework and Elasticsearch

Django DRF Elasticsearch

Want to learn how to build this?

Check out the post.

Want to use this project?

  1. Fork/Clone

  2. Install Elasticsearch if you haven't already and make sure it is running on port 9200. Make sure to update the ELASTICSEARCH_DSL config in core/settings.py.

  3. Create and activate a virtual environment:

    $ python3.12 -m venv venv && source venv/bin/activate
    
  4. Install the requirements:

    (venv)$ pip install -r requirements.txt
    
  5. Apply the migrations:

    (venv)$ python manage.py migrate
    
  6. Populate the database with some test data by running the following command:

    (venv)$ python manage.py populate_db
    
  7. Create and populate the Elasticsearch index and mapping:

    (venv)$ python manage.py search_index --rebuild
    
  8. Run the server

    (venv)$ python manage.py runserver
    
  9. Test Elasticsearch with the following queries: