ElasticSearch使用MongoDB-River插件返回Zero Hits

时间:2013-05-22 07:37:15

标签: elasticsearch

我正在尝试使用我的本地MongoDB实例制作“elasticsearch-river-mongodb”插件。

http://satishgandham.com/2012/09/a-complete-guide-to-integrating-mongodb-with-elastic-search/#comment-2871

的帮助下

我能够摆脱404异常。但是,我对ElasticSearch索引的所有查询都返回NO命中。

以下是我按顺序执行的步骤。

  1. 已安装MongoDB 2.4.3
  2. 已启用ReplicaSet = rs0
  3. 启用oplogSize = 100
  4. 重启MongoDB服务器
  5. 在MongoShell上配置了rsConf变量
  6. 启动ReplicaSet

  7. rs0:PRIMARY> rs.status()
    {
        "set" : "rs0",
        "date" : ISODate("2013-05-21T17:42:41Z"),
        "myState" : 1,
        "members" : [
            {
                "_id" : 0,
                "name" : "127.0.0.1:27017",
                "health" : 1,
                "state" : 1,
                "stateStr" : "PRIMARY",
                "uptime" : 865,
                "optime" : {
                    "t" : 1369157994,
                    "i" : 1
                },
                "optimeDate" : ISODate("2013-05-21T17:39:54Z"),
                "self" : true
            }
        ],
        "ok" : 1
    }
    

    1. 已安装的ES
    2. 已安装的附件插件(ES_HOME/bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/1.4.0)
    3. 已安装的River插件(ES_HOME/bin/plugin -install richardwilly98/elasticsearch-river-mongodb/1.4.0)
    4. 重新启动ES
    5. Curl ES使用以下命令成功索引MongoDB中的文档。

    6. purl -XPUT 'http://`127.0.0.1`:9200/_river/mongodb/_meta' -d '{ 
          "type": "mongodb", 
          "mongodb": { 
              "db": "players", 
              "collection": "scores"
          }, 
          "index": {
              "name": "scoresindex", 
              "type": "score" 
          }
      }'
      

      1. 向MongoDB添加了新文档
      2. On MongDB db.oplog.rs.find()集合返回新的更新

      3. rs0:PRIMARY> db.oplog.rs.find()
        { "ts" : { "t" : 1369152540, "i" : 1 }, "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "o" : { "msg" : "initiating set" } }
        { "ts" : { "t" : 1369152706, "i" : 1 }, "h" : NumberLong("7734203254950592529"), "v" : 2, "op" : "i", "ns" : "players.scores", "o" : { "_id" : ObjectId("519b9cc2871b3116f0b8006e"), "name" : "rohit", "score" : 20 } }
        { "ts" : { "t" : 1369157720, "i" : 1 }, "h" : NumberLong("2546253279621321716"), "v" : 2, "op" : "i", "ns" : "test.scores", "o" : { "_id" : ObjectId("519bb058b6fd31855ec8b0af"), "name" : "karthik", "score" : 20 } }
        { "ts" : { "t" : 1369157994, "i" : 1 }, "h" : NumberLong("-3356531630527802451"), "v" : 2, "op" : "i", "ns" : "test.scores", "o" : { "_id" : ObjectId("519bb16ab6fd31855ec8b0b0"), "name" : "dinesh", "score" : 20 } }
        

        我面临的问题是:使用以下命令在ElasticSearch上搜索


        curl -XGET 'http://`127.0.0.1`:9200/scoresindex/_search?q=name:dinesh'
        

        新添加的文档到MongoDB上的分数集合不会返回任何结果。

        我已经尝试将文档直接发布到ES,它会返回结果,但不会返回MongoDB中的文档。

        我有什么遗失的吗?提前感谢您的帮助。

        谢谢

1 个答案:

答案 0 :(得分:4)

根据project 1 MongoDB 2.4.3只支持版本1.6.6及以上的版本。 您正在运行哪个版本的Elasticsearch?

请查看wiki page "install guide" section

谢谢,    理查德。