Java API

The Java client uses the transport layer for its operations and supports all kinds of operations. We can make searches, index documents, delete, or get documents including admin tasks on the cluster. We can also perform operations in bulk.

To use the Java API in our application we need to use a few JAR files as the dependency. For a maven project, we can add dependency in our pom.xml as follows:

<dependency> 
        <groupId>org.elasticsearch</groupId> 
        <artifactId>elasticsearch</artifactId> 
        <version>${elasticsearch.version}</version> 
</dependency> 

To include the jar files directly to the project, we can also download from the repository here https://repo.maven.apache.org/maven2/org/elasticsearch/elasticsearch. We can select the version we want ...

Get Mastering Elastic Stack 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.