简体   繁体   English

使用旧的_timeStamp将数据从Elasticsearch 1.X重新索引到ElastichSearch到新字段

[英]Reindex data from Elasticsearch 1.X to ElastichSearch with old _timeStamp to new Field

I am trying to migrate my data from an old Elasticsearch(Version 1.4.4) Cluster to a new one (5.1) 我正在尝试将数据从旧的Elasticsearch(版本1.4.4)集群迁移到新的集群(5.1)

I am using the reindex api in the new Elasticsearch, but can't get the old _timestamp to a new field timestamp . 我在新的Elasticsearch中使用reindex api,但是无法将旧的_timestamp转换为新的字段timestamp Everything else works fine. 其他一切正常。

POST _reindex
{
  "source": {
    "remote": {
      "host": "http://oldhost:9200"
    },
    "index": "source",
    "query": {
       "match_all": {}
    }
  },
  "dest": {
    "index": "dest"
  }
}

Are there any way to add a script tag to set the new field timestamp from the old _timestamp ? 有什么方法可以添加脚本标记以从旧的_timestamp设置新的字段timestamp

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): 我不是100%肯定这会起作用,但是使用reindex API,您可以指定一小部分脚本,这些脚本可能能够读取旧的_timestamp字段(尽管我从未亲自尝试过):

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"
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM