我能够使用以下命令导出索引设置
elasticdump --input=http://localhost:9200/tempIndex --output=/Users/Desktop/indexFile --type=settings但是,当我试图导入相同的设置时,它不会更新索引设置。
我用于导入的命令是:
elasticdump --input=/Users/Desktop/indexFile --output=http://localhost:9200/tempIndex --type=settings命令输出:
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下面是使用弹性转储设置导出的索引设置选项
{
"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"
}
}
}
}发布于 2019-06-13 05:21:59
只能在创建索引时添加设置。因此,在运行此命令时,索引必须不存在。您可以通过提供适当的URL短路,但由于您正在尝试更新非动态设置,它仍然会失败。
{
"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
}你能做到的
# 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
发布于 2019-06-01 10:59:52
我相信弹力转储对elasticsearch隐藏了一个错误。如果索引tempIndex已经存在,则无法更新number_of_shards和analysis设置。这些设置不是动态的。试着跑:
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中删除不动态的设置。
https://stackoverflow.com/questions/56287564
复制相似问题