You can use the Java client in multiple ways:

  • Perform standard index, get, delete and search operations on an existing cluster
  • Perform administrative tasks on a running cluster

Obtaining an elasticsearch Client is simple. The most common way to get a client is by creating a TransportClient that connects to a cluster.


The client must have the same major version (e.g. 2.x, or 5.x) as the nodes in the cluster. Clients may connect to clusters which have a different minor version (e.g. 2.3.x) but it is possible that new functionality may not be supported. Ideally, the client should have the same version as the cluster.


The TransportClient is aimed to be replaced by the Java High Level REST Client, which executes HTTP requests instead of serialized Java requests. The TransportClient will be deprecated in upcoming versions of Elasticsearch and it is advised to use the Java High Level REST Client instead.