Skip to content

Commit e5441e9

Browse files
committed
Switch from elasticsearch-dsl-py to elasticsearch-py
This commit switches the dependency of this library from elasticsearch-dsl-py to elasticsearch-py since the former was merged into the latter. This commit also updates the tox matrix to only run tests for supported dependencies only
1 parent e453aff commit e5441e9

File tree

24 files changed

+108
-90
lines changed

24 files changed

+108
-90
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,24 @@ jobs:
1313
fail-fast: false
1414

1515
matrix:
16-
python-version: ["3.8", "3.9", "3.10", "3.11"]
17-
django-version: ["3.2", "4.1", "4.2"]
18-
es-dsl-version: ["6.4", "7.4"]
19-
es-version: ["8.10.2"]
16+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
17+
django-version: ["4.2", "5.1", "5.2"]
18+
es-version: ["7", "8", "9"]
19+
version: ["7.4", "8.0", "master"]
2020

2121
exclude:
22-
- python-version: "3.11"
23-
django-version: "3.2"
22+
- python-version: "3.13"
23+
django-version: "4.2"
24+
- python-version: "3.9"
25+
django-version: "5.1"
26+
- python-version: "3.9"
27+
django-version: "5.2"
28+
- version: "8.0"
29+
es-version: "7"
30+
- version: "master"
31+
es-version: "7"
32+
- version: "master"
33+
es-version: "8"
2434

2535
steps:
2636
- name: Install and Run Elasticsearch
@@ -29,6 +39,8 @@ jobs:
2939
stack-version: ${{ matrix.es-version }}
3040

3141
- uses: actions/checkout@v4
42+
with:
43+
ref: ${{ matrix.version }}
3244

3345
- name: Install Python ${{ matrix.python-version }}
3446
uses: actions/setup-python@v4
@@ -47,12 +59,11 @@ jobs:
4759
run: |
4860
python -m pip install --upgrade pip
4961
python -m pip install "Django==${{ matrix.django-version }}"
50-
python -m pip install "elasticsearch-dsl==${{ matrix.es-dsl-version }}"
5162
python -m pip install -r requirements_test.txt
5263
53-
- name: Run tests with Python ${{ matrix.python-version }} and Django ${{ matrix.django-version }} and elasticsearch-dsl-py ${{ matrix.es-dsl-version }}
64+
- name: Run tests with Python ${{ matrix.python-version }} and Django ${{ matrix.django-version }}
5465
run: |
55-
TOX_ENV=$(echo "py${{ matrix.python-version }}-django-${{ matrix.django-version }}-es${{ matrix.es-dsl-version }}" | tr -d .)
66+
TOX_ENV=$(echo "py${{ matrix.python-version }}-django-${{ matrix.django-version }}" | tr -d .)
5667
python -m tox -e $TOX_ENV -- --elasticsearch
5768
python -m tox -e $TOX_ENV -- --elasticsearch --signal-processor celery
5869

README.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ Django Elasticsearch DSL
1212
:target: https://django-elasticsearch-dsl.readthedocs.io/en/latest/
1313

1414
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.
15+
It is built as a thin wrapper around elasticsearch-py_
16+
so you can use all the features developed by the elasticsearch-py team.
1717

1818
You can view the full documentation at https://django-elasticsearch-dsl.readthedocs.io
1919

20-
.. _elasticsearch-dsl-py: https://github.com/elastic/elasticsearch-dsl-py
20+
.. _elasticsearch-py: https://github.com/elastic/elasticsearch-py
2121

2222
Features
2323
--------
2424

25-
- Based on elasticsearch-dsl-py_ so you can make queries with the Search_ class.
25+
- Based on elasticsearch-py_ so you can make queries with the Search_ class.
2626
- Django signal receivers on save and delete for keeping Elasticsearch in sync.
2727
- Management commands for creating, deleting, rebuilding and populating indices.
2828
- Elasticsearch auto mapping from django models fields.
@@ -31,11 +31,12 @@ Features
3131
- Requirements
3232

3333
- Django >= 3.2
34-
- Python 3.8, 3.9, 3.10, 3.11
34+
- Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13
3535

3636
**Elasticsearch Compatibility:**
3737
The library is compatible with all Elasticsearch versions since 5.x
3838
**but you have to use a matching major version:**
39+
- For Elasticsearch 9.0 and later, use the major version 9 (9.x.y) of the library.
3940

4041
- For Elasticsearch 8.0 and later, use the major version 8 (8.x.y) of the library.
4142

@@ -45,6 +46,9 @@ The library is compatible with all Elasticsearch versions since 5.x
4546

4647
.. code-block:: python
4748
49+
# Elasticsearch 9.x
50+
elasticsearch>=9.0.0,<10.0.0
51+
4852
# Elasticsearch 8.x
4953
elasticsearch-dsl>=8.0.0,<9.0.0
5054
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
import django
2-
31
from django.utils.module_loading import autodiscover_modules
42

53
from .documents import Document # noqa
6-
from .indices import Index # noqa
74
from .fields import * # noqa
8-
9-
__version__ = '7.1.1'
5+
from .indices import Index # noqa
106

117

128
def autodiscover():
139
autodiscover_modules('documents')
14-
15-

django_elasticsearch_dsl/apps.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from django.apps import AppConfig
22
from django.conf import settings
33
from django.utils.module_loading import import_string
4-
5-
from elasticsearch_dsl.connections import connections
4+
from elasticsearch.dsl.connections import connections
65

76

87
class DEDConfig(AppConfig):

django_elasticsearch_dsl/documents.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
from django import VERSION as DJANGO_VERSION
88
from django.db import models
9+
from elasticsearch.dsl import Document as DSLDocument
910
from elasticsearch.helpers import bulk, parallel_bulk
10-
from elasticsearch_dsl import Document as DSLDocument
1111
from six import iteritems
1212

1313
from .exceptions import ModelFieldNotMappedError
@@ -21,7 +21,8 @@
2121
KeywordField,
2222
LongField,
2323
ShortField,
24-
TextField, TimeField,
24+
TextField,
25+
TimeField,
2526
)
2627
from .search import Search
2728
from .signals import post_index
@@ -219,14 +220,13 @@ def _get_actions(self, object_list, action):
219220
for object_instance in object_list:
220221
if action == 'delete' or self.should_index_object(object_instance):
221222
yield self._prepare_action(object_instance, action)
222-
223+
223224
def get_actions(self, object_list, action):
224225
"""
225226
Generate the elasticsearch payload.
226227
"""
227228
return self._get_actions(object_list, action)
228229

229-
230230
def _bulk(self, *args, **kwargs):
231231
"""Helper for switching between normal and parallel bulk operation"""
232232
parallel = kwargs.pop('parallel', False)

django_elasticsearch_dsl/fields.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
from django.utils.encoding import force_text as force_str
1010
else:
1111
from django.utils.encoding import force_str
12+
1213
from django.utils.functional import Promise
13-
from elasticsearch_dsl.field import (
14+
from elasticsearch.dsl.field import (
1415
Boolean,
1516
Byte,
1617
Completion,
@@ -22,14 +23,14 @@
2223
GeoShape,
2324
Integer,
2425
Ip,
26+
Keyword,
2527
Long,
2628
Nested,
2729
Object,
2830
ScaledFloat,
31+
SearchAsYouType,
2932
Short,
30-
Keyword,
3133
Text,
32-
SearchAsYouType,
3334
)
3435

3536
from .exceptions import VariableLookupError

django_elasticsearch_dsl/indices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from copy import deepcopy
22

3-
from elasticsearch_dsl import Index as DSLIndex
3+
from elasticsearch.dsl import Index as DSLIndex
44
from six import python_2_unicode_compatible
55

66
from .apps import DEDConfig

django_elasticsearch_dsl/management/commands/search_index.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
from __future__ import unicode_literals, absolute_import
1+
from __future__ import absolute_import, unicode_literals
2+
23
from datetime import datetime
34

4-
from elasticsearch_dsl import connections
55
from django.conf import settings
66
from django.core.management.base import BaseCommand, CommandError
7+
from elasticsearch.dsl import connections
78
from six.moves import input
9+
810
from ...registries import registry
911

1012

django_elasticsearch_dsl/registries.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
from collections import defaultdict
22
from copy import deepcopy
3-
43
from itertools import chain
54

6-
from django.core.exceptions import ObjectDoesNotExist
7-
from django.core.exceptions import ImproperlyConfigured
8-
from elasticsearch_dsl import AttrDict
9-
from six import itervalues, iterkeys, iteritems
5+
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
6+
from elasticsearch.dsl import AttrDict
7+
from six import iteritems, iterkeys, itervalues
108

119
from django_elasticsearch_dsl.exceptions import RedeclaredFieldError
10+
1211
from .apps import DEDConfig
1312

1413

django_elasticsearch_dsl/search.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from django.db.models import Case, When
22
from django.db.models.fields import IntegerField
3-
4-
from elasticsearch_dsl import Search as DSLSearch
3+
from elasticsearch.dsl import Search as DSLSearch
54

65

76
class Search(DSLSearch):

0 commit comments

Comments
 (0)