ElasticSearch 使用 MongoDB-River 插件返回零命中

标签 elasticsearch

我正在尝试使用本地 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. 启动副本集

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. 使用以下命令成功地从 MongoDB 中将 ES curl 到索引文档。

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

有什么我想念的吗?提前感谢您的帮助。

谢谢

最佳答案

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

请看wiki page "install guide" section .

谢谢, 理查德。

关于ElasticSearch 使用 MongoDB-River 插件返回零命中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16686058/

相关文章:

elasticsearch - 如何从Logstash中filebeat提供的源值中获取文件名?

java.lang.NoClassDefFoundError : org/apache/logging/log4j/core/Layout while running integration test using ESIntegTestCase

amazon-web-services - FIlebeat-Redis-Logstash : Filebeat fast and Logstah slow, logstash 线程?

search - 使用其他查询的结果在Elasticsearch中修改相关性得分

search - 刷新请求与清空Elasticsearch缓存之间的区别

elasticsearch - 默认情况下, Elasticsearch 在一台机器上创建多少个节点

elasticsearch - Search-as-you-type 数据类型和 Edge NGram Tokenizer 之间有什么区别?

elasticsearch - 在 Elasticsearch 中克隆和重新索引索引有什么区别?

elasticsearch - 使用Nest搜索无法获得预期结果

filter - 在ElasticSearch中堆叠过滤器