# Handling database references in elasticsearch-river-mongodb

**URL:** <https://discuss.elastic.co/t/handling-database-references-in-elasticsearch-river-mongodb/10950>\
**Category:** Elasticsearch\
**Created:** [February 28, 2013, 11:11am UTC](https://discuss.elastic.co/t/handling-database-references-in-elasticsearch-river-mongodb/10950 "2013-02-28T11:11:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![0xff](https://avatars.discourse-cdn.com/v4/letter/0/5fc32e/32.png) [@0xff](https://discuss.elastic.co/u/0xff)\
**Post date:** [February 28, 2013, 11:11am UTC](https://discuss.elastic.co/t/handling-database-references-in-elasticsearch-river-mongodb/10950/1 "2013-02-28T11:11:42Z")

</div>

Hi,

We are using grails, mongodb and elasticsearch in our application and our  
current implementation uses grails-elasticsearch plugin indexing which is  
very slow and CPU intensive.

We index our customer data and we are using mostly database reference in  
our mongodb document instead of embedded collections.

Our Person object will look like,

{ "\_id" : ObjectId( "4e730524744e7ce293099379" ),  
"biography" : { "$ref" : "person",  
"$id" : ObjectId( "4e730524744e7ce29309937a" ) },  
"location" : { "$ref" : "person",  
"$id" : ObjectId( "4e730524744e7ce29309937b" ) },  
"owner" : { "$ref" : "person",  
"$id" : ObjectId( "4e730521744e7ce29309926a" ) },  
"title" : "Jenny Doc",  
"version" : 1,  
"dateCreated" : Date( 1316160804915 ),  
"lastUpdated" : Date( 1316160804915 ) }

and indexed the same way in elasticsearch.

So we are thinking of elasticsearch-mongo river solution but we are not  
quite sure how to index the complete doc in elasticsearch (may be as  
embedded) without database references as they are required for our textual  
search?? we dont know how to solve this issue.

A quick solution i am thinking of is, create a collection with required  
data (from all the references from the person document) and index the  
collection in elasticsearch using river but I am not sure whether it is  
right way of doing it.

Kindly advice. Thanks in advance.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:49am UTC](https://discuss.elastic.co/t/handling-database-references-in-elasticsearch-river-mongodb/10950/2 "2017-07-06T02:49:01Z")

</div>


