Java Integration with Elasticsearch

I am trying to integrate java api with elasticsearch and I'm getting confused by the documentation on the elastic.co website. So I downloaded maven but I don't know where to place the maven dependency, on what pom.xml file. I only have a pom.xml file when I downloaded logstash and my-sql-connector.

After placing the maven dependency clause into the pom.xml file, what is the next step to to fire java api requests to elasticsearch/kibana?

Did you read this guide? https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/index.html

If so, what is the blocker?

I still don't know what to do after looking at this guide. Do you have to write out a RESTbuilder class on a java file?

You don't know Maven, right?

Not really, no.

So it'd be better to first understand how Maven works. Lot of documentation is available about it on internet.

In short, create a pom.xml file like:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>fr.pilato.demo</groupId>
    <artifactId>legacy-search</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>6.2.4</version>
        </dependency>
    </dependencies>

</project>

And that should help you importing the needed libs and start using the Rest Client.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.