# Tutorial/example of embedding?

**URL:** <https://discuss.elastic.co/t/tutorial-example-of-embedding/4343>\
**Category:** Elasticsearch\
**Created:** [May 4, 2011, 12:04pm UTC](https://discuss.elastic.co/t/tutorial-example-of-embedding/4343 "2011-05-04T12:04:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bimargulies](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bimargulies/32/3231_2.png) [@bimargulies](https://discuss.elastic.co/u/bimargulies)\
**Post date:** [May 4, 2011, 12:04pm UTC](https://discuss.elastic.co/t/tutorial-example-of-embedding/4343/1 "2011-05-04T12:04:27Z")

</div>

I want to hide an elastic search instance entirely within my own  
webapp. Googling shows evidence that this is possible, but I'd be  
grateful for a straight-up example.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [May 4, 2011, 4:36pm UTC](https://discuss.elastic.co/t/tutorial-example-of-embedding/4343/2 "2011-05-04T16:36:22Z")

</div>

[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/).  
On Wednesday, May 4, 2011 at 3:04 PM, bimargulies wrote:

> I want to hide an Elasticsearch instance entirely within my own  
> webapp. Googling shows evidence that this is possible, but I'd be  
> grateful for a straight-up example.

---

<div class="post-metadata">

**Author:** ![d95sld95](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@d95sld95](https://discuss.elastic.co/u/d95sld95)\
**Post date:** [May 16, 2011, 4:01pm UTC](https://discuss.elastic.co/t/tutorial-example-of-embedding/4343/3 "2011-05-16T16:01:15Z")

</div>

The Java API seems to only deal with the client side. Is there a way to  
embedded the elastic search jar-file into a Web Application have its  
lifetime managed by Spring Framework for example.

What class is the bootstrap class? org.elasticsearch.bootstrap.Bootstrap?

Any settings necessary for running embedded?

--  
View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/tutorial-example-of-embedding-tp2898482p2948551.html](http://elasticsearch-users.115913.n3.nabble.com/tutorial-example-of-embedding-tp2898482p2948551.html)  
Sent from the ElasticSearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [May 17, 2011, 8:37pm UTC](https://discuss.elastic.co/t/tutorial-example-of-embedding/4343/4 "2011-05-17T20:37:44Z")

</div>

Yes, you can simply start a Node using the NodeBuilder without setting it to be a client node.  
On Monday, May 16, 2011 at 7:01 PM, d95sld95 wrote:

> The Java API seems to only deal with the client side. Is there a way to  
> embedded the Elasticsearch jar-file into a Web Application have its  
> lifetime managed by Spring Framework for example.
> 
> What class is the bootstrap class? org.elasticsearch.bootstrap.Bootstrap?
> 
> Any settings necessary for running embedded?
> 
> --  
> View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/tutorial-example-of-embedding-tp2898482p2948551.html](http://elasticsearch-users.115913.n3.nabble.com/tutorial-example-of-embedding-tp2898482p2948551.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![James\_Cook](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@James\_Cook](https://discuss.elastic.co/u/James_Cook)\
**Post date:** [May 17, 2011, 10:38pm UTC](https://discuss.elastic.co/t/tutorial-example-of-embedding/4343/5 "2011-05-17T22:38:21Z")

</div>

Here is how I do it:

```
<!--

```

* * *

--\>  
  
\<!--

* * *

--\>

```
<bean id="elasticSearchConfiguration"

```

class="org.springframework.beans.factory.config.PropertiesFactoryBean"\>  
  
  
  
  
${webapp.root}/WEB-INF/config

```
<bean id="esServer" class="my.elasticsearch.ElasticSearchServer"
      init-method="start" destroy-method="stop">
    <constructor-arg ref="elasticSearchConfiguration"/>
</bean>

```

and here is a gist for the code to ElasticSearchServer.java:

> <https://gist.github.com/oravecz/977580>

-- jim

On Tue, May 17, 2011 at 4:37 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> Yes, you can simply start a Node using the NodeBuilder without setting it  
> to be a client node.
> 
> On Monday, May 16, 2011 at 7:01 PM, d95sld95 wrote:
> 
> The Java API seems to only deal with the client side. Is there a way to  
> embedded the Elasticsearch jar-file into a Web Application have its  
> lifetime managed by Spring Framework for example.
> 
> What class is the bootstrap class? org.elasticsearch.bootstrap.Bootstrap?
> 
> Any settings necessary for running embedded?
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/tutorial-example-of-embedding-tp2898482p2948551.html](http://elasticsearch-users.115913.n3.nabble.com/tutorial-example-of-embedding-tp2898482p2948551.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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, 4:05am UTC](https://discuss.elastic.co/t/tutorial-example-of-embedding/4343/6 "2017-07-06T04:05:54Z")

</div>


