3

Is there any official mongodb river available for elasticsearch ? I am using mongodb in node.js through the module mogoose. I have seen one in http://www.matt-reid.co.uk/blog_post.php?id=68

Is this the correct one ? It says unofficial though...

Edit: looks like, https://github.com/aparo/elasticsearch has inbuilt mongodb plugin.. Is there any doc available about how to configure this with mongodb and how mongodb pushes data for indexing to elasticsearch?

4 Answers 4

4

There is a new MongoDB river on github:

https://github.com/richardwilly98/elasticsearch-river-mongodb

Sign up to request clarification or add additional context in comments.

Comments

1

according to the code you can specify several things but there is no separate doc (expect one mailing list discussion):

https://github.com/aparo/elasticsearch/blob/master/plugins/river/mongodb/src/main/java/org/elasticsearch/river/mongodb/MongoDBRiver.java

https://github.com/aparo/elasticsearch/blob/master/plugins/river/mongodb/src/test/java/org/elasticsearch/river/mongodb/MongoDBRiverTest.java

Comments

0

This isn't really the answer you're looking for. I looked at building this mongo river but I found some discussion on it having some memory leaks and I didn't want to fiddle with Java code. I wrote my own mongo->ES importer using the bulk API.

It's a work in progress, so feel free to contribute! :)

https://github.com/orenmazor/elastic-search-loves-mongo

Comments

0

Yes, There is a new MongoDB river on github:

https://github.com/richardwilly98/elasticsearch-river-mongodb

For Further Explanation You can follow below steps:

Step.1: -Install

ES_HOME/bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/1.4.0 
ES_HOME/bin/plugin -install richardwilly98/elasticsearch-river-mongodb/1.4.0

Step.2: -Restart Elasticsearch

ES_HOME/bin/service/elasticsearch restart

Step.3: -Enable replica sets in mongodb

go to mongod.conf & Add line

replSet=rs0

save & Exit

Restart mongod

Step.4: -Tell elasticsearch to index the “person” collection in testmongo database by issuing the following command in your terminal

curl -XPUT 'http://localhost:9200/_river/mongodb/_meta' -d '{ 
    "type": "mongodb", 
    "mongodb": { 
        "db": "testmongo", 
        "collection": "person"
    }, 
    "index": {
        "name": "mongoindex", 
        "type": "person" 
    }
}'

Step.5: -add some data to the mongodb through mongo terminal

use testmongo
var p = {firstName: "John", lastName: "Doe"}
db.person.save(p)

Step.6: -Use this command to search the data

curl -XGET 'http://localhost:9200/mongoindex/_search?q=firstName:John'

NOTE:

DELETE /_river

DELETE/_mongoindex

Again run this command,

curl -XPUT 'http://localhost:9200/_river/mongodb/_meta' -d '{ 
    "type": "mongodb", 
    "mongodb": { 
        "db": "testmongo", 
        "collection": "person"
    }, 
    "index": {
        "name": "mongoindex", 
        "type": "person" 
    }
}'

Step.7: -See HQ Plugin

In mongoindex, you will get your data.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.