Create a mongo replicaset
tutorial
rsconf = {
_id: "rs0",
members: [
{
_id: 0,
host: "localhost:27017"
}
]
}
rs.initiate( rsconf )
/usr/local/opt/elasticsearch/bin/plugin -install elasticsearch/elasticsearch-lang-javascript/1.2.0
/usr/local/opt/elasticsearch/bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/1.6.0
/usr/local/opt/elasticsearch/bin/plugin -url https://github.com/downloads/richardwilly98/elasticsearch-river-mongodb/elasticsearch-river-mongodb-1.6.1.zip -install river-mongodb
elasticsearch -f -D es.config=/usr/local/opt/elasticsearch/config/elasticsearch.yml
curl -XDELETE 'http://localhost:9200/bms/'
curl -XPUT localhost:9200/bms -d '{
"index.mapper.dynamic": false
}'
curl -XPUT 'http://localhost:9200/bms/bookings/_mapping' -d '
{
"bookings" : {
"properties" : {
ref_anixe: { type: "string", store: "yes" },
ref_castor: { type: "string", store: "yes" },
ref_customer: { type: "string", store: "yes" },
status: { type: "string", store: "yes" },
billing: { type: "object", store: false, enabled: false },
cancellation_fees : { enabled: false },
fares: { type: "object", store: false, enabled: false },
segments: { type: "object", store: false, enabled: false },
services: { type: "object", store: false, enabled: false },
cancellation_fees: { type: "object", store: false, enabled: false },
passengers: { type: "object", store: false, enabled: false }
}
}
}
'
curl -XPUT 'http://localhost:9200/_river/bms/_meta' -d '{
"type": "mongodb",
"mongodb": {
"db": "bms",
"collection": "bookings",
"script": "ctx.document = { ref_anixe: ctx.document.ref_anixe, status: ctx.document.status}"
},
"index": {
"name": "bms",
"type": "bookings"
}
}'