$ sudo apt-get install nodejs
$ sudo apt-get install npm
$ sudo npm install -g bower
$ sudo apt-get install mongodb
- Open https://github.com/richardwilly98/elasticsearch-river-mongodb#mongodb-river-plugin-for-elasticsearch
- Note the version of MongoDB, ElasticSearch and MongoDB River Plugin
- Download ElasticSearch: http://www.elasticsearch.org/overview/elkdownloads/
- Check MongoDB version for match ElasticSearch and MongoDB River Plugin version
- Unzip and cd to the directory and run
bin/elasticsearch
- Optionally, disable multicast discovery (development) in
config/elasticsearch.yml
- discovery.zen.ping.multicast.enabled: false
cd
to where elasticsearch is unzipped
$ bin/plugin --install elasticsearch/elasticsearch-mapper-attachments/MAPPER_VERSION
- MAPPER_VERSION from https://github.com/elastic/elasticsearch-mapper-attachments#mapper-attachments-type-for-elasticsearch
$ bin/plugin --install com.github.richardwilly98.elasticsearch/elasticsearch-river-mongodb/RIVER_VERSION
-
RIVER_VERSION from https://github.com/richardwilly98/elasticsearch-river-mongodb#mongodb-river-plugin-for-elasticsearch
-
Example: for MongoDB version
3.0.0
use ElasticSearch version1.4.2
and the command lines below
$ bin/plugin --install elasticsearch/elasticsearch-mapper-attachments/2.4.3
$ bin/plugin --install com.github.richardwilly98.elasticsearch/elasticsearch-river-mongodb/2.0.9
- Example: for MongoDB version
2.4.9 -> 2.6.3
use ElasticSearch version1.2.2
and the command lines below
$ bin/plugin --install elasticsearch/elasticsearch-mapper-attachments/2.2.1
$ bin/plugin --install com.github.richardwilly98.elasticsearch/elasticsearch-river-mongodb/2.0.1
$ bin/plugin --install mobz/elasticsearch-head
- You must be using MongoDB replica sets since the River Plugin tails the oplog
- Check
init_sharded_env.24825a3cb9f2.sh
for command to run
$ killall mongod
$ killall mongos
$ rm -rf /data/config
$ rm -rf /data/shard*
$ mkdir -p /data/shard0/rs0 /data/shard0/rs1 /data/shard0/rs2
$ mongod --replSet s0 --logpath "s0-r0.log" --dbpath /data/shard0/rs0 --port 37017 --fork --shardsvr --smallfiles
$ mongod --replSet s0 --logpath "s0-r1.log" --dbpath /data/shard0/rs1 --port 37018 --fork --shardsvr --smallfiles
$ mongod --replSet s0 --logpath "s0-r2.log" --dbpath /data/shard0/rs2 --port 37019 --fork --shardsvr --smallfiles
$ mongo --port 37017
> config = { _id: "s0", members:[
{ _id : 0, host : "localhost:37017" },
{ _id : 1, host : "localhost:37018" },
{ _id : 2, host : "localhost:37019" }]};
> rs.initiate(config)
$ curl -XPUT localhost:9200/_river/enronindex/_meta -d '{
"type": "mongodb",
"mongodb": {
"servers": [{ "host": "127.0.0.1", "port": 37017 }],
"db": "enron",
"collection": "messages"
},
"index": {
"name": "enronindex",
"type": "message"
}
}'
- Download the compressed mongodump data https://s3.amazonaws.com/mongodb-enron-email/enron_mongo.tar.bz2
cd
to the folder containsenron_mongo.tar.br2
. Unzip the compressed file using
$ tar xvfj enron_mongo.tar.bz2
- Import data to mongo using
$ mongorestore --port 37017 -d enron -c messages dump/enron_mail/messages.bson
- To check index of river
http://localhost:9200/_plugin/river-mongodb
- To check index and query
http://localhost:9200/_plugin/head
$ npm install
$ bower install
$ node server
- Then go to
localhost:3000
, type in input textbox for instant search