Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

Elasticsearch client with Django support.

Project Description

Gum is a Django app for integrate Elasticsearch 1.x with Django.

Quick start

1 Install using pip:

pip install django-gum

2 Add “gum” to your INSTALLED_APPS settings like this:

INSTALLED_APPS += ('gum',)

3 Add Elasticsearch configuration to your settings like this:


List of available configuration variables:

  • GUM_DEBUG (boolean)
  • GUM_USE_CELERY (boolean)

4 Create an in your app, with a content like this:

from gum.indexer import MappingType, indexer

class PostMappingType(MappingType):

    def document(self, instance):
        tags_text = " ".join(map(lambda x: x.label, instance.tags.all()))
        return {
            "title": instance.title,
            "content": instance.content,
            "text": "{} {} {}".format(instance.title, instance.content, tags_text)

    def mapping(self):
        return {
            "properties": {
                "title": {
                    "type": "string",
                    "store": True,
                "content": {
                    "type": "string",
                    "store": True,
                "text": {
                    "type": "string",
                    "store": True,

indexer.register(Post, PostMappingType)

5 Update Elasticsearch index:

./ gum --update-index

You can specify the models you want to index:

./ gum --update-index blog.Post


You can perform Elasticsearch searches (accessing search method) using elasticseaech model attribute:

response ={
    "query": {
        "match_all": {}

Release History

This version
History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(9.8 kB) Copy SHA256 Hash SHA256
Source Feb 29, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting