Connecting to Elasticsearch with Java

  1. There are few ways to write JAVA client for Elasticsearch. Here we are using Java High-Level REST Client. Make sure you have Java 1.8 or higher version. In order to use Java High-Level REST Client, you need to add the following dependencies to the project.

  1. Authentication to Elasticsearch Cluster

  1. Connect to cluster

  1. Indexing

  1. Getting a document

Full sample code

Need Support
Learn More

Already have an account?
Login to the Console

Experiencing difficulties on the website or console?
Status page for known incidents

Don’t have an account yet?
Sign up for a free trial

Why sign up?
To experience the ease of creating and managing clusters via the Instaclustr Console.