@@ -85,8 +85,7 @@ Persistent Connections
85
85
86
86
``elasticsearch-py `` uses persistent connections inside of individual connection
87
87
pools (one per each configured or sniffed node). Out of the box you can choose
88
- to use ``http ``, ``thrift `` or an experimental ``memcached `` protocol to
89
- communicate with the elasticsearch nodes. See :ref: `transports ` for more
88
+ between two ``http `` protocol implementations. See :ref: `transports ` for more
90
89
information.
91
90
92
91
The transport layer will create an instance of the selected connection class
@@ -105,14 +104,6 @@ of the relevant component and pass it in as a parameter to be used instead of
105
104
the default implementation.
106
105
107
106
108
- .. note ::
109
-
110
- Since we use persistent connections throughout the client it means that the
111
- client doesn't tolerate ``fork `` very well. If your application calls for
112
- multiple processes make sure you create a fresh client after call to
113
- ``fork ``.
114
-
115
-
116
107
Automatic Retries
117
108
~~~~~~~~~~~~~~~~~
118
109
@@ -149,8 +140,33 @@ Some example configurations::
149
140
es = Elasticsearch(["seed1", "seed2"], sniff_on_start=True)
150
141
151
142
# you can also sniff periodically and/or after failure:
152
- es = Elasticsearch(["seed1", "seed2"], sniff_on_start=True, sniff_on_connection_fail=True, sniffer_timeout=60)
143
+ es = Elasticsearch(["seed1", "seed2"],
144
+ sniff_on_start=True,
145
+ sniff_on_connection_fail=True,
146
+ sniffer_timeout=60)
147
+
148
+ Thread safety
149
+ ~~~~~~~~~~~~~
153
150
151
+ The client is thread safe and can be used in a multi threaded environment. Best
152
+ practice is to create a single global instance of the client and use it
153
+ throughout your application. If your application is long-running consider
154
+ turning on :ref: `sniffing ` to make sure the client is up to date on the cluster
155
+ location.
156
+
157
+ By default we allow ``urllib3 `` to open up to 10 connections to each node, if
158
+ your application calls for more paralelism, use the ``maxsize `` parameter to
159
+ raise the limit::
160
+
161
+ # allow up to 25 connections to each node
162
+ es = Elasticsearch(["host1", "host2"], maxsize=25)
163
+
164
+ .. note ::
165
+
166
+ Since we use persistent connections throughout the client it means that the
167
+ client doesn't tolerate ``fork `` very well. If your application calls for
168
+ multiple processes make sure you create a fresh client after call to
169
+ ``fork ``.
154
170
155
171
SSL and Authentication
156
172
~~~~~~~~~~~~~~~~~~~~~~
0 commit comments