ES _reindex实践初步总结

本文详细介绍了如何使用Elasticsearch进行索引迁移,包括建立新索引、指定reindex操作的具体步骤。通过实例展示了迁移3.2G、77万条数据的过程,耗时约10分钟。同时提供了相关资源链接,便于读者深入理解。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、建立新索引

2、指定reindex

{
  "source": {
    "index": "deviceinfo_es"
  },
  "dest": {
    "index": "deviceinfo"
  }
}

结果如图:

3.2G,77万条数据,耗时526324毫秒,约10分钟。

参考:

https://blog.youkuaiyun.com/laoyang360/article/details/81589459

https://blog.youkuaiyun.com/qq_32923745/article/details/80827550

 

注:

1、建立新索引

{
  "mappings": {
    "appList": {
      "properties": {
        "app_ver": {
          "type": "string"
        },
        "apps": {
          "properties": {
            "app_label": {
              "type": "string"
            },
            "pkg_name": {
              "type": "string"
            }
          }
        },
        "biz_channel": {
          "type": "string"
        },
        "biz_type": {
          "type": "string"
        },
        "crawler_time": {
          "type": "string"
        },
        "imei": {
          "type": "string"
        },
        "queryDate": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"
        },
        "type": {
          "type": "string"
        },
        "user_id": {
          "type": "string"
        }
      }
    },
    "deviceInfo_td": {
      "properties": {
        "data": {
          "type": "string"
        },
        "queryDate": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"
        },
        "source": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "user_id": {
          "type": "string"
        }
      }
    },
    "deviceInfo": {
      "properties": {
        "addition_tool": {
          "type": "string"
        },
        "app_ver": {
          "type": "string"
        },
        "basestation_count": {
          "type": "string"
        },
        "basestation_num": {
          "type": "string"
        },
        "biz_channel": {
          "type": "string"
        },
        "biz_type": {
          "type": "string"
        },
        "card_nettype": {
          "type": "string"
        },
        "client_version": {
          "type": "string"
        },
        "crawler_time": {
          "type": "string"
        },
        "distin_hight": {
          "type": "string"
        },
        "distin_width": {
          "type": "string"
        },
        "exist_simcard": {
          "type": "string"
        },
        "exist_wifi": {
          "type": "string"
        },
        "first_installtime": {
          "type": "string"
        },
        "frame_atttool": {
          "type": "string"
        },
        "gps_address": {
          "type": "string"
        },
        "imei": {
          "type": "string"
        },
        "imsi": {
          "type": "string"
        },
        "imsi1": {
          "type": "string"
        },
        "ip": {
          "type": "string"
        },
        "is_root": {
          "type": "string"
        },
        "last_updatetime": {
          "type": "string"
        },
        "latitude": {
          "type": "string"
        },
        "longitude": {
          "type": "string"
        },
        "mem": {
          "type": "string"
        },
        "mobile_coucode": {
          "type": "string"
        },
        "mobile_netcode": {
          "type": "string"
        },
        "network_type": {
          "type": "string"
        },
        "operation_mode": {
          "type": "string"
        },
        "os_type": {
          "type": "string"
        },
        "phone1": {
          "type": "string"
        },
        "phone_brand": {
          "type": "string"
        },
        "phone_model": {
          "type": "string"
        },
        "queryDate": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"
        },
        "route_mac": {
          "type": "string"
        },
        "router_ip": {
          "type": "string"
        },
        "router_name": {
          "type": "string"
        },
        "serial_number": {
          "type": "string"
        },
        "service_name": {
          "type": "string"
        },
        "ssid": {
          "type": "string"
        },
        "support_bluetooth": {
          "type": "string"
        },
        "support_callup": {
          "type": "string"
        },
        "support_mobnet": {
          "type": "string"
        },
        "support_nfc": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "use_simulator": {
          "type": "string"
        },
        "user_id": {
          "type": "string"
        }
      }
    },
    "callLog": {
      "properties": {
        "app_ver": {
          "type": "string"
        },
        "biz_channel": {
          "type": "string"
        },
        "biz_type": {
          "type": "string"
        },
        "crawler_time": {
          "type": "string"
        },
        "imei": {
          "type": "string"
        },
        "queryDate": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"
        },
        "records": {
          "properties": {
            "call_duration": {
              "type": "long"
            },
            "call_time": {
              "type": "string"
            },
            "call_type": {
              "type": "string"
            },
            "other_num": {
              "type": "string"
            }
          }
        },
        "type": {
          "type": "string"
        },
        "user_id": {
          "type": "string"
        }
      }
    },
    "smsList": {
      "properties": {
        "app_ver": {
          "type": "string"
        },
        "biz_channel": {
          "type": "string"
        },
        "biz_type": {
          "type": "string"
        },
        "crawler_time": {
          "type": "string"
        },
        "imei": {
          "type": "string"
        },
        "queryDate": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"
        },
        "records": {
          "properties": {
            "phone": {
              "type": "string"
            },
            "sms_time": {
              "type": "string"
            },
            "smsbody": {
              "type": "string"
            },
            "type": {
              "type": "string"
            }
          }
        },
        "type": {
          "type": "string"
        },
        "user_id": {
          "type": "string"
        }
      }
    },
    "contact": {
      "properties": {
        "app_ver": {
          "type": "string"
        },
        "biz_channel": {
          "type": "string"
        },
        "biz_type": {
          "type": "string"
        },
        "crawler_time": {
          "type": "string"
        },
        "imei": {
          "type": "string"
        },
        "queryDate": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"
        },
        "records": {
          "properties": {
            "home_phone": {
              "type": "string"
            },
            "last_time_contacted": {
              "type": "string"
            },
            "last_updated_time": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "phone": {
              "type": "string"
            },
            "work_phone": {
              "type": "string"
            }
          }
        },
        "type": {
          "type": "string"
        },
        "user_id": {
          "type": "string"
        }
      }
    }
  }
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值