# Mongodb elasticsearch integration

**URL:** <https://discuss.elastic.co/t/mongodb-elasticsearch-integration/7483>\
**Category:** Elasticsearch\
**Created:** [April 26, 2012, 10:35pm UTC](https://discuss.elastic.co/t/mongodb-elasticsearch-integration/7483 "2012-04-26T22:35:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kara](https://avatars.discourse-cdn.com/v4/letter/k/e480ec/32.png) [@Kara](https://discuss.elastic.co/u/Kara)\
**Post date:** [April 26, 2012, 10:35pm UTC](https://discuss.elastic.co/t/mongodb-elasticsearch-integration/7483/1 "2012-04-26T22:35:57Z")

</div>

I downloaded the [https://github.com/richardwilly98/elasticsearch-river-mongodb/downloads](https://github.com/richardwilly98/elasticsearch-river-mongodb/downloads)  
and tried the example: [https://github.com/richardwilly98/elasticsearch-river-mongodb/blob/master/README.md](https://github.com/richardwilly98/elasticsearch-river-mongodb/blob/master/README.md).  
It failed with on the following command:

curl -XGET "[http://localhost:9200/testmongo/\_search?q=firstName:John](http://localhost:9200/testmongo/_search?q=firstName:John)"  
{"error":"IndexMissingException[[testmongo] missing]","status":404}

Any idea??

I have set the mongodb replica set - so the oplog is present.

Thanks for your help,  
Kara

---

<div class="post-metadata">

**Author:** ![Kara](https://avatars.discourse-cdn.com/v4/letter/k/e480ec/32.png) [@Kara](https://discuss.elastic.co/u/Kara)\
**Post date:** [April 26, 2012, 11:10pm UTC](https://discuss.elastic.co/t/mongodb-elasticsearch-integration/7483/2 "2012-04-26T23:10:32Z")

</div>

I got it. I had to copy the river jar files into the  
elasticsearch-0.19.2/plugins/mongodb\_river directory and restart the  
elasticsearch. You need to create the plugins/mongodb\_river directory  
in the ES\_HOME. It is not there by default.  
Also, the query command should be curl -XGET "[http://localhost:9200/](http://localhost:9200/)  
mongoindex/\_search?q=firstName:John" It should be "mongoindex" not  
"testmongo". Just a minor change in the example

Thanks,  
Kara

On Apr 26, 3:35 pm, Kara [karine.marab...@aero.org](mailto:karine.marab...@aero.org) wrote:

> I downloaded thehttps://github.com/richardwilly98/elasticsearch-river-mongodb/downloads  
> and tried the example:[https://github.com/richardwilly98/elasticsearch-river-mongodb/blob/ma](https://github.com/richardwilly98/elasticsearch-river-mongodb/blob/ma)....  
> It failed with on the following command:
> 
> curl -XGET "[http://localhost:9200/testmongo/\_search?q=firstName:John](http://localhost:9200/testmongo/_search?q=firstName:John)"  
> {"error":"IndexMissingException[[testmongo] missing]","status":404}
> 
> Any idea??
> 
> I have set the mongodb replica set - so the oplog is present.
> 
> Thanks for your help,  
> Kara

---

<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 26, 2012, 11:23pm UTC](https://discuss.elastic.co/t/mongodb-elasticsearch-integration/7483/3 "2012-04-26T23:23:18Z")

</div>

Hi.  
I got it before. And please see this:

> <https://github.com/richardwilly98/elasticsearch-river-mongodb/issues/7>
>
> Hi, I forgot something or did something wrong? there is no search result.
> I goog…le by "elasticsearch IndexMissingException" but can not solve it.
> These(1-5) are what I do:
> 1, bin/mongod --directoryperdb --dbpath=/var/data/db --logpath=/var/data/log/mongodb.log --fork
> 2, bin/elasticsearch
> 3, curl -XPUT 'http://localhost:9200/\_river/mongodb/\_meta' -d '{ 
> "type": "mongodb", 
> "mongodb": { 
> "db": "testmongo", 
> "collection": "person"
> }, 
> "index": {
> "name": "mongoindex", 
> "type": "person" 
> }
> }'
> 4, bin/mongo
> use testmongo
> db.person.save({firstName: "John", lastName: "Doe"})
> 5, curl -XGET "localhost:9200/testmongo/person/\_search?q=firstName:John&pretty=true"
> 
> And I got:
> {
> "error" : "IndexMissingException\[\[testmongo\] missing\]",
> "status" : 404
> }
> When I tail the elasticsearch.log, there are some exceptions:
> java.util.NoSuchElementException
> at java.util.LinkedList$ListItr.next(LinkedList.java:715)
> at com.mongodb.DBCursor.\_next(DBCursor.java:453)
> at com.mongodb.DBCursor.next(DBCursor.java:533)
> at org.elasticsearch.river.mongodb.MongoDBRiver$Slurper.processFullCollection(MongoDBRiver.java:378)
> at org.elasticsearch.river.mongodb.MongoDBRiver$Slurper.run(MongoDBRiver.java:353)
> at java.lang.Thread.run(Thread.java:636)
> \[2012-04-06 18:19:30,636\]\[INFO \]\[river.mongodb \] \[Rama-Tut\] \[mongodb\]\[mongodb\] No known previous slurping time for this collection
> 
> My environment:
> debian 6 64bit
> openjdk 6 64bit
> mongodb 2.0.4 Linux 64-bit
> elasticsearch 0.19.2
> and
> plugin -install elasticsearch/elasticsearch-mapper-attachments/1.2.0
> plugin -install richardwilly98/elasticsearch-river-mongodb/1.1.0
> 
> So, what's my wrong please?

1. mongodb must open the oplog.
2. If you use the example in the github, the index name is mongoindex.

Good Luck. 🙂

在 2012年4月27日 上午6:35，Kara [karine.marabyan@aero.org](mailto:karine.marabyan@aero.org) 写道：

> I downloaded the [https://github.com/richardwilly98/elasticsearch-river-mongodb/downloads](https://github.com/richardwilly98/elasticsearch-river-mongodb/downloads)  
> and tried the example: [https://github.com/richardwilly98/elasticsearch-river-mongodb/blob/master/README.md](https://github.com/richardwilly98/elasticsearch-river-mongodb/blob/master/README.md).  
> It failed with on the following command:
> 
> curl -XGET "[http://localhost:9200/testmongo/\_search?q=firstName:John](http://localhost:9200/testmongo/_search?q=firstName:John)"  
> {"error":"IndexMissingException[[testmongo] missing]","status":404}
> 
> Any idea??
> 
> I have set the mongodb replica set - so the oplog is present.
> 
> Thanks for your help,  
> Kara

---

<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:30am UTC](https://discuss.elastic.co/t/mongodb-elasticsearch-integration/7483/4 "2017-07-06T03:30:59Z")

</div>


