Skip to content

Commit a4cb97a

Browse files
committed
Switch to elasticsearch-py as dsl has been merged into it
1 parent 639758e commit a4cb97a

File tree

14 files changed

+20
-20
lines changed

14 files changed

+20
-20
lines changed

django_elasticsearch_dsl/apps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from django.conf import settings
33
from django.utils.module_loading import import_string
44

5-
from elasticsearch_dsl.connections import connections
5+
from elasticsearch.dsl.connections import connections
66

77

88
class DEDConfig(AppConfig):

django_elasticsearch_dsl/documents.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from django import VERSION as DJANGO_VERSION
88
from django.db import models
99
from elasticsearch.helpers import bulk, parallel_bulk
10-
from elasticsearch_dsl import Document as DSLDocument
10+
from elasticsearch.dsl import Document as DSLDocument
1111
from six import iteritems
1212

1313
from .exceptions import ModelFieldNotMappedError
@@ -219,7 +219,7 @@ def _get_actions(self, object_list, action):
219219
for object_instance in object_list:
220220
if action == 'delete' or self.should_index_object(object_instance):
221221
yield self._prepare_action(object_instance, action)
222-
222+
223223
def get_actions(self, object_list, action):
224224
"""
225225
Generate the elasticsearch payload.

django_elasticsearch_dsl/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
else:
1111
from django.utils.encoding import force_str
1212
from django.utils.functional import Promise
13-
from elasticsearch_dsl.field import (
13+
from elasticsearch.dsl.field import (
1414
Boolean,
1515
Byte,
1616
Completion,

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import unicode_literals, absolute_import
22
from datetime import datetime
33

4-
from elasticsearch_dsl import connections
4+
from elasticsearch.dsl import connections
55
from django.conf import settings
66
from django.core.management.base import BaseCommand, CommandError
77
from six.moves import input

django_elasticsearch_dsl/registries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from django.core.exceptions import ObjectDoesNotExist
77
from django.core.exceptions import ImproperlyConfigured
8-
from elasticsearch_dsl import AttrDict
8+
from elasticsearch.dsl import AttrDict
99
from six import itervalues, iterkeys, iteritems
1010

1111
from django_elasticsearch_dsl.exceptions import RedeclaredFieldError

django_elasticsearch_dsl/search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from django.db.models import Case, When
22
from django.db.models.fields import IntegerField
33

4-
from elasticsearch_dsl import Search as DSLSearch
4+
from elasticsearch.dsl import Search as DSLSearch
55

66

77
class Search(DSLSearch):

django_elasticsearch_dsl/test/testcases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import re
22

33
from django.test.utils import captured_stderr
4-
from elasticsearch_dsl.connections import connections
4+
from elasticsearch.dsl.connections import connections
55

66
from ..registries import registry
77

docs/source/es_index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Index
44
In typical scenario using `class Index` on a `Document` class is sufficient to perform any action.
55
In a few cases though it can be useful to manipulate an Index object directly.
66

7-
To define an Elasticsearch index you must instantiate a ``elasticsearch_dsl.Index`` class
7+
To define an Elasticsearch index you must instantiate a ``elasticsearch.dsl.Index`` class
88
and set the name and settings of the index.
99
After you instantiate your class,
1010
you need to associate it with the Document you want to put in this Elasticsearch index
@@ -14,7 +14,7 @@ and also add the `registry.register_document` decorator.
1414
.. code-block:: python
1515
1616
# documents.py
17-
from elasticsearch_dsl import Index
17+
from elasticsearch.dsl import Index
1818
from django_elasticsearch_dsl import Document
1919
from .models import Car, Manufacturer
2020

example/test_app/documents.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from elasticsearch_dsl import analyzer
1+
from elasticsearch.dsl import analyzer
22
from django_elasticsearch_dsl import Document, Index, fields
33
from django_elasticsearch_dsl.registries import registry
44

tests/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from elasticsearch_dsl import VERSION
1+
from elasticsearch.dsl import VERSION
22

33
ES_MAJOR_VERSION = VERSION[0]

tests/documents.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from elasticsearch_dsl import analyzer
1+
from elasticsearch.dsl import analyzer
22
from django_elasticsearch_dsl import Document, fields
33
from django_elasticsearch_dsl.registries import registry
44

tests/test_documents.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from django.utils.translation import ugettext_lazy as _
1111
else:
1212
from django.utils.translation import gettext_lazy as _
13-
from elasticsearch_dsl import GeoPoint, InnerDoc
13+
from elasticsearch.dsl import GeoPoint, InnerDoc
1414
from mock import patch, Mock
1515

1616
from django_elasticsearch_dsl import fields
@@ -453,7 +453,7 @@ def test_init_prepare_results(self):
453453
# got iterated and generate_id called.
454454
# If we mock the bulk in django_elasticsearch_dsl.document
455455
# the actual bulk will be never called and the test will fail
456-
@patch('elasticsearch_dsl.connections.Elasticsearch.bulk')
456+
@patch('elasticsearch.dsl.connections.Elasticsearch.bulk')
457457
def test_default_generate_id_is_called(self, _):
458458
article = Article(
459459
id=124594,
@@ -481,7 +481,7 @@ class Index:
481481
d.update(article)
482482
patched_method.assert_called()
483483

484-
@patch('elasticsearch_dsl.connections.Elasticsearch.bulk')
484+
@patch('elasticsearch.dsl.connections.Elasticsearch.bulk')
485485
def test_custom_generate_id_is_called(self, mock_bulk):
486486
article = Article(
487487
id=54218,
@@ -511,7 +511,7 @@ def generate_id(cls, article):
511511
data = json.loads(mock_bulk.call_args[1]['operations'][1])
512512
assert data['slug'] == article.slug
513513

514-
@patch('elasticsearch_dsl.connections.Elasticsearch.bulk')
514+
@patch('elasticsearch.dsl.connections.Elasticsearch.bulk')
515515
def test_should_index_object_is_called(self, mock_bulk):
516516
doc = CarDocument()
517517
car1 = Car()
@@ -525,7 +525,7 @@ def test_should_index_object_is_called(self, mock_bulk):
525525
self.assertEqual(mock_should_index_object.call_count, 3,
526526
"should_index_object is called")
527527

528-
@patch('elasticsearch_dsl.connections.Elasticsearch.bulk')
528+
@patch('elasticsearch.dsl.connections.Elasticsearch.bulk')
529529
def test_should_index_object_working_perfectly(self, mock_bulk):
530530
article1 = Article(slug='article1')
531531
article2 = Article(slug='article2')

tests/test_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from six import StringIO
1212

1313
from elasticsearch.exceptions import NotFoundError
14-
from elasticsearch_dsl import Index as DSLIndex
14+
from elasticsearch.dsl import Index as DSLIndex
1515
from django_elasticsearch_dsl.test import ESTestCase, is_es_online
1616
from tests import ES_MAJOR_VERSION
1717

0 commit comments

Comments
 (0)