user644745
user644745

Reputation: 5713

mongodb river for elasticsearch

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?

Upvotes: 3

Views: 3758

Answers (4)

krishna kumar
krishna kumar

Reputation: 1230

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.

Upvotes: 0

Akhavi
Akhavi

Reputation: 41

There is a new MongoDB river on github:

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

Upvotes: 4

Oren Mazor
Oren Mazor

Reputation: 4477

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

Upvotes: 0

Related Questions