使用elasticsearchdump迁移elasticsearch数据实战

目录

1.安装nodejs

2.安装elasticsearchdump

3.迁移

4.核对数据

5.注意事项


1.安装nodejs

https://ascendking.blog.csdn.net/article/details/135509838

2.安装elasticsearchdump

npm install elasticdump -g

3.迁移

elasticdump --input=http://用户:密码@源ES地址/源索引 --output=http://用户:密码@目标ES地址/目标索引 --type=settings

elasticdump --input=http://用户:密码@源ES地址/源索引 --output=http://用户:密码@目标ES地址/目标索引 --type=mapping

elasticdump --input=http://用户:密码@源ES地址/源索引 --output=http://用户:密码@目标ES地址/目标索引 --type=data --limit=10000

4.核对数据

核对迁移后数据是否正确

5.注意事项

在3迁移中 --type=mapping,如果es版本不一致可能会报错,如果报错,需要手动创建新es的索引的映射

比如es6迁移数据到es7

es7去掉了_type

只能手动设置映射

直接put设置映射

设置示例

请求方式:PUT

路径:http://ip:端口号/索引名/_mapping

路径组成:http://ip:端口号+ 索引 +_mapping

请求体:

{
    "properties": {
        "abstract": {
            "type": "text",
            "store": true,
            "analyzer": "ik_max_word"
        },
        "content": {
            "type": "text",
            "store": true,
            "analyzer": "ik_max_word"
        },
        "createTime": {
            "type": "date",
            "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        },
        "documentAppName": {
            "type": "keyword"
        },
        "documentId": {
            "type": "keyword"
        },
        "documentPath": {
            "type": "keyword"
        },
        "modifyTime": {
            "type": "date",
            "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        },
        "title": {
            "type": "text",
            "analyzer": "ik_max_word"
        }
    }
}

相关推荐

  1. 使用elasticsearchdump迁移elasticsearch数据实战

    2024-01-18 21:58:02       32 阅读
  2. elasticdump elasticsearch 数据迁移

    2024-01-18 21:58:02       40 阅读
  3. ELasticSearch数据迁移方案-elasticdump

    2024-01-18 21:58:02       6 阅读
  4. 云卷云舒:【实战篇】ElasticSearch迁移

    2024-01-18 21:58:02       38 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-01-18 21:58:02       17 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-18 21:58:02       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-18 21:58:02       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-18 21:58:02       18 阅读

热门阅读

  1. 微服务概述之微服务实践参考

    2024-01-18 21:58:02       37 阅读
  2. flink 1.18 sql demo

    2024-01-18 21:58:02       20 阅读
  3. Redis的key过期策略是怎么实现的

    2024-01-18 21:58:02       32 阅读
  4. python 读写kafka

    2024-01-18 21:58:02       32 阅读
  5. python 常用功能积累

    2024-01-18 21:58:02       29 阅读
  6. 机器学习之协同过滤算法

    2024-01-18 21:58:02       54 阅读
  7. 机器学习在表面缺陷检测中的技术与实践

    2024-01-18 21:58:02       43 阅读
  8. MySQL-索引的介绍和使用

    2024-01-18 21:58:02       31 阅读