File tree 5 files changed +17
-4
lines changed
5 files changed +17
-4
lines changed Original file line number Diff line number Diff line change
1
+ #### 2018-10-02 version 0.3
2
+
3
+ * Fixing connection reset issue when using multi-processing and a remote Elasticsearch server
4
+ * Backward in compatible: changed the way Django configures Elasticsearch connection settings
5
+
1
6
#### 2018-09-26 version 0.2
2
7
3
8
* Adding in post index create/rebuilt ` Controller ` hooks and associated Django signals
Original file line number Diff line number Diff line change 26
26
import logging
27
27
28
28
__appname__ = __package__
29
- __version__ = "0.2 "
29
+ __version__ = "0.3 "
30
30
31
31
app_version = "{}/{}" .format (__appname__ , __version__ )
32
32
Original file line number Diff line number Diff line change @@ -10,13 +10,16 @@ def ready(self):
10
10
from ...utils import register_serializers
11
11
from .settings import (
12
12
ESDOCS_SERIALIZER_MODULES ,
13
- ESDOCS_SERIALIZER_COMPATIBILITY_HOOKS
13
+ ESDOCS_SERIALIZER_COMPATIBILITY_HOOKS ,
14
+ ESDOCS_USING ,
15
+ ESDOCS_CONNECTIONS
14
16
)
15
17
16
18
from elasticsearch_dsl import connections
17
19
# TODO: perhaps have some more elaborate multi-client creation steps here, based on settings?
18
20
# then, we can pass in the 'default' client into `register_serializers`
19
- client = connections .create_connection (hosts = settings .ELASTICSEARCH_SERVER , timeout = 20 )
21
+ connections .configure (** ESDOCS_CONNECTIONS )
22
+ client = connections .get_connection (ESDOCS_USING )
20
23
21
24
# this loads the serializers and initializes compatibility hooks
22
25
register_serializers (ESDOCS_SERIALIZER_MODULES , client = client )
Original file line number Diff line number Diff line change 1
1
from django .conf import settings
2
2
3
+ ESDOCS_USING = getattr (settings , 'ESDOCS_USING' , None ) or 'default'
4
+ ESDOCS_CONNECTIONS = getattr (settings , 'ESDOCS_CONNECTIONS' , {}) or {
5
+ 'default' : 'localhost:9200'
6
+ }
7
+
3
8
ESDOCS_SERIALIZER_MODULES = getattr (settings , 'ESDOCS_SERIALIZER_MODULES' , [])
4
9
ESDOCS_SERIALIZER_COMPATIBILITY_HOOKS = getattr (settings , 'ESDOCS_SERIALIZER_COMPATIBILITY_HOOKS' , []) or [
5
10
'esdocs.contrib.esdjango.compatibility.manager' ,
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ def parallel_prep(self):
34
34
# remove the existing connection (but keeps the _kwargs settings for it
35
35
connections .connections ._conns .pop (label , None )
36
36
# recreate the connection using the retained _kwargs (view the source)
37
- connections .create_connection (label )
37
+ connections .get_connection (label )
38
38
39
39
@property
40
40
def indexes (self ):
You can’t perform that action at this time.
0 commit comments