【问题标题】:ElasticSearch - Reindex to add doc_valueElasticSearch - 重新索引以添加 doc_value
【发布时间】:2015-06-15 19:51:51
【问题描述】:

我想做什么?

将 doc_type 添加到现有索引。

我尝试了什么?

创建索引和文档

POST /my_index-1/my_type/1
{
    "my_prop": "my_value"
}

添加了模板

PUT /_template/my_template
{
    "id": "my_template",
    "template": "my_index-*",
    "mappings": {
        "_default_": {
            "dynamic_templates": [
                {
                    "my_prop_template": {
                        "mapping": {
                            "index": "not_analyzed",
                            "doc_values": true,
                            "fielddata": {
                                "format": "doc_values"
                            },
                            "type": "string"
                        },
                        "match": "my_prop",
                        "match_mapping_type": "string"
                    }
                }
            ]
        }
    }
}

重新索引

./stream2es es --source http://localhost:9200/my_index-1 --target http://localhost:9200/my_index-2

出了什么问题?

在新索引my_index-2 中,该属性没有收到"doc_values": true

...
"properties": {
    "my_prop": {
        "type": "string"
    }
}
...
  • 出于理智考虑,我还尝试将相同的文档添加到 my_index-3,它得到了"doc_values": true

我的问题

如何使用 "doc_values": true 重新索引我的旧索引?

【问题讨论】:

  • 奇怪,我在我的环境中应用了相同的步骤,唯一的区别是我使用了logstash(带有elasticsearch输入+输出)而不是stream2es,它工作得很好。拨打curl -XGET localhost:9200/my_index-2/_mapping会得到什么?

标签: elasticsearch


【解决方案1】:

感谢@Val! Logstash 确实解决了这个问题。

stream2eselasticsearch-reindex 都创建了新的映射没有 "doc_values": true。

【讨论】:

    猜你喜欢
    • 2021-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-14
    • 1970-01-01
    相关资源
    最近更新 更多