Reindex数据从Elasticsearch 1.X到具有旧_timeStamp的ElastichSearch到新的Field [英] Reindex data from Elasticsearch 1.X to ElastichSearch with old _timeStamp to new Field
问题描述
我正在尝试将我的数据从旧的弹性搜索(1.4.4)集群迁移到新的(5.1)
I am trying to migrate my data from an old Elasticsearch(Version 1.4.4) Cluster to a new one (5.1)
我正在使用 reindex api在新的弹性搜索,但是不能将旧的 _timestamp
转到新的字段 timestamp
。其他一切工作正常。
I am using the reindex api in the new Elasticsearch, but can't get the old _timestamp
to a new field timestamp
. Everything else works fine.
POST _reindex
{
"source": {
"remote": {
"host": "http://oldhost:9200"
},
"index": "source",
"query": {
"match_all": {}
}
},
"dest": {
"index": "dest"
}
}
有没有办法添加脚本标签来设置新字段 timestamp
从旧的 _timestamp
?
Are there any way to add a script tag to set the new field timestamp
from the old _timestamp
?
推荐答案
我'不能100%确定这将工作,但使用 reindex API ,您可以指定一些可能读取旧的 _timestamp
字段的脚本(尽管我从未尝试过) / p>
I'm not 100% certain this will work, but using the reindex API you can specify a tiny bit of script that might be able to read the old _timestamp
field (although I've never tried it personally):
POST _reindex
{
"source": {
"remote": {
"host": "http://oldhost:9200"
},
"index": "source"
"query": {
"match_all": {}
}
},
"dest": {
"index": "dest"
},
"script": {
"lang": "painless",
"inline": "ctx._source.timestamp = ctx._timestamp"
}
}
这篇关于Reindex数据从Elasticsearch 1.X到具有旧_timeStamp的ElastichSearch到新的Field的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!