为ES编制的MongoDb集合配置河流

时间:2015-08-31 12:27:19

标签: mongodb elasticsearch elasticsearch-mongo-river

我正在尝试在MongoDb中插入数据并在ES上查看

  > show collections
   person
   system.indexes
  > var p = {firstName: "John", lastName: "Smith"}
  > db.person.save(p)
  WriteResult({ "nInserted" : 1 })
  > db.person.find()
  { "_id" : ObjectId("55e43765b1bf54d157542009"), "firstName" : "John",    "lastName" : "Doe" }
  { "_id" : ObjectId("55e43b7e245babbe4052f55b"), "firstName" : "John", "lastName" : "Smith" }

mongo db中的数据位于db:testmongo collection:person

现在, 当我做的时候

  curl -XGET 'http://localhost:9200/_river/mongoindex/_search?q=firstName:John'

我得到了

{"took":2,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}

但是当我输入

时在浏览器上
 http://10.130.10.121:9200/_river/_search?pretty

我得到了

  

{     “拿”:1,     “timed_out”:false,     “_shards”:{       “总数”:5,       “成功”:5,       “失败”:0     },     “命中”:{       “总数”:2,       “max_score”:1.0,       “命中”:[{         “_index”:“_river”,         “_type”:“mongodb”,         “_id”:“_ meta”,         “_score”:1.0,         “_source”:{“type”:“mongodb”,“mongodb”:{“db”:“testmongo”,“collection”:“person”},“index”:{“name”:“mongoindex”,“type “:”person“}}       },{         “_index”:“_river”,         “_type”:“mongodb”,         “_id”:“_ status”,         “_score”:1.0,         “_source”:{“error”:“NoClassSettingsException [无法加载具有值[mongodb]的类];嵌套:ClassNotFoundException [mongodb];”,“node”:{“id”:“NrkM50zoS1OX5IajaPdavw”,“name”:“ Redsand1" , “TRANSPORT_ADDRESS”: “INET [/172.17.0.2:9300]”}}       }]     }   }

请帮我从浏览器上的MongoDb获取ES索引中的正确数据

由于

1 个答案:

答案 0 :(得分:0)

这是版本兼容性的问题。所以我卸载了一切并使用了 ES版本1.4.2 Mongo Db 3.0.6版 Mapper附件版本2.4.3 elasticsearch-river-mongodb 2.0.9 一切都对我很好