【问题标题】:ElasticSearch returns Zero Hits with MongoDB-River pluginElasticSearch 使用 MongoDB-River 插件返回零命中
【发布时间】:2016-01-07 00:02:05
【问题描述】:

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

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

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

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

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

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 索引文档成功。

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. 在 MongDB 上 db.oplog.rs.find() 集合返回新的更新

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 中的文档。

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

谢谢

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    根据project1的说法,MongoDB 2.4.3 只支持 1.6.6 及以上版本的 River。 您运行的是哪个版本的 Elasticsearch?

    请查看wiki page "install guide" section

    谢谢, 理查德。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-02-26
      • 1970-01-01
      • 1970-01-01
      • 2015-02-06
      • 1970-01-01
      • 1970-01-01
      • 2013-10-25
      • 1970-01-01
      相关资源
      最近更新 更多