# Java Integration with Elasticsearch

**URL:** <https://discuss.elastic.co/t/java-integration-with-elasticsearch/129167>\
**Category:** Elasticsearch\
**Created:** [April 23, 2018, 7:21pm UTC](https://discuss.elastic.co/t/java-integration-with-elasticsearch/129167 "2018-04-23T19:21:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![squanchydata](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@squanchydata](https://discuss.elastic.co/u/squanchydata)\
**Post date:** [April 23, 2018, 7:21pm UTC](https://discuss.elastic.co/t/java-integration-with-elasticsearch/129167/1 "2018-04-23T19:21:21Z")

</div>

I am trying to integrate java api with elasticsearch and I'm getting confused by the documentation on the [elastic.co](http://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?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 24, 2018, 4:06am UTC](https://discuss.elastic.co/t/java-integration-with-elasticsearch/129167/2 "2018-04-24T04:06:49Z")

</div>

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

If so, what is the blocker?

---

<div class="post-metadata">

**Author:** ![squanchydata](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@squanchydata](https://discuss.elastic.co/u/squanchydata)\
**Post date:** [April 25, 2018, 6:10pm UTC](https://discuss.elastic.co/t/java-integration-with-elasticsearch/129167/3 "2018-04-25T18:10:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 25, 2018, 7:14pm UTC](https://discuss.elastic.co/t/java-integration-with-elasticsearch/129167/4 "2018-04-25T19:14:13Z")

</div>

You don't know Maven, right?

---

<div class="post-metadata">

**Author:** ![squanchydata](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@squanchydata](https://discuss.elastic.co/u/squanchydata)\
**Post date:** [April 25, 2018, 7:26pm UTC](https://discuss.elastic.co/t/java-integration-with-elasticsearch/129167/5 "2018-04-25T19:26:48Z")

</div>

Not really, no.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 25, 2018, 7:53pm UTC](https://discuss.elastic.co/t/java-integration-with-elasticsearch/129167/6 "2018-04-25T19:53:22Z")

</div>

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:

```auto
<?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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 23, 2018, 7:53pm UTC](https://discuss.elastic.co/t/java-integration-with-elasticsearch/129167/7 "2018-05-23T19:53:35Z")

</div>

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