1.查看原索引的mapping,我这里通过谷歌插件直接看的
2.点击信息查看索引信息
3.将索引整理好
{
"settings": { "index": { "refresh_interval": "1s","number_of_shards": "5","provided_name": "mcn_sys_log","creation_date": "1578049275728","store": { "type": "fs"},"number_of_replicas": "1","uuid": "Tgnyt9euT2yGEA3_YcPuOw","version": { "created": "5060899"}}},
"mappings": { "sys_log": { "properties": { "logType": { "store": true,"type": "keyword"},"operate_type": { "store": true,"type": "keyword"},"systemCode": { "store": true,"type": "keyword"},"ip": { "store": true,"type": "keyword"},"id": { "type": "text","fields": { "keyword": { "ignore_above": 256,"type": "keyword"}}},"moudleName": { "store": true,"type": "keyword"},"userName": { "store": true,"type": "keyword"},"content": { "search_analyzer": "ik_smart","analyzer": "ik_max_word","store": true,"type": "text"},"gmtActionTime": { "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis","store": true,"type": "date"},"userCode": { "store": true,"type": "integer"},"status": { "store": true,"type": "keyword"}}}},
}
4.在新ES集群中通过谷歌的ES插件执行新索引的创建
5.在新ES集群机器上创建好同步文件
vim mcn_sys_log.json
{
"source": {
"remote": {
"host": "http://172.16.3.161:9200"
},
"index": "mcn_sys_log",
"size": 2000
},
"dest": {
"index": "mcn_sys_log"
}
}
6.执行同步文件操作
curl -XPOST -uelastic:BAGNimgiGBIE5Isu -H 'Content-Type: application/json' 'http://127.0.0.1:9200/_reindex?wait_for_completion=false' -d '@mcn_sys_log.json'