# Fetch data from elastic search to java application

**URL:** <https://discuss.elastic.co/t/fetch-data-from-elastic-search-to-java-application/174536>\
**Category:** Elasticsearch\
**Created:** [March 29, 2019, 12:32pm UTC](https://discuss.elastic.co/t/fetch-data-from-elastic-search-to-java-application/174536 "2019-03-29T12:32:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mangesh\_Panchwagh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mangesh_panchwagh/32/43087_2.png) [@Mangesh\_Panchwagh](https://discuss.elastic.co/u/Mangesh_Panchwagh)\
**Post date:** [March 29, 2019, 12:32pm UTC](https://discuss.elastic.co/t/fetch-data-from-elastic-search-to-java-application/174536/1 "2019-03-29T12:32:52Z")

</div>

Hi,  
I am new to elasticsearch. I am building an application which uploads the resumes. Then I will fetch the resume of particular candidate using some filters like firstname, lastname etc. I am able to push my postgres data to the elasticsearch(can able to access it through browser URL. Also I have created indexes). I am able to fetch data from postgres to user interface. What I want is when i search it will search from elasticsearch . How do I achieve it.?

Can you please help me regarding this.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)\
**Post date:** [March 29, 2019, 12:46pm UTC](https://discuss.elastic.co/t/fetch-data-from-elastic-search-to-java-application/174536/2 "2019-03-29T12:46:08Z")

</div>

Hi,

Are you facing a particular problem or do you need a general direction? Have you already looked at the official Java client: [https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.7/java-rest-high.html](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.7/java-rest-high.html) ?

Best regards  
Wolfram

---

<div class="post-metadata">

**Author:** ![Mangesh\_Panchwagh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mangesh_panchwagh/32/43087_2.png) [@Mangesh\_Panchwagh](https://discuss.elastic.co/u/Mangesh_Panchwagh)\
**Post date:** [March 29, 2019, 12:56pm UTC](https://discuss.elastic.co/t/fetch-data-from-elastic-search-to-java-application/174536/3 "2019-03-29T12:56:16Z")

</div>

I want a general direction. I have installed elasticsearch,created indexes in it which consists my data from postgres db.(For each table created one index). Can able to access those indexes from browser using 9200 port. I am not getting how do I configure in my application so that my fetch will fetch data from elasticsearch instead of from db. I want to index document which is the resume document, which i am able to parse and store in postgres db. But how do I integrate it with my searchbox from UI with elasticsearch.?

---

<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:** [March 29, 2019, 8:58pm UTC](https://discuss.elastic.co/t/fetch-data-from-elastic-search-to-java-application/174536/4 "2019-03-29T20:58:49Z")

</div>

I do have a sample project here:

> **[dadoonet/legacy-search](https://github.com/dadoonet/legacy-search/tree/06-fuzziness)**
>
> Demo project showing how to add elasticsearch to a legacy application. - dadoonet/legacy-search

Here is the search part in the service layer:

> <https://github.com/dadoonet/legacy-search/blob/06-fuzziness/src/main/java/fr/pilato/demo/legacysearch/service/PersonService.java#L100-L129>

The search part in the DAO layer:

> <https://github.com/dadoonet/legacy-search/blob/06-fuzziness/src/main/java/fr/pilato/demo/legacysearch/dao/ElasticsearchDao.java#L99-L129>

The Web part:

> **[dadoonet/legacy-search](https://github.com/dadoonet/legacy-search/tree/06-fuzziness/src/main/resources/static/search)**
>
> Demo project showing how to add elasticsearch to a legacy application. - dadoonet/legacy-search

HTH

---

<div class="post-metadata">

**Author:** ![Mangesh\_Panchwagh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mangesh_panchwagh/32/43087_2.png) [@Mangesh\_Panchwagh](https://discuss.elastic.co/u/Mangesh_Panchwagh)\
**Post date:** [April 1, 2019, 6:30am UTC](https://discuss.elastic.co/t/fetch-data-from-elastic-search-to-java-application/174536/5 "2019-04-01T06:30:38Z")

</div>

Thank you David Pilato, I will see the git hub code as a reference project.

---

<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:** [April 29, 2019, 6:30am UTC](https://discuss.elastic.co/t/fetch-data-from-elastic-search-to-java-application/174536/6 "2019-04-29T06:30:42Z")

</div>

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