Here how to do this on mongodb 3.0. I used this nice blog
$ mkdir RANDOM_PATH/node1 $ mkdir RANDOM_PATH/node2> $ mkdir RANDOM_PATH/node3
$ mongod --replSet test --port 27021 --dbpath node1 $ mongod --replSet test --port 27022 --dbpath node2 $ mongod --replSet test --port 27023 --dbpath node3
$ mongo config = {_id: 'test', members: [ {_id: 0, host: 'localhost:27021'}, {_id: 1, host: 'localhost:27022'}]}; rs.initiate(config);
a. Download and unzip the [latest Elasticsearch][2] distribution b. Run bin/elasticsearch to start the es server. c. Run curl -XGET http://localhost:9200/ to confirm it is working.
$ bin/plugin --install com.github.richardwilly98.elasticsearch/elasticsearch-river-mongodb
$ bin/plugin --install elasticsearch/elasticsearch-mapper-attachments
curl -XPUT 'http://localhost:8080/_river/mongodb/_meta' -d '{ "type": "mongodb", "mongodb": { "db": "mydb", "collection": "foo" }, "index": { "name": "name", "type": "random" } }'
Test on browser: