Skip to content

Commit 0abdded

Browse files
committed
Documentation fixes
1 parent 3aa6a3f commit 0abdded

File tree

2 files changed

+136
-105
lines changed

2 files changed

+136
-105
lines changed

elasticsearch/client/__init__.py

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,40 @@ class Elasticsearch(object):
5656
Elasticsearch low-level client. Provides a straightforward mapping from
5757
Python to ES REST endpoints.
5858
59-
The instance has attributes `indices` and `cluster` that provide access to
60-
:class:`~elasticsearch.client.IndicesClient` and
61-
:class:`~elasticsearch.client.ClusterClient` instances respectively.
59+
The instance has attributes `cat`, `cluster`, `indices`, `nodes` and
60+
`snapshot` that provide access to instances of
61+
:class:`~elasticsearch.client.CatClient`,
62+
:class:`~elasticsearch.client.ClusterClient`,
63+
:class:`~elasticsearch.client.IndicesClient`,
64+
:class:`~elasticsearch.client.NodesClient` and
65+
:class:`~elasticsearch.client.SnapshotClient` respectively. This is the
66+
preferred (and only supported) way to get access to those classes and their
67+
methods.
68+
69+
Some examples::
70+
71+
# create connection to localhost using the ThriftConnection and it's
72+
# default port (9500)
73+
es = Elasticsearch(connection_class=ThriftConnection)
74+
75+
# create connection that will automatically inspect the cluster to get
76+
# the list of active nodes. Start with nodes 'esnode1' and 'esnode2'
77+
es = Elasticsearch(
78+
['esnode1', 'esnode2'],
79+
# sniff before doing anything
80+
sniff_on_start=True,
81+
# refresh nodes after a node fails to respond
82+
sniff_on_connection_fail=True,
83+
# and also every 60 seconds
84+
sniffer_timeout=60
85+
)
86+
87+
# connect to localhost directly and another node using SSL on port 443
88+
# and an url_prefix
89+
es = Elasticsearch([
90+
{'host': 'localhost'},
91+
{'host': 'othernode', 'port': 443, 'url_prefix': 'es', 'use_ssl': True},
92+
])
6293
"""
6394
def __init__(self, hosts=None, transport_class=Transport, **kwargs):
6495
"""

0 commit comments

Comments
 (0)