O'Reilly logo

Elasticsearch 5.x Cookbook - Third Edition by Alberto Paro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a native client

There are two ways to create a native client to communicate with an Elasticsearch server:

  • Creating a transport client: This is a standard client that requires the address and port of nodes to connect to.
  • Creating a client or coordinating only one node (it's a node that is not a data, master, or ingest node) and get the client from it. This node will appear in the cluster state nodes and can use the discovery capabilities of Elasticsearch to join the cluster (so no node address is required to connect to a cluster). This kind of client can reduce node routing due to knowledge of cluster topology. It can also load Elasticsearch plugins.

In this recipe, we will see how to create these clients.

Getting ready

You need an up-and-running ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required