2

我最近开始使用 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" : []
  }
}

有什么我想念的吗?

4

1 回答 1

0

您缺少河流元数据中的 ElasticSearch 索引设置。从这里

{
    "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"
    }
}

我还没有看到任何表明可以推断出“索引”成员的文档。

于 2015-03-20T07:38:13.517 回答