List of transport classes that can be used, simply import your choice and pass it to the constructor of Elasticsearch as connection_class. Note that Thrift and Memcached protocols are experimental and require a plugin to be installed in your cluster as well as additional dependencies (thrift==0.9 and pylibmc==1.2).
For example to use the thrift connection just import it and use it. The connection classes are aware of their respective default ports (9500 for thrift) so there is no need to specify them unless modified:
from elasticsearch import Elasticsearch, ThriftConnection
es = Elasticsearch(connection_class=ThriftConnection)
Class responsible for maintaining a connection to an Elasticsearch node. It holds persistent connection pool to it and it’s main interface (perform_request) is thread-safe.
Also responsible for logging.
Parameters: |
|
---|
Default connection class using the urllib3 library and the http protocol.
Parameters: |
|
---|
Connection using the requests library.
Parameters: |
|
---|
Connection using the thrift protocol to communicate with elasticsearch.
See https://github.com/elasticsearch/elasticsearch-transport-thrift for additional info.
Parameters: | framed_transport – use TTransport.TFramedTransport instead of TTransport.TBufferedTransport |
---|
Client using the pylibmc python library to communicate with elasticsearch using the memcached protocol. Requires plugin in the cluster.
See https://github.com/elasticsearch/elasticsearch-transport-memcached for more details.