我可以使用以下命令导出索引设置
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
以下是使用elasticdump 设置选项导出的索引设置
{
"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"
}
}
}
}
答案 0 :(得分:0)
我相信elasticdump在这里隐藏了来自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 中删除不是动态的设置。
答案 1 :(得分:0)
只能在创建索引时添加设置。因此,在运行此命令时索引必须不存在。您可以通过提供适当的URL来进行短路,但是由于您尝试更新非动态设置而导致该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