# Indexing Lucene documents

**URL:** <https://discuss.elastic.co/t/indexing-lucene-documents/3534>\
**Category:** Elasticsearch\
**Created:** [November 8, 2010, 4:19pm UTC](https://discuss.elastic.co/t/indexing-lucene-documents/3534 "2010-11-08T16:19:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![IvanBrusic](https://avatars.discourse-cdn.com/v4/letter/i/ecae2f/32.png) [@IvanBrusic](https://discuss.elastic.co/u/IvanBrusic)\
**Post date:** [November 8, 2010, 4:19pm UTC](https://discuss.elastic.co/t/indexing-lucene-documents/3534/1 "2010-11-08T16:19:01Z")

</div>

I am looking to transition an existing application from Lucene to  
ElasticSearch. The main reasons are to support multiple indexes (one  
per user) and have a service oriented architecture instead of having  
embedded Lucene instances since there will be more than one  
application using the search service. The current index is  
(relatively) small, but will grow soon. Sharding might not be  
necessary, but have high availability is always a plus.

Back on topic: there is currently logic in place to translate a  
MongoDB document into a Lucene document. Given the schema-less nature  
of Mongo, there is quite a bit of code for the translation (around 500  
LOC). I am using the Java API to communicate to an external (but  
still localhost) ES instance, not REST (for now). ES ultimately  
creates a Lucene document for the JSON document that is past in, so I  
was wondering if there was a way to bypass that step and send a Lucene  
document? I do see a DocumentBuilder class, but I do not see it used  
anywhere in the code (using 0.12.1).

I can always iterate through the document fields and call field(name,  
value), but wondering if is was necessary. Could always convert the  
existing logic in a JSON translation as well.

Cheers,

Ivan

---

<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:** [November 8, 2010, 9:59pm UTC](https://discuss.elastic.co/t/indexing-lucene-documents/3534/2 "2010-11-08T21:59:21Z")

</div>

Hi,

You will need to create the json document. Passing a Lucene Document is  
not really an option since there is metadata associated with the mapping  
that is built during the parsing of the json.

-shay.banon

On Mon, Nov 8, 2010 at 6:19 PM, Ivan Brusic [ivan\_brusic@yahoo.com](mailto:ivan_brusic@yahoo.com) wrote:

> I am looking to transition an existing application from Lucene to  
> Elasticsearch. The main reasons are to support multiple indexes (one  
> per user) and have a service oriented architecture instead of having  
> embedded Lucene instances since there will be more than one  
> application using the search service. The current index is  
> (relatively) small, but will grow soon. Sharding might not be  
> necessary, but have high availability is always a plus.
> 
> Back on topic: there is currently logic in place to translate a  
> MongoDB document into a Lucene document. Given the schema-less nature  
> of Mongo, there is quite a bit of code for the translation (around 500  
> LOC). I am using the Java API to communicate to an external (but  
> still localhost) ES instance, not REST (for now). ES ultimately  
> creates a Lucene document for the JSON document that is past in, so I  
> was wondering if there was a way to bypass that step and send a Lucene  
> document? I do see a DocumentBuilder class, but I do not see it used  
> anywhere in the code (using 0.12.1).
> 
> I can always iterate through the document fields and call field(name,  
> value), but wondering if is was necessary. Could always convert the  
> existing logic in a JSON translation as well.
> 
> Cheers,
> 
> Ivan

---

<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:16am UTC](https://discuss.elastic.co/t/indexing-lucene-documents/3534/3 "2017-07-06T04:16:55Z")

</div>


