# How can I use elasticsearch-river-mongodb to search more collections?

**URL:** https://discuss.elastic.co/t/how-can-i-use-elasticsearch-river-mongodb-to-search-more-collections/7343
**Category:** Elasticsearch
**Created:** [April 16, 2012, 8:24am UTC](https://discuss.elastic.co/t/how-can-i-use-elasticsearch-river-mongodb-to-search-more-collections/7343 "2012-04-16T08:24:32Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![lsx](https://avatars.discourse-cdn.com/v4/letter/l/e36b37/32.png) [@lsx](https://discuss.elastic.co/u/lsx)
#### Post date: [April 16, 2012, 8:24am UTC](https://discuss.elastic.co/t/how-can-i-use-elasticsearch-river-mongodb-to-search-more-collections/7343/1 "2012-04-16T08:24:32Z")

</div>

Hi.  
I use the elasticsearch-river-mongodb plugin with elasticsearch-0.19.2, now I have some collections with mongodb:  
person, post, comment.

Then, I use these:  
curl -XPUT "localhost:9200/\_river/mongodb/\_meta" -d '  
{  
type: "mongodb",  
mongodb: {  
db: "myblog",  
host: "127.0.0.1",  
port: 27017,  
collection: "person"  
},  
index: {  
name: "person",  
type: "person"  
}  
}'  
curl -XPUT "localhost:9200/\_river/mongodb/\_meta" -d '  
{  
type: "mongodb",  
mongodb: {  
db: "myblog",  
host: "127.0.0.1",  
port: 27017,  
collection: "post"  
},  
index: {  
name: "post",  
type: "post"  
}  
}'  
curl -XPUT "localhost:9200/\_river/mongodb/\_meta" -d '  
{  
type: "mongodb",  
mongodb: {  
db: "myblog",  
host: "127.0.0.1",  
port: 27017,  
collection: "comment"  
},  
index: {  
name: "comment",  
type: "comment"  
}  
}'

Then, I use java to test it:  
Node node = nodeBuilder().node();  
Client client = node.client();  
InternalSearchResponse response = client.prepareSearch("person")  
.setQuery(termQuery("\_all", "myname"))  
.setFrom(0).setSize(10).setExplain(true)  
.execute()  
.actionGet();

It can get the response, it works good.

But then, I test the post and the comment:  
Node node = nodeBuilder().node();  
Client client = node.client();  
InternalSearchResponse response = client.prepareSearch("post")  
.setQuery(termQuery("\_all", "mypost"))  
.setFrom(0).setSize(10).setExplain(true)  
.execute()  
.actionGet();

It say the index missing. (org.elasticsearch.indices.IndexMissingException: [post] missing), and I see the dir, there is a dir named "person", but no "post" or "comment". I see only the **first** operation can work good.

So what am I missing or did wrong please?  
Thanks a lot. 🙂

---

<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:32am UTC](https://discuss.elastic.co/t/how-can-i-use-elasticsearch-river-mongodb-to-search-more-collections/7343/2 "2017-07-06T03:32:28Z")

</div>


