Coder Social home page Coder Social logo

jongsky / django-elasticsearch-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sunscrapers/django-elasticsearch-example

0.0 1.0 0.0 15 KB

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

License: MIT License

Python 97.77% Dockerfile 2.23%

django-elasticsearch-example's Introduction

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. cd to root of project
  2. docker-compose build
  3. docker-compose run --service-ports --rm django python manage.py bootstrap
  4. docker-compose up

To test Elasticsearch in shell run these commands:

  1. docker-compose up
  2. docker-compose exec django python manage.py shell

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/

Troubleshooting

django-elasticsearch-example's People

Contributors

pmlynarek avatar

Watchers

 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.