Creating an HTTP client

An HTTP client is one of the easiest clients to create. It's very handy because it allows calling not only internal methods as the native protocol does, but also third-party calls implemented in plugins that can be called only via HTTP.

Getting ready

You will need a working ElasticSearch cluster and Maven installed. The code of this recipe is in the chapter_10/http_client directory, present in the code bundle available on the Packt website and on GitHub (https://github.com/aparo/elasticsearch-cookbook-second-edition).

How to do it...

To create an HTTP client, we will perform the following steps:

  1. For these examples, we have chosen the Apache HttpComponents, one of the most widely used libraries for executing HTTP calls. This ...

Get ElasticSearch Cookbook - Second 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.