首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >弹性转储导入索引设置无效

弹性转储导入索引设置无效
EN

Stack Overflow用户
提问于 2019-05-24 07:14:32
回答 2查看 2.1K关注 0票数 3

我能够使用以下命令导出索引设置

代码语言:javascript
复制
elasticdump --input=http://localhost:9200/tempIndex --output=/Users/Desktop/indexFile --type=settings

但是,当我试图导入相同的设置时,它不会更新索引设置。

我用于导入的命令是:

代码语言:javascript
复制
elasticdump --input=/Users/Desktop/indexFile --output=http://localhost:9200/tempIndex --type=settings

命令输出:

代码语言:javascript
复制
 07:06:33 GMT | starting dump
 07:06:33 GMT | got 1 objects from source file (offset: 0)
 07:06:34 GMT | sent 1 objects to destination elasticsearch, wrote 0
 07:06:34 GMT | got 0 objects from source file (offset: 1)
 07:06:34 GMT | Total Writes: 0
 07:06:34 GMT | dump complete

下面是使用弹性转储设置导出的索引设置选项

代码语言:javascript
复制
{
    "tempIndex":{
        "settings":{
            "index":{
                "mapping":{
                    "nested_fields":{
                        "limit":"2000"
                    },
                    "total_fields":{
                        "limit":"2000"
                    }
                },
                "analysis":{
                    "normalizer":{
                        "lowercase_normalizer":{
                            "filter":[
                                "lowercase"
                            ],
                            "type":"custom",
                            "char_filter":[

                            ]
                        }
                    }
                },
                "number_of_shards":"5",
                "number_of_replicas":"1"
            }
        }
    }
}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-06-13 05:21:59

只能在创建索引时添加设置。因此,在运行此命令时,索引必须不存在。您可以通过提供适当的URL短路,但由于您正在尝试更新非动态设置,它仍然会失败。

代码语言:javascript
复制
{
    "error": {
        "root_cause": [{
            "type": "illegal_argument_exception",
            "reason": "Can't update non dynamic settings [[index.number_of_shards]] for open indices [[source_index/_OdHe-IVQBemJ3YYka_9hg]]"
        }],
        "type": "illegal_argument_exception",
        "reason": "Can't update non dynamic settings [[ index.number_of_shards]] for open indices [[source_index/_OdHe-IVQBemJ3YYka_9hg]]"
    },
    "status": 400
}

你能做到的

代码语言:javascript
复制
# passing in _settings path will change operation from insert to update
elasticdump --input=/Users/Desktop/indexFile --output=http://localhost:9200/tempIndex/_settings --type=settings

参考资料:https://github.com/taskrabbit/elasticsearch-dump/issues/549#issuecomment-501223008

票数 1
EN

Stack Overflow用户

发布于 2019-06-01 10:59:52

我相信弹力转储对elasticsearch隐藏了一个错误。如果索引tempIndex已经存在,则无法更新number_of_shardsanalysis设置。这些设置不是动态的。试着跑:

代码语言:javascript
复制
POST /tempIndex/_settings
{
    "tempIndex":{
        "settings":{
            "index":{
                "mapping":{
                    "nested_fields":{
                        "limit":"2000"
                    },
                    "total_fields":{
                        "limit":"2000"
                    }
                },
                "analysis":{
                    "normalizer":{
                        "lowercase_normalizer":{
                            "filter":[
                                "lowercase"
                            ],
                            "type":"custom",
                            "char_filter":[

                            ]
                        }
                    }
                },
                "number_of_shards":"5",
                "number_of_replicas":"1"
            }
        }
    }
}

您可能会从elasticsearch中得到一个错误。由于请求无效,将不会更新任何设置。

如果可能,可以删除索引tempIndex,也可以从indexFile中删除不动态的设置。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56287564

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档