Skip to content

Commit be1391b

Browse files
committed
Added better description of global parameters
Fixes elastic#118
1 parent 639aa93 commit be1391b

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

docs/api.rst

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@ that the code makes distinction between positional and keyword arguments; we,
99
however, recommend that people **use keyword arguments for all calls for
1010
consistency and safety**.
1111

12+
.. note::
13+
14+
for compatibility with the Python ecosystem we use ``from_`` instead of
15+
``from`` and ``doc_type`` instead of ``type`` as parameter names.
16+
17+
18+
Global options
19+
--------------
20+
21+
Some parameters are added by the client itself and can be used in all API
22+
calls.
23+
24+
Ignore
25+
~~~~~~
26+
1227
An API call is considered successful (and will return a response) if
1328
elasticsearch returns a 2XX response. Otherwise an instance of
1429
:class:`~elasticsearch.TransportError` (or a more specific subclass) will be
@@ -26,17 +41,25 @@ them::
2641
# ignore 404 and 400
2742
es.indices.delete(index='test-index', ignore=[400, 404])
2843

29-
You can also specify ``request_timeout`` (float) as part of any API call, this
30-
value will get passed to the ``perform_request`` method of the connection
31-
class::
44+
45+
Timeout
46+
~~~~~~~
47+
48+
Global timeout can be set when constructing the client (see
49+
:class:`~elasticsearch.Connection`'s ``timeout`` parameter) or on a per-request
50+
basis using ``request_timeout`` (float value in seconds) as part of any API
51+
call, this value will get passed to the ``perform_request`` method of the
52+
connection class::
3253

3354
# only wait for 1 second, regardless of the client's default
3455
es.cluster.health(wait_for_status='yellow', request_timeout=1)
3556

3657
.. note::
37-
38-
for compatibility with the Python ecosystem we use ``from_`` instead of
39-
``from`` and ``doc_type`` instead of ``type`` as parameter names.
58+
59+
Some API calls also accept a ``timeout`` parameter that is passed to
60+
Elasticsearch server. This timeout is internal and doesn't guarantee that the
61+
request will end in the specified time.
62+
4063

4164
.. py:module:: elasticsearch
4265

0 commit comments

Comments
 (0)