0
votes

I have ElasticSearch cluster with 3 nodes and MongoDb ReplicaSet with 3 nodes. I'm trying to setup river with this config:

curl -XPUT "elasticsearch1:9200/_river/mongodb/_meta" -d '{
  "type": "mongodb",
 "servers":
    [
      { "host": "mongodb-serv1", "port": 27017 },
      { "host": "mongodb-serv2", "port": 27017 },
      { "host": "mongodb-serv3", "port": 27017 }
    ],
    "mongodb": {
       "db": "db_name", 
       "collection": "collection_name",
       "gridfs": false
    },
    "index": {
      "name": "index_name", 
      "type": "type_name"
    }
}'

This command runs fine but ElasticSearch doesn't tries to fetch data from MongoDb. I've updated records but didn't help.

Is there special config to connect to replica set? I've tried this kind of config on single ES and single MongoDb and works fine.

1

1 Answers

1
votes

Just searched and noticed that i had wrong config. Had spend more that hour before i asked question...

"servers" must be inside "mongodb" section.

curl -XPUT "elasticsearch1:9200/_river/mongodb/_meta" -d '{
  "type": "mongodb",
    "mongodb": {
         "servers": [
               { "host": "mongodb-serv1", "port": 27017 },
               { "host": "mongodb-serv2", "port": 27017 },
               { "host": "mongodb-serv3", "port": 27017 }
         ],
       "db": "db_name", 
       "collection": "collection_name",
       "gridfs": false
    },
    "index": {
      "name": "index_name", 
      "type": "type_name"
    }
}'