Skip to content

Simple project to test Elasticsearch with Django, build on docker.

License

Notifications You must be signed in to change notification settings

sunscrapers/Django-elasticsearch-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Elasticsearch Example

Simple project to test Elasticsearch with Django, build on docker.

WARNING! This project is only for local testing, it's not prepared for deployment into remote server.

Prerequisites

  • Docker
  • Docker-compose

Getting Started

Steps to build, load data from fixtures and run project:

  1. Enter into root of the project
  2. make up
  3. make bootstrap (in another terminal window)

To test Elasticsearch in shell run these commands:

  1. make up
  2. make shell or make bash

Examples of usage

cars = CarDocument.search().query('match', color='black')
for car in cars:
    print(car.color)

cars = CarDocument.search().extra(size=0)
cars.aggs.bucket('points_count', 'terms', field='points')
result = cars.execute()
for point in result.aggregations.points_count:
    print(point)

Links

Check out article to this project: https://sunscrapers.com/blog/how-to-use-elasticsearch-with-django/

About

Simple project to test Elasticsearch with Django, build on docker.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published