ElasticSearch mongo总是0次点击

时间:2014-09-05 14:18:09

标签: elasticsearch elasticsearch-mongo-river

我正在尝试让ElasticSearch在我的Mongodb服务器上运行,一切看起来都很好,但我做的每个查询都会返回0次点击。总是

我的安装和配置日志:

  1. 已安装Mongodb 2.6.4
  2.   

    启动并运行。这里没问题。我在“产品”系列中有7000个产品。

    .2创建副本集。

      

    在Mongo shell上用rs.status()确认它已经创建了它   主副本使用resplSet = rs0更改了mongod.conf   oplogSize = 100

    0.3。重启MongoDB

    0.4。启动副本集

      

    在mongo shell rs.initiate()上。一切都很好。

    0.5。已安装ElasticSearch 1.3.2

    {
      "status": 200,
      "name": "Franz Kafka",
      "version": {
        "number": "1.3.2",
        "build_hash": "dee175dbe2f254f3f26992f5d7591939aaefd12f",
        "build_timestamp": "2014-08-13T14:29:30Z",
        "build_snapshot": false,
        "lucene_version": "4.9"
      },
      "tagline": "You Know, for Search"
    }
    

    0.6。已安装的Mapper插件

    0.7。已安装的River插件

    0.8。创建索引

    curl -XPUT 'http://localhost:9200/indexprueba/products/_meta?pretty=true' -d '{
      "type": "mongodb",
      "mongodb": {
        "db": "test",
        "collection": "products"
      },
      "index": {
        "name": "probando1",
        "type": "products"
      }
    }'
    

    它返回:

    {
      "_index": "indexprueba",
      "_type": "products",
      "_id": "_meta",
      "_version": 1,
      "created": true
    }
    

    -------- --------- EDIT

    8.5恢复数据库

    我没有这样做。一旦我创建了索引,我就用mongorestore恢复我的数据库,这就是我得到的:

    connected to: 127.0.0.1:27017
    2014-09-08T08:17:17.773+0000 /var/backup/bikebud/products.bson
    2014-09-08T08:17:17.773+0000    going into namespace [test.products]
    Restoring to test.products without dropping. Restored data will be inserted without raising errors; check your server log
    6947 objects found
    2014-09-08T08:17:18.043+0000    Creating index: { key: { _id: 1 }, name: "_id_", ns: "test.products" }
    2014-09-08T08:17:18.456+0000 /var/backup/bikebud/retailers.bson
    2014-09-08T08:17:18.457+0000    going into namespace [test.retailers]
    Restoring to test.retailers without dropping. Restored data will be inserted without raising errors; check your server log
    20 objects found
    2014-09-08T08:17:18.457+0000    Creating index: { key: { _id: 1 }, name: "_id_", ns: "test.retailers" }
    

    所以我从这里了解到我的索引已创建并链接到数据库

    -------- --------- EDIT

    0.9。创建简单查询

    curl -XGET `'http://127.0.0.1:9200/indexprueba/_search?pretty=true&q=*:*'`
    

    始终返回:

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

    ---------------- EDIT -------------------

    编辑后,这就是我得到的:

    {
      "took": 14,
      "timed_out": false,
      "_shards": {
        "total": 5,
        "successful": 5,
        "failed": 0
      },
      "hits": {
        "total": 1,
        "max_score": 1.0,
        "hits": [
          {
            "_index": "testindex1",
            "_type": "products",
            "_id": "1",
            "_score": 1.0,
            "_source": {
              "type": "mongodb",
              "mongodb": {
                "servers": [
                  {
                    "host": "127.0.0.1",
                    "port": 27017
                  }
                ],
                "options": {
                  "secondary_read_preference": true
                },
                "db": "test",
                "collection": "products"
              }
            }
          }
        ]
      }
    }
    

    所以现在我得到了点击,但索引本身。我期待从我的数据库中获取所有产品。我开始认为我根本不了解elasticsearch的作用。任何线索??

    ---------------- EDIT -------------------

    我不知道我在这里缺少什么。请问,有什么建议吗?

    ---------------- EDIT -------------------

    看起来这是一个版本问题。我必须将ES降级到1.2.2(我使用的是1.3.2)。 “解决”

0 个答案:

没有答案