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 for our application.
One thing to note here is that the client version should be the same as the version of Elasticsearch being used. For example, if we use Elasticsearch...