# Using the elasticsearch-mongodb-river to index multiple collections in the same db

**URL:** https://discuss.elastic.co/t/using-the-elasticsearch-mongodb-river-to-index-multiple-collections-in-the-same-db/7004
**Category:** Elasticsearch
**Created:** [March 14, 2012, 5:37pm UTC](https://discuss.elastic.co/t/using-the-elasticsearch-mongodb-river-to-index-multiple-collections-in-the-same-db/7004 "2012-03-14T17:37:34Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![MoizD](https://avatars.discourse-cdn.com/v4/letter/m/f14d63/32.png) [@MoizD](https://discuss.elastic.co/u/MoizD)
#### Post date: [March 14, 2012, 5:37pm UTC](https://discuss.elastic.co/t/using-the-elasticsearch-mongodb-river-to-index-multiple-collections-in-the-same-db/7004/1 "2012-03-14T17:37:34Z")

</div>

Hello,

I am not sure if this is the right forum for the mongodb river by  
Richard Willy ([https://github.com/richardwilly98/elasticsearch-river-](https://github.com/richardwilly98/elasticsearch-river-)  
mongodb/). I have used it successfully for indexing a single  
collection. However, I can't figure out how to index multiple  
collections from mongodb.

This works for a single collection:  
curl -XPUT '[http://192.168.25.1:9200/\_river/mongodb/\_meta](http://192.168.25.1:9200/_river/mongodb/_meta)' -d '{  
"type": "mongodb",  
"mongodb": {  
"host" : "192.168.25.1",  
"port" : "20020",  
"db": "staging",  
"collection": "discussions"  
},  
"index": {  
"name": "discussions\_idx",  
"type": "discussion"  
}  
}'

When I add another collection for indexing using the following  
command:  
curl -XPUT '[http://192.168.25.1:9200/\_river/mongodb/\_meta](http://192.168.25.1:9200/_river/mongodb/_meta)' -d '{  
"type": "mongodb",  
"mongodb": {  
"host" : "192.168.25.1",  
"port" : "20020",  
"db": "staging",  
"collection": "users"  
},  
"index": {  
"name": "users\_idx",  
"type": "user"  
}  
}'

Nothing happens and the index is not created. I am using the latest  
version of the river from github on ES 0.19.0

Thanks,

-moizd

---

<div class="post-metadata">

### Author: ![Corey\_Thompson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/corey_thompson/32/2582_2.png) [@Corey\_Thompson](https://discuss.elastic.co/u/Corey_Thompson)
#### Post date: [December 12, 2012, 10:16pm UTC](https://discuss.elastic.co/t/using-the-elasticsearch-mongodb-river-to-index-multiple-collections-in-the-same-db/7004/2 "2012-12-12T22:16:40Z")

</div>

Any solution for this? Seems odd that a river can only watch a single  
collection.

Corey

On Wednesday, March 14, 2012 12:37:34 PM UTC-5, MoizD wrote:

> Hello,
> 
> I am not sure if this is the right forum for the mongodb river by  
> Richard Willy ([https://github.com/richardwilly98/elasticsearch-river-](https://github.com/richardwilly98/elasticsearch-river-)  
> mongodb/ [https://github.com/richardwilly98/elasticsearch-river-mongodb/](https://github.com/richardwilly98/elasticsearch-river-mongodb/)).  
> I have used it successfully for indexing a single  
> collection. However, I can't figure out how to index multiple  
> collections from mongodb.
> 
> This works for a single collection:  
> curl -XPUT '[http://192.168.25.1:9200/\_river/mongodb/\_meta](http://192.168.25.1:9200/_river/mongodb/_meta)' -d '{  
> "type": "mongodb",  
> "mongodb": {  
> "host" : "192.168.25.1",  
> "port" : "20020",  
> "db": "staging",  
> "collection": "discussions"  
> },  
> "index": {  
> "name": "discussions\_idx",  
> "type": "discussion"  
> }  
> }'
> 
> When I add another collection for indexing using the following  
> command:  
> curl -XPUT '[http://192.168.25.1:9200/\_river/mongodb/\_meta](http://192.168.25.1:9200/_river/mongodb/_meta)' -d '{  
> "type": "mongodb",  
> "mongodb": {  
> "host" : "192.168.25.1",  
> "port" : "20020",  
> "db": "staging",  
> "collection": "users"  
> },  
> "index": {  
> "name": "users\_idx",  
> "type": "user"  
> }  
> }'
> 
> Nothing happens and the index is not created. I am using the latest  
> version of the river from github on ES 0.19.0
> 
> Thanks,
> 
> -moizd

--

---

<div class="post-metadata">

### Author: ![Corey\_Thompson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/corey_thompson/32/2582_2.png) [@Corey\_Thompson](https://discuss.elastic.co/u/Corey_Thompson)
#### Post date: [December 12, 2012, 10:35pm UTC](https://discuss.elastic.co/t/using-the-elasticsearch-mongodb-river-to-index-multiple-collections-in-the-same-db/7004/3 "2012-12-12T22:35:03Z")

</div>

The rivers must have different names. See how the URL is different than  
your example. Also, in the example below, notice that the index:name can  
be the same between the two - just use different types.

From: [data being indexed on elasticsearch does not get pushed to mongodb · Issue #32 · richardwilly98/elasticsearch-river-mongodb · GitHub](https://github.com/richardwilly98/elasticsearch-river-mongodb/issues/32)

curl -XPUT '[http://192.168.25.1:9200/\_river/discussion/\_meta](http://192.168.25.1:9200/_river/discussion/_meta)' -d '{  
"type": "mongodb",  
"mongodb": {  
"host" : "192.168.25.1",  
"port" : "20020",  
"db": "staging",  
"collection": "discussions"  
},  
"index": {  
"name": "my\_apps\_index",  
"type": "discussion"  
}  
}'

When I add another collection for indexing using the following  
command:  
curl -XPUT '[http://192.168.25.1:9200/\_river/user/\_meta](http://192.168.25.1:9200/_river/user/_meta)' -d '{  
"type": "mongodb",  
"mongodb": {  
"host" : "192.168.25.1",  
"port" : "20020",  
"db": "staging",  
"collection": "users"  
},  
"index": {  
"name": "my\_apps\_index",  
"type": "user"  
}  
}'

On Wednesday, March 14, 2012 12:37:34 PM UTC-5, MoizD wrote:

> Hello,
> 
> I am not sure if this is the right forum for the mongodb river by  
> Richard Willy ([https://github.com/richardwilly98/elasticsearch-river-](https://github.com/richardwilly98/elasticsearch-river-)  
> mongodb/ [https://github.com/richardwilly98/elasticsearch-river-mongodb/](https://github.com/richardwilly98/elasticsearch-river-mongodb/)).  
> I have used it successfully for indexing a single  
> collection. However, I can't figure out how to index multiple  
> collections from mongodb.
> 
> This works for a single collection:  
> curl -XPUT '[http://192.168.25.1:9200/\_river/mongodb/\_meta](http://192.168.25.1:9200/_river/mongodb/_meta)' -d '{  
> "type": "mongodb",  
> "mongodb": {  
> "host" : "192.168.25.1",  
> "port" : "20020",  
> "db": "staging",  
> "collection": "discussions"  
> },  
> "index": {  
> "name": "discussions\_idx",  
> "type": "discussion"  
> }  
> }'
> 
> When I add another collection for indexing using the following  
> command:  
> curl -XPUT '[http://192.168.25.1:9200/\_river/mongodb/\_meta](http://192.168.25.1:9200/_river/mongodb/_meta)' -d '{  
> "type": "mongodb",  
> "mongodb": {  
> "host" : "192.168.25.1",  
> "port" : "20020",  
> "db": "staging",  
> "collection": "users"  
> },  
> "index": {  
> "name": "users\_idx",  
> "type": "user"  
> }  
> }'
> 
> Nothing happens and the index is not created. I am using the latest  
> version of the river from github on ES 0.19.0
> 
> Thanks,
> 
> -moizd

--

---

<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, 3:00am UTC](https://discuss.elastic.co/t/using-the-elasticsearch-mongodb-river-to-index-multiple-collections-in-the-same-db/7004/4 "2017-07-06T03:00:03Z")

</div>


