Skip to content

Commit 1fa49a9

Browse files
committed
init
1 parent 45bd000 commit 1fa49a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+6287
-0
lines changed

AUTHORS.rst

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
=======
2+
Credits
3+
=======
4+
5+
Development Lead
6+
----------------
7+
8+
sabricot
9+
safwanrahman - Safwan Rahman
10+
11+
Contributors
12+
------------
13+
14+
markotibold
15+
HansAdema - Devhouse Spindle
16+
barseghyanartur

CONTRIBUTING.rst

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
============
2+
Contributing
3+
============
4+
5+
Contributions are welcome, and they are greatly appreciated! Every
6+
little bit helps, and credit will always be given.
7+
8+
You can contribute in many ways:
9+
10+
Types of Contributions
11+
----------------------
12+
13+
Report Bugs
14+
~~~~~~~~~~~
15+
16+
Report bugs at https://github.com/sabricot/django-elasticsearch-dsl/issues.
17+
18+
If you are reporting a bug, please include:
19+
20+
* Your operating system name and version.
21+
* Any details about your local setup that might be helpful in troubleshooting.
22+
* Detailed steps to reproduce the bug.
23+
24+
Fix Bugs
25+
~~~~~~~~
26+
27+
Look through the GitHub issues for bugs. Anything tagged with "bug"
28+
is open to whoever wants to implement it.
29+
30+
Implement Features
31+
~~~~~~~~~~~~~~~~~~
32+
33+
Look through the GitHub issues for features. Anything tagged with "feature"
34+
is open to whoever wants to implement it.
35+
36+
Write Documentation
37+
~~~~~~~~~~~~~~~~~~~
38+
39+
Django Elasticsearch DSL could always use more documentation, whether as part of the
40+
official Django Elasticsearch DSL docs, in docstrings, or even on the web in blog posts,
41+
articles, and such.
42+
43+
Submit Feedback
44+
~~~~~~~~~~~~~~~
45+
46+
The best way to send feedback is to file an issue at https://github.com/sabricot/django-elasticsearch-dsl/issues.
47+
48+
If you are proposing a feature:
49+
50+
* Explain in detail how it would work.
51+
* Keep the scope as narrow as possible, to make it easier to implement.
52+
* Remember that this is a volunteer-driven project, and that contributions
53+
are welcome :)
54+
55+
Get Started!
56+
------------
57+
58+
Ready to contribute? Here's how to set up `django-elasticsearch-dsl` for local development.
59+
60+
1. Fork the `django-elasticsearch-dsl` repo on GitHub.
61+
2. Clone your fork locally::
62+
63+
$ git clone [email protected]:your_name_here/django-elasticsearch-dsl.git
64+
65+
3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
66+
67+
$ mkvirtualenv django-elasticsearch-dsl
68+
$ cd django-elasticsearch-dsl/
69+
$ python setup.py develop
70+
71+
4. Create a branch for local development::
72+
73+
$ git checkout -b name-of-your-bugfix-or-feature
74+
75+
Now you can make your changes locally.
76+
77+
5. When you're done making changes, check that your changes pass flake8 and the
78+
tests, including testing other Python versions with tox::
79+
80+
$ flake8 django_elasticsearch_dsl tests
81+
$ python setup.py test
82+
$ tox
83+
84+
To get flake8 and tox, just pip install them into your virtualenv.
85+
86+
6. Commit your changes and push your branch to GitHub::
87+
88+
$ git add .
89+
$ git commit -m "Your detailed description of your changes."
90+
$ git push origin name-of-your-bugfix-or-feature
91+
92+
7. Submit a pull request through the GitHub website.
93+
94+
Pull Request Guidelines
95+
-----------------------
96+
97+
Before you submit a pull request, check that it meets these guidelines:
98+
99+
1. The pull request should include tests.
100+
2. If the pull request adds functionality, the docs should be updated. Put
101+
your new functionality into a function with a docstring, and add the
102+
feature to the list in README.rst.
103+
3. The pull request should work for Python 2.7, and 3.4, and for PyPy. Check
104+
https://github.com/django-es/django-elasticsearch-dsl/actions
105+
and make sure that the tests pass for all supported Python versions.
106+

HISTORY.rst

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
.. :changelog:
2+
3+
History
4+
-------
5+
7.1.4 (2020-07-05)
6+
~~~~~~~~~~~~~~~~~~
7+
* Configure Elasticsearch _id dynamically from document (#272)
8+
* Use chain.from_iterable in for performance improvement (#278)
9+
* Handle case where SimpleLazyObject being treated as an Iterable (#255)
10+
* Camelcase default value in management command (#254)
11+
* Various updates and fixup in docs (#250, #276)
12+
* Start testing against Python 3.8 (#266)
13+
14+
15+
7.1.1 (2019-12-26)
16+
~~~~~~~~~~~~~~~~~~
17+
* Adding detailed documentation and published to Read The Docs #222
18+
* Resolve name resolution while delete, create index (#228)
19+
* Added support for Django 3.0. (#230)
20+
* Removing old Elasticsearc compatibility (#219)
21+
* Drop StringField in favor of TextField.
22+
23+
24+
7.1.0 (2019-10-29)
25+
~~~~~~~~~~~~~~~~~~
26+
* Support for Django `DecimalField` #141
27+
* Indexing speedup by using `parallel` indexing. #213.
28+
Now you can pass `--parallel` or set `ELASTICSEARCH_DSL_PARALLEL`
29+
in your settings to get indexing speed boost while indexing
30+
through management command.
31+
* Fixing name resolution in management command #206
32+
* Small documentation fixes. #196
33+
34+
35+
7.0.0 (2019-08-11)
36+
~~~~~~~~~~~~~~~~~~
37+
* Support Elasticsearch 7.0 (See PR #176)
38+
* Added order by to paginate queryset properly (See PR #153)
39+
* Remove `standard` token filter from `README.md` and test files
40+
* Various documentation fixes
41+
42+
43+
6.4.2 (2019-07-26)
44+
~~~~~~~~~~~~~~~~~~
45+
* Fix document importing path
46+
* Update readme
47+
48+
49+
50+
6.4.1 (2019-06-14)
51+
~~~~~~~~~~~~~~~~~~
52+
* The `DocType` import has changed to `Document`
53+
54+
55+
56+
6.4.0 (2019-06-01)
57+
~~~~~~~~~~~~~~~~~~
58+
* Support elasticsearch-dsl>6.3.0
59+
* Class `Meta` has changed to class `Django` (See PR #136)
60+
* Add `register_document` decorator to register a document (See PR #136)
61+
* Additional Bug fixing and others
62+
63+
64+
0.5.1 (2018-11-07)
65+
~~~~~~~~~~~~~~~~~~
66+
* Limit elastsearch-dsl to supported versions
67+
68+
0.5.0 (2018-04-22)
69+
~~~~~~~~~~~~~~~~~~
70+
* Add Support for Elasticsearch 6 thanks to HansAdema
71+
72+
Breaking Change:
73+
~~~~~~~~~~~~~~~~
74+
Django string fields now point to ES text field by default.
75+
Nothing should change for ES 2.X but if you are using ES 5.X,
76+
you may need to rebuild and/or update some of your documents.
77+
78+
79+
0.4.5 (2018-04-22)
80+
~~~~~~~~~~~~~~~~~~
81+
* Fix prepare with related models when deleted (See PR #99)
82+
* Fix unwanted calls to get_instances_from_related
83+
* Fix for empty ArrayField (CBinyenya)
84+
* Fix nested OneToOneField when related object doesn't exist (CBinyenya)
85+
* Update elasticsearch-dsl minimal version
86+
87+
0.4.4 (2017-12-13)
88+
~~~~~~~~~~~~~~~~~~
89+
* Fix to_queryset with es 5.0/5.1
90+
91+
0.4.3 (2017-12-12)
92+
~~~~~~~~~~~~~~~~~~
93+
* Fix syncing of related objects when deleted
94+
* Add django 2.0 support
95+
96+
0.4.2 (2017-11-27)
97+
~~~~~~~~~~~~~~~~~~
98+
* Convert lazy string to string before serialization
99+
* Readme update (arielpontes)
100+
101+
0.4.1 (2017-10-17)
102+
~~~~~~~~~~~~~~~~~~
103+
* Update example app with get_instances_from_related
104+
* Typo/grammar fixes
105+
106+
0.4.0 (2017-10-07)
107+
~~~~~~~~~~~~~~~~~~
108+
* Add a method on the Search class to return a django queryset from an es result
109+
* Add a queryset_pagination option to DocType.Meta for allow the pagination of
110+
big django querysets during the index populating
111+
* Remove the call to iterator method for the django queryset
112+
* Fix DocType inheritance. The DocType is store in the registry as a class and not anymore as an instance
113+
114+
115+
0.3.0 (2017-10-01)
116+
~~~~~~~~~~~~~~~~~~
117+
* Add support for resynching ES documents if related models are updated (HansAdema)
118+
* Better management for django FileField and ImageField
119+
* Fix some errors in the doc (barseghyanartur, diwu1989)
120+
121+
0.2.0 (2017-07-02)
122+
~~~~~~~~~~~~~~~~~~
123+
* Replace simple model signals with easier to customise signal processors (barseghyanartur)
124+
* Add options to disable automatic index refreshes (HansAdema)
125+
* Support defining DocType indexes through Meta class (HansAdema)
126+
* Add option to set default Index settings through Django config (HansAdema)
127+
128+
0.1.0 (2017-05-26)
129+
~~~~~~~~~~~~~~~~~~
130+
* First release on PyPI.

LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
Apache Software License 2.0
3+
4+
Copyright (c) 2016, Sabre
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
19+

MANIFEST.in

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include AUTHORS.rst
2+
include CONTRIBUTING.rst
3+
include HISTORY.rst
4+
include LICENSE
5+
include README.rst
6+
recursive-include django_elasticsearch_dsl *.html *.png *.gif *js *.css *jpg *jpeg *svg *py

README.rst

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
========================
2+
Django Elasticsearch DSL
3+
========================
4+
5+
.. image:: https://github.com/django-es/django-elasticsearch-dsl/actions/workflows/ci.yml/badge.svg
6+
:target: https://github.com/django-es/django-elasticsearch-dsl/actions/workflows/ci.yml
7+
.. image:: https://codecov.io/gh/django-es/django-elasticsearch-dsl/coverage.svg?branch=master
8+
:target: https://codecov.io/gh/django-es/django-elasticsearch-dsl
9+
.. image:: https://badge.fury.io/py/django-elasticsearch-dsl.svg
10+
:target: https://pypi.python.org/pypi/django-elasticsearch-dsl
11+
.. image:: https://readthedocs.org/projects/django-elasticsearch-dsl/badge/?version=latest&style=flat
12+
:target: https://django-elasticsearch-dsl.readthedocs.io/en/latest/
13+
14+
Django Elasticsearch DSL is a package that allows indexing of django models in elasticsearch.
15+
It is built as a thin wrapper around elasticsearch-dsl-py_
16+
so you can use all the features developed by the elasticsearch-dsl-py team.
17+
18+
You can view the full documentation at https://django-elasticsearch-dsl.readthedocs.io
19+
20+
.. _elasticsearch-dsl-py: https://github.com/elastic/elasticsearch-dsl-py
21+
22+
Features
23+
--------
24+
25+
- Based on elasticsearch-dsl-py_ so you can make queries with the Search_ class.
26+
- Django signal receivers on save and delete for keeping Elasticsearch in sync.
27+
- Management commands for creating, deleting, rebuilding and populating indices.
28+
- Elasticsearch auto mapping from django models fields.
29+
- Complex field type support (ObjectField, NestedField).
30+
- Index fast using `parallel` indexing.
31+
- Requirements
32+
33+
- Django >= 1.11
34+
- Python 2.7, 3.5, 3.6, 3.7, 3.8
35+
36+
**Elasticsearch Compatibility:**
37+
The library is compatible with all Elasticsearch versions since 5.x
38+
**but you have to use a matching major version:**
39+
40+
- For Elasticsearch 7.0 and later, use the major version 7 (7.x.y) of the library.
41+
42+
- For Elasticsearch 6.0 and later, use the major version 6 (6.x.y) of the library.
43+
44+
- For Elasticsearch 5.0 and later, use the major version 0.5 (0.5.x) of the library.
45+
46+
.. code-block:: python
47+
48+
# Elasticsearch 7.x
49+
elasticsearch-dsl>=7.0.0,<8.0.0
50+
51+
# Elasticsearch 6.x
52+
elasticsearch-dsl>=6.0.0,<7.0.0
53+
54+
# Elasticsearch 5.x
55+
elasticsearch-dsl>=0.5.1,<6.0.0
56+
57+
.. _Search: http://elasticsearch-dsl.readthedocs.io/en/stable/search_dsl.html

django_elasticsearch_dsl/__init__.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import django
2+
3+
from django.utils.module_loading import autodiscover_modules
4+
5+
from .documents import Document # noqa
6+
from .indices import Index # noqa
7+
from .fields import * # noqa
8+
9+
__version__ = '7.1.1'
10+
11+
12+
def autodiscover():
13+
autodiscover_modules('documents')
14+
15+
16+
if django.VERSION < (3, 2):
17+
default_app_config = 'django_elasticsearch_dsl.apps.DEDConfig'

django_elasticsearch_dsl/apps.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from django.apps import AppConfig
2+
from django.conf import settings
3+
from django.utils.module_loading import import_string
4+
5+
from elasticsearch_dsl.connections import connections
6+
7+
8+
class DEDConfig(AppConfig):
9+
name = 'django_elasticsearch_dsl'
10+
verbose_name = "Django elasticsearch-dsl"
11+
signal_processor = None
12+
13+
def ready(self):
14+
self.module.autodiscover()
15+
connections.configure(**settings.ELASTICSEARCH_DSL)
16+
# Setup the signal processor.
17+
if not self.signal_processor:
18+
signal_processor_path = getattr(
19+
settings,
20+
'ELASTICSEARCH_DSL_SIGNAL_PROCESSOR',
21+
'django_elasticsearch_dsl.signals.RealTimeSignalProcessor'
22+
)
23+
signal_processor_class = import_string(signal_processor_path)
24+
self.signal_processor = signal_processor_class(connections)
25+
26+
@classmethod
27+
def autosync_enabled(cls):
28+
return getattr(settings, 'ELASTICSEARCH_DSL_AUTOSYNC', True)
29+
30+
@classmethod
31+
def default_index_settings(cls):
32+
return getattr(settings, 'ELASTICSEARCH_DSL_INDEX_SETTINGS', {})
33+
34+
@classmethod
35+
def auto_refresh_enabled(cls):
36+
return getattr(settings, 'ELASTICSEARCH_DSL_AUTO_REFRESH', True)

0 commit comments

Comments
 (0)