more docs updates

This commit is contained in:
Nick Lang
2017-12-28 12:37:59 -07:00
parent e74457866d
commit 415b3e7dc7
+8 -10
View File
@@ -191,34 +191,32 @@ elasticsearch cluster, including certificate verification and http auth::
# ... or specify common parameters as kwargs # ... or specify common parameters as kwargs
# use certifi for CA certificates
import certifi
es = Elasticsearch( es = Elasticsearch(
['localhost', 'otherhost'], ['localhost', 'otherhost'],
http_auth=('user', 'secret'), http_auth=('user', 'secret'),
scheme="https",
port=443, port=443,
use_ssl=True
) )
# SSL client authentication using client_cert and client_key # SSL client authentication using client_cert and client_key
from elasticsearch.connection.http_urllib3 import create_ssl_context
context = create_ssl_context(cafile="path/to/cert.pem")
es = Elasticsearch( es = Elasticsearch(
['localhost', 'otherhost'], ['localhost', 'otherhost'],
http_auth=('user', 'secret'), http_auth=('user', 'secret'),
scheme="https",
port=443, port=443,
use_ssl=True, ssl_context=context,
ca_certs='/path/to/cacert.pem',
client_cert='/path/to/client_cert.pem',
client_key='/path/to/client_key.pem',
) )
.. warning:: .. warning::
``elasticsearch-py`` doesn't ship with default set of root certificates. To ``elasticsearch-py`` doesn't ship with default set of root certificates. To
have working SSL certificate validation you need to either specify your own have working SSL certificate validation you need to either specify your own
as ``ca_certs`` or install `certifi`_ which will be picked up as ``cafile`` or ``capath`` or ``cadata`` or install `certifi`_ which will
automatically. be picked up automatically.
See class :class:`~elasticsearch.Urllib3HttpConnection` for detailed See class :class:`~elasticsearch.Urllib3HttpConnection` for detailed