Creating a client
The official ElasticSearch clients are designed to support several transport layers. They allow you to use HTTP, Thrift, or the 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 are wrapped in the REST API and share the same behavior, so switching between these protocols is easy.
In this recipe, we'll see how to instantiate a client with the different protocols.
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, available in the code bundle of this book and on GitHub (https://github.com/aparo/elasticsearch-cookbook-second-edition ...