# From Compass to ElasticSearch

**URL:** <https://discuss.elastic.co/t/from-compass-to-elasticsearch/3764>\
**Category:** Elasticsearch\
**Created:** [January 11, 2011, 3:18pm UTC](https://discuss.elastic.co/t/from-compass-to-elasticsearch/3764 "2011-01-11T15:18:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Barak\_Yaish](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@Barak\_Yaish](https://discuss.elastic.co/u/Barak_Yaish)\
**Post date:** [January 11, 2011, 3:18pm UTC](https://discuss.elastic.co/t/from-compass-to-elasticsearch/3764/1 "2011-01-11T15:18:53Z")

</div>

(I hope this post didn't sent twice..)

Hello,

I would like to migrate an app I wrote using Compass to work with  
ElasticSearch (the Java API).

I did some searches and experiments, but failed to find the answers,  
so can you point me to relevant docs to examples?

My questions are as follow:

1. How do I index complex object (object that contain other objects )  
using the Java API? There are few words on that in the REST API, but  
when I tried to work something with the Java API I got exceptions...

2. How can I declare what object properties are searchable and what  
are not? It it very easy in Compass with the annotations, didn't found  
the relative config in the Java API..

3. Is the Java API allow bulk inserts (transactional)?

Thanks for any help!

---

<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:** [January 11, 2011, 8:12pm UTC](https://discuss.elastic.co/t/from-compass-to-elasticsearch/3764/2 "2011-01-11T20:12:18Z")

</div>

On Tuesday, January 11, 2011 at 5:18 PM, barak wrote:

> (I hope this post didn't sent twice..)
> 
> Hello,
> 
> I would like to migrate an app I wrote using Compass to work with  
> Elasticsearch (the Java API).
> 
> I did some searches and experiments, but failed to find the answers,  
> so can you point me to relevant docs to examples?
> 
> My questions are as follow:
> 
> 1. How do I index complex object (object that contain other objects )  
> using the Java API? There are few words on that in the REST API, but  
> when I tried to work something with the Java API I got exceptions...

Just take that object and convert it to json. Jackson is great at doing that.

> 1. How can I declare what object properties are searchable and what  
> are not? It it very easy in Compass with the annotations, didn't found  
> the relative config in the Java API..

There is the put mapping API. You can find it under client.admin().indices().preparePutMapping. You need to create a json based mapping definition.

> 1. Is the Java API allow bulk inserts (transactional)?

No transaction support on ES, just atomicity per document. There is a bulk API, but its not transactional. In upcoming 0.15 (master) there is support for versioning (optimistic concurrency control in DB lang).

> Thanks for any help!

---

<div class="post-metadata">

**Author:** ![Alois\_Cochard](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alois_cochard/32/3176_2.png) [@Alois\_Cochard](https://discuss.elastic.co/u/Alois_Cochard)\
**Post date:** [January 13, 2011, 2:36pm UTC](https://discuss.elastic.co/t/from-compass-to-elasticsearch/3764/3 "2011-01-13T14:36:20Z")

</div>

Hello,

I'm actually implementing an OSEM for Elasticsearch, It's in early  
phase, but you will be able to use it like you used Compass before  
(annotation based).

I created annotation almost like in compass (even copied some of them  
as is) to define indexing configuration and you will be able to use  
JAXB annotation for serialization specific configuration (used by  
jackson).

Cheers,

Alois Cochard

On Jan 11, 4:18 pm, barak [barak.ya...@gmail.com](mailto:barak.ya...@gmail.com) wrote:

> (I hope this post didn't sent twice..)
> 
> Hello,
> 
> I would like to migrate an app I wrote using Compass to work with  
> Elasticsearch (the Java API).
> 
> I did some searches and experiments, but failed to find the answers,  
> so can you point me to relevant docs to examples?
> 
> My questions are as follow:
> 
> 1. How do I index complex object (object that contain other objects )  
> using the Java API? There are few words on that in the REST API, but  
> when I tried to work something with the Java API I got exceptions...
> 
> 2. How can I declare what object properties are searchable and what  
> are not? It it very easy in Compass with the annotations, didn't found  
> the relative config in the Java API..
> 
> 3. Is the Java API allow bulk inserts (transactional)?
> 
> Thanks for any help!

---

<div class="post-metadata">

**Author:** ![Barak\_Yaish](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@Barak\_Yaish](https://discuss.elastic.co/u/Barak_Yaish)\
**Post date:** [January 16, 2011, 9:20am UTC](https://discuss.elastic.co/t/from-compass-to-elasticsearch/3764/4 "2011-01-16T09:20:32Z")

</div>

This is sounds really nice, can you share your work?

Thanks.

On Jan 13, 4:36 pm, Alois Cochard [alois.coch...@gmail.com](mailto:alois.coch...@gmail.com) wrote:

> Hello,
> 
> I'm actually implementing an OSEM for Elasticsearch, It's in early  
> phase, but you will be able to use it like you used Compass before  
> (annotation based).
> 
> I created annotation almost like in compass (even copied some of them  
> as is) to define indexing configuration and you will be able to use  
> JAXB annotation for serialization specific configuration (used by  
> jackson).
> 
> Cheers,
> 
> Alois Cochard
> 
> On Jan 11, 4:18 pm, barak [barak.ya...@gmail.com](mailto:barak.ya...@gmail.com) wrote:
> 
> > (I hope this post didn't sent twice..)
> 
> > Hello,
> 
> > I would like to migrate an app I wrote using Compass to work with  
> > Elasticsearch (the Java API).
> 
> > I did some searches and experiments, but failed to find the answers,  
> > so can you point me to relevant docs to examples?
> 
> > My questions are as follow:
> 
> > 1. How do I index complex object (object that contain other objects )  
> > using the Java API? There are few words on that in the REST API, but  
> > when I tried to work something with the Java API I got exceptions...
> 
> > 1. How can I declare what object properties are searchable and what  
> > are not? It it very easy in Compass with the annotations, didn't found  
> > the relative config in the Java API..
> 
> > 1. Is the Java API allow bulk inserts (transactional)?
> 
> > Thanks for any help!

---

<div class="post-metadata">

**Author:** ![Mauricio\_Alarcon](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Mauricio\_Alarcon](https://discuss.elastic.co/u/Mauricio_Alarcon)\
**Post date:** [January 28, 2011, 5:12pm UTC](https://discuss.elastic.co/t/from-compass-to-elasticsearch/3764/5 "2011-01-28T17:12:26Z")

</div>

Wow.. Alois I've just read your message, I've been peeking around the  
compass and Elasticsearch thinking to implement the OSEM as well, we  
might be able to work together on this if you want to.

What do you think?

On Jan 13, 9:36 am, Alois Cochard [alois.coch...@gmail.com](mailto:alois.coch...@gmail.com) wrote:

> Hello,
> 
> I'm actually implementing anOSEMfor Elasticsearch, It's in early  
> phase, but you will be able to use it like you used Compass before  
> (annotation based).
> 
> I created annotation almost like in compass (even copied some of them  
> as is) to define indexing configuration and you will be able to use  
> JAXB annotation for serialization specific configuration (used by  
> jackson).
> 
> Cheers,
> 
> Alois Cochard
> 
> On Jan 11, 4:18 pm, barak [barak.ya...@gmail.com](mailto:barak.ya...@gmail.com) wrote:
> 
> > (I hope this post didn't sent twice..)
> 
> > Hello,
> 
> > I would like to migrate an app I wrote using Compass to work with  
> > Elasticsearch (the Java API).
> 
> > I did some searches and experiments, but failed to find the answers,  
> > so can you point me to relevant docs to examples?
> 
> > My questions are as follow:
> 
> > 1. How do I index complex object (object that contain other objects )  
> > using the Java API? There are few words on that in the REST API, but  
> > when I tried to work something with the Java API I got exceptions...
> 
> > 1. How can I declare what object properties are searchable and what  
> > are not? It it very easy in Compass with the annotations, didn't found  
> > the relative config in the Java API..
> 
> > 1. Is the Java API allow bulk inserts (transactional)?
> 
> > Thanks for any help!

---

<div class="post-metadata">

**Author:** ![Alois\_Cochard](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alois_cochard/32/3176_2.png) [@Alois\_Cochard](https://discuss.elastic.co/u/Alois_Cochard)\
**Post date:** [February 2, 2011, 7:22am UTC](https://discuss.elastic.co/t/from-compass-to-elasticsearch/3764/6 "2011-02-02T07:22:15Z")

</div>

I'll open-source it as soon as possible,

I already had a chat with kimchy to be sure to start in the good direction.  
I'm doing it a job and just want to finish the basis before sharing, but unfortunately I wasn't able to work on it last week.

I hope to do it before end of the month, I'll keep in touch guys !!

Would be really happy to have some help on this 🙂

A+

Alois Cochard

---

<div class="post-metadata">

**Author:** ![Mauricio\_Alarcon](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Mauricio\_Alarcon](https://discuss.elastic.co/u/Mauricio_Alarcon)\
**Post date:** [February 3, 2011, 4:41pm UTC](https://discuss.elastic.co/t/from-compass-to-elasticsearch/3764/7 "2011-02-03T16:41:01Z")

</div>

Alois,

I'm eager to start working on that. Looking forward to hearing from  
you. Let me know if you want me to start checking on something.. I  
guess we can discuss it via PM

I'm still on the reading code phase but ready to start hacking the  
code. Hopefully we can do a pull request soon

Mauricio

On Feb 2, 2:22 am, Alois Cochard [alois.coch...@gmail.com](mailto:alois.coch...@gmail.com) wrote:

> I'll open-source it as soon as possible,
> 
> I already had a chat with kimchy to be sure to start in the good direction.  
> I'm doing it a job and just want to finish the basis before sharing, but  
> unfortunately I wasn't able to work on it last week.
> 
> I hope to do it before end of the month, I'll keep in touch guys !!
> 
> Would be really happy to have some help on this 🙂
> 
> A+
> 
> ## Alois Cochard
> 
> View this message in context:[http://elasticsearch-users.115913.n3.nabble.com/From-Compass-to-Elast](http://elasticsearch-users.115913.n3.nabble.com/From-Compass-to-Elast)...  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![Alois\_Cochard](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alois_cochard/32/3176_2.png) [@Alois\_Cochard](https://discuss.elastic.co/u/Alois_Cochard)\
**Post date:** [February 23, 2011, 2:03pm UTC](https://discuss.elastic.co/t/from-compass-to-elasticsearch/3764/8 "2011-02-23T14:03:28Z")

</div>

I've finished a working POC, took some times because I did it on my free time...

Gonna fork ES and add new code before this week-end.

I let you know when code is ready !

See you guys,

Alois Cochard

> **[Alois Cochard's Blog](http://aloiscochard.blogspot.com)**
>
> Computer Development

  
[http://www.twitter.com/aloiscochard](http://www.twitter.com/aloiscochard)

---

<div class="post-metadata">

**Author:** ![Alois\_Cochard](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alois_cochard/32/3176_2.png) [@Alois\_Cochard](https://discuss.elastic.co/u/Alois_Cochard)\
**Post date:** [March 4, 2011, 5:08pm UTC](https://discuss.elastic.co/t/from-compass-to-elasticsearch/3764/9 "2011-03-04T17:08:23Z")

</div>

More info here: [http://groups.google.com/a/elasticsearch.com/group/users/browse\_thread/thread/0bbef0c8f29aa33b#](http://groups.google.com/a/elasticsearch.com/group/users/browse_thread/thread/0bbef0c8f29aa33b#)

On Feb 3, 5:41 pm, maverick [mauricio.alar...@gmail.com](mailto:mauricio.alar...@gmail.com) wrote:

> Alois,
> 
> I'm eager to start working on that. Looking forward to hearing from  
> you. Let me know if you want me to start checking on something.. I  
> guess we can discuss it via PM
> 
> I'm still on the reading code phase but ready to start hacking the  
> code. Hopefully we can do a pull request soon
> 
> Mauricio
> 
> On Feb 2, 2:22 am, Alois Cochard [alois.coch...@gmail.com](mailto:alois.coch...@gmail.com) wrote:
> 
> > I'll open-source it as soon as possible,
> 
> > I already had a chat with kimchy to be sure to start in the good direction.  
> > I'm doing it a job and just want to finish the basis before sharing, but  
> > unfortunately I wasn't able to work on it last week.
> 
> > I hope to do it before end of the month, I'll keep in touch guys !!
> 
> > Would be really happy to have some help on this 🙂
> 
> > A+
> 
> > ## Alois Cochard
> > 
> > View this message in context:[http://elasticsearch-users.115913.n3.nabble.com/From-Compass-to-Elast](http://elasticsearch-users.115913.n3.nabble.com/From-Compass-to-Elast)...  
> > 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:10am UTC](https://discuss.elastic.co/t/from-compass-to-elasticsearch/3764/10 "2017-07-06T04:10:51Z")

</div>


