【问题标题】:Elasticsearch Rivers- How to make the normal index with river index?Elasticsearch Rivers-如何用河流索引制作普通索引?
【发布时间】:2015-03-06 23:37:26
【问题描述】:

我成功地为我的 MongoDB 创建了一条弹性搜索河。

这是我使用/创建的索引:

{
    "type": "mongodb",
    "mongodb": {
        "collection": "config_files", 
        "db": "tore_dev"
    },
    "index": {
        "name": "mongo_index",
        "type": "config_files"
    }
}

curl -X PUT "localhost:9200/_river/config_files/_meta" -d @create.json

由于我使用的是河流,因此我的索引与普通索引不同。我仍然需要为 MongoDB 上的文档字段创建索引(我认为,对吧?)。它们是:

{
    "_id" : ObjectId("524fdd575e0000cc"),
    "_type" : "DeviceConfig",
    "created_at" : ISODate("2013-09-24T17:00:58.94Z"),
    "updated_at" : ISODate("2013-09-24T17:00:58.91Z"),
    "device_id" : ObjectId("523d6a4aba001947"),
    "name" : "version",
    "checksum" : "",
    "content" : " blah blah blah...alot of text words"
    "current" : true,
    "retain" : false,
    "standard" : false,
    "legacy" : false

如何在河流索引中创建此索引?我认为它与elasticsearch-mapper-attachments 有关,但不清楚如何制作此索引。

【问题讨论】:

    标签: mongodb elasticsearch elasticsearch-plugin


    【解决方案1】:

    您不需要创建单独的索引。这条河的目的是通过 oplog 用来自 mongodb 的数据不断更新 Elasticsearch 索引。一旦你创建了河流 -

    您应该做的是查询 Elasticsearch 集群以查看索引是否存在:

    curl -XGET 'http://localhost:9200/_aliases?pretty'
    

    然后我还要查询索引:

    curl -XGET 'localhost:9200/mongo_index/_search?q=*&pretty'
    

    编辑

    如果您希望为特定字段设置或调整分析器,则需要在设置河流之前创建索引和映射。 This previous question有一些关于如何做到这一点的细节:

    mapping in create index in elasticsearch through mongodb river is not taking effect

    【讨论】:

    • 好吧,我的意思是如何在具有这种特定类型索引的特定字段上设置分析器?
    猜你喜欢
    • 2012-02-19
    • 2015-05-05
    • 2015-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多