<commit_before>================================
 Using ElasticUtils with Django
================================

.. contents::
   :local:


Summary
=======

Django-specific code is all located in `elasticutils.contrib.django`.

This chapter covers using ElasticUtils Django bits. For API
documentation, see :ref:`django-api-docs-chapter`.


How to integrate ElasticUtils with Django
=========================================

1. add ElasticUtils configuration settings to your project's setting
   file

2. write one or more `DjangoMappingType` classes

3. write code to create the ElasticSearch index and populate it with
   documents based on your `DjangoMappingType` subclasses

3. use :py:class:`elasticutils.contrib.django.S` to search and return
   results

4. use :py:class:`elasticutils.contrib.django.estestcase.ESTestCase`
   to write tests


That's the gist of it. You can deviate on any of these depending on
your needs, of course.


Configuration
=============

ElasticUtils depends on the following settings in your Django settings
file:

.. module:: django.conf.settings

.. data:: ES_DISABLED

   If `ES_DISABLED = True`, then Any method wrapped with<commit_msg>Fix two more errant DjangoMappingTypes in the docs<commit_after>================================
 Using ElasticUtils with Django
================================

.. contents::
   :local:


Summary
=======

Django-specific code is all located in `elasticutils.contrib.django`.

This chapter covers using ElasticUtils Django bits. For API
documentation, see :ref:`django-api-docs-chapter`.


How to integrate ElasticUtils with Django
=========================================

1. add ElasticUtils configuration settings to your project's setting
   file

2. write one or more `MappingType` classes

3. write code to create the ElasticSearch index and populate it with
   documents based on your `MappingType` subclasses

3. use :py:class:`elasticutils.contrib.django.S` to search and return
   results

4. use :py:class:`elasticutils.contrib.django.estestcase.ESTestCase`
   to write tests


That's the gist of it. You can deviate on any of these depending on
your needs, of course.


Configuration
=============

ElasticUtils depends on the following settings in your Django settings
file:

.. module:: django.conf.settings

.. data:: ES_DISABLED

   If `ES_DISABLED = True`, then Any method wrapped with
{'fraction_non_alphanumeric': 0.16449853126311373, 'fraction_numerical': 0.00419639110365086, 'mean_word_length': 4.814634146341463, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '297021', 'n_tokens_mistral': 651, 'n_tokens_neox': 606, 'n_words': 254}