使用CouchDB河流插件进行弹性搜索 - 找不到任何文档

时间:2013-06-02 22:26:14

标签: couchdb elasticsearch

我最近开始使用elasticsearch和couchdb,我遇到了以下问题。我有一个带有大量文档的沙发数据库。我在elasticsearch上添加了couchDb河段索引,我希望将这些文档编入索引并进行搜索。但是当我搜索任何东西虽然ES我没有得到任何结果。命令流如下:

上面的命令验证couchDb实例中有4个文档

curl -H "Content-Type: application/json" -X GET http://localhost:5984/my_db

结果:

{
  "db_name": "my_db",
  "doc_count": 4,
  "doc_del_count": 0,
  "update_seq": 4,
  "purge_seq": 0,
  "compact_running": false,
  "disk_size": 16482,
  "data_size": 646,
  "instance_start_time": "1370204643908592",
  "disk_format_version": 6,
  "committed_update_seq": 4
}

_changes输出:

curl -H "Content-Type: application/json" -X GET http://localhost:5984/my_db/_changes
{
  "results": [
    {
      "seq": 1,
      "id": "1",
      "changes": [
        {
          "rev": "1-40d928a959dd52d183ab7c413fabca92"
        }
      ]
    },
    {
      "seq": 2,
      "id": "2",
      "changes": [
        {
          "rev": "1-42212757a56b240f5205266b1969e890"
        }
      ]
    },
    {
      "seq": 3,
      "id": "3",
      "changes": [
        {
          "rev": "1-f59c2ae7acacb68d9414be05d56ed33a"
        }
      ]
    },
    {
      "seq": 4,
      "id": "4",
      "changes": [
        {
          "rev": "1-e86cf1c287c16906e81d901365b9bf98"
        }
      ]
    }
  ],
  "last_seq": 4
}

现在,我正在ES中创建索引。

curl -XPUT 'http://localhost:9200/_river/my_db/_meta' -d '{
  "type": "couchdb",
  "couchdb": {
    "host": "localhost",
    "port": 5984,
    "db": "my_db",
    "filter": null
  }
}'

{
  "ok": true,
  "_index": "_river",
  "_type": "my_db",
  "_id": "_meta",
  "_version": 1
}

但我没有得到任何回报。

curl -XGET "http://localhost:9200/my_db/my_db/_search?pretty=true"
{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 0,
    "max_score" : null,
    "hits" : []
  }
}

有什么我想念的吗?

1 个答案:

答案 0 :(得分:0)

您从河流元数据中错过了ElasticSearch索引设置。来自here

{
    "type" : "couchdb",
    "couchdb" : {
        "host" : "localhost",
        "port" : 5984,
        "db" : "my_db",
        "filter" : null
    },
    "index" : {
        "index" : "my_db",
        "type" : "my_db",
        "bulk_size" : "100",
        "bulk_timeout" : "10ms"
    }
}

我还没有看到任何提示"索引"会员可以推断。