Creating a client
The official ElasticSearch clients are designed to use several transport layers. They allow using the HTTP, thrift or memcached protocol without changing your application code.
The thrift and memcached protocols are binary ones and due to their structures they are generally a bit faster than the HTTP one. They wrap the REST API and share the same behavior so that switching between protocols is very easy.
In this recipe, we'll see how to instantiate a client with different protocols.
Getting ready
You need a working ElasticSearch cluster and plugins for extra protocols. The full code of this recipe is in the chapter_11/client_creation.py
file.
How to do it...
For creating a client, we need to perform the following steps:
- Before using the Python client, it is required to install it (possibly in a Python virtual environment). The client is officially hosted on PyPi (http://pypi.python.org/) and it's easy to install with the following
pip
command:pip install elasticsearch...