# Using elasticsearch embedded

**URL:** <https://discuss.elastic.co/t/using-elasticsearch-embedded/23962>\
**Category:** Elasticsearch\
**Created:** [June 19, 2015, 3:44am UTC](https://discuss.elastic.co/t/using-elasticsearch-embedded/23962 "2015-06-19T03:44:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maatari](https://avatars.discourse-cdn.com/v4/letter/m/c77e96/32.png) [@Maatari](https://discuss.elastic.co/u/Maatari)\
**Post date:** [June 19, 2015, 3:44am UTC](https://discuss.elastic.co/t/using-elasticsearch-embedded/23962/1 "2015-06-19T03:44:48Z")

</div>

Hi,

I'm trying to figure out how to embed elasticsearch in my java/scala application.

Although i found some code about the client API i'm still confused.

1 - I would like to create only one data node, and i would like it to be persistent in the sense that, each time i would start my application and give a data path it should load the data from there.

I know that elasticsearch work with the disk, i just don't see from the example i red how to specify the path and all this things.

2 - Also, Can that one node be the master node and data node at the same time. Then Can i get a client out of it with node.client() ?

Finally, any tutorial recommendation ? examples? Where is the javadoc, shall i generate it myself, no version online ?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 19, 2015, 7:27am UTC](https://discuss.elastic.co/t/using-elasticsearch-embedded/23962/2 "2015-06-19T07:27:33Z")

</div>

1. You can set `path.data` to tell ES where to store and read said data.
2. Yes that is all possible.

Have you looked at [https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/index.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/index.html)?

---

<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:** [July 6, 2017, 12:06am UTC](https://discuss.elastic.co/t/using-elasticsearch-embedded/23962/3 "2017-07-06T00:06:31Z")

</div>


