首先需要安装一个插件
参考官网:https://github.com/taskrabbit/elasticsearch-dump
新建一个修改后的 index
然后通过dump命令同步数据
elasticdump \
--input=http://localhost:9200/cust_2018031916571000000_test\
--output=http://localhost:9200/cust_2018031916571000000 \
--type=data
以下共享一个比较复杂的 索引内容,不明白的地方,可以留言问我
PUT cust_2018031916571000000
{
"settings": {
"analysis": {
"analyzer": {
"my_ngram_analyzer": {
"tokenizer": "my_ngram_tokenizer"
}
},
"tokenizer": {
"my_ngram_tokenizer": {
"token_chars": [
"letter",
"digit"
],
"min_gram": "1",
"type": "nGram",
"max_gram": "8"
}
}
}
},
"mappings": {
"customer_type": {
"properties": {
"createTime": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"custGrade": {
"type": "integer"
},
"custName": {
"type": "text",
"boost": 8,
"store": true,
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"analyzer": "my_ngram_analyzer",
"fielddata": true
},
"email": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"followupState": {
"type": "integer"
},
"groups": {
"type": "long"
},
"idInt": {
"type": "long"
},
"mobile": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"analyzer": "ik_max_word",
"fielddata": true
},
"orgId": {
"type": "long"
},
"salerId": {
"type": "long"
},
"sex": {
"type": "integer"
},
"source": {
"properties": {
"type": {
"type": "long"
},
"value": {
"type": "long"
}
}
},
"tagCount": {
"properties": {
"2534": {
"type": "long"
}
}
},
"tags": {
"type": "long"
}
}
},
"cust_*": {
"_all": {
"enabled": false
},
"dynamic_templates": [
{
"string_template": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "string"
}
}
}
],
"properties": {
"address": {
"type": "text"
},
"assignTime": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"birthday": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"city": {
"type": "text",
"analyzer": "ik_max_word",
"fielddata": true
},
"companyName": {
"type": "text"
},
"country": {
"type": "text",
"analyzer": "ik_max_word",
"fielddata": true
},
"createTime": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"custGrade": {
"type": "integer"
},
"custName": {
"type": "text",
"boost": 8,
"store": true,
"analyzer": "my_ngram_analyzer",
"include_in_all": true,
"fielddata": true
},
"email": {
"type": "text"
},
"followupState": {
"type": "integer"
},
"groups": {
"type": "long"
},
"idInt": {
"type": "long"
},
"language": {
"type": "text"
},
"lastContactTime": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"microId": {
"type": "integer"
},
"mobile": {
"type": "text",
"analyzer": "ik_max_word",
"fielddata": true
},
"orgId": {
"type": "long"
},
"originalId": {
"type": "text",
"fields": {
"id": {
"type": "keyword",
"index": false
}
},
"fielddata": true
},
"position": {
"type": "text"
},
"province": {
"type": "text",
"analyzer": "ik_max_word",
"fielddata": true
},
"qq": {
"type": "integer"
},
"remark": {
"type": "text"
},
"salerId": {
"type": "long"
},
"sex": {
"type": "integer"
},
"source": {
"type": "object"
},
"tagCount": {
"type": "object"
},
"tags": {
"type": "long"
},
"weibo": {
"type": "text"
},
"wxHeadImgUrl": {
"type": "text"
},
"wxNickname": {
"type": "text",
"boost": 8,
"store": true,
"analyzer": "my_ngram_analyzer",
"include_in_all": true,
"fielddata": true
},
"wxOpenid": {
"type": "text",
"fields": {
"id": {
"type": "keyword",
"index": false
}
},
"fielddata": true
},
"wxPOenid": {
"type": "text"
},
"wxSubscribe": {
"type": "integer"
},
"wxSubscribeTime": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"wxUnionid": {
"type": "text"
}
}
}
}
}