Creating an HTTP Elasticsearch client

With Elasticsearch 5.x, the Elasticsearch team has provided a custom low-level HTTP client to communicate with Elasticsearch. Its main features are as follows:

  • Minimal dependencies
  • Load balancing across all available nodes
  • Failover in the case of node failures and upon specific response codes
  • Failed connection penalization (whether a failed node is retried depends on how many consecutive times it failed; the more failed attempts, the longer the client will wait before trying that same node again)
  • Persistent connections
  • Trace logging of requests and responses
  • Optional automatic discovery of cluster nodes

Getting ready

You need an up-and-running Elasticsearch installation as we described in the Downloading and installing ...

Get Elasticsearch 5.x Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.