美文网首页
Elasticsearch 数据迁移

Elasticsearch 数据迁移

作者: 我还是老油条 | 来源:发表于2023-05-15 10:33 被阅读0次

项目中遇到大批量修改es数据,为了防止出错,最好的方法就是先备份,接下来就演示下备份流程
1.新建目标索引

{
    "state": "open",
    "settings": {
        "index": {
            "number_of_shards": "5",
            "number_of_replicas": "1"
        }
    },
    "mappings": {
        "test": {
            "properties": {
                "vp_audio_count": {
                    "type": "long"
                },
                "updateDate": {
                    "type": "long"
                },
                "gender": {
                    "type": "long"
                },
                "dbName": {
                    "type": "keyword"
                },
                "reg_type": {
                    "type": "long"
                }
            }
        }
    }
}

2.es-head 执行复合查询

post   http://127.0.0.1:9209/_reindex?wait_for_completion=false/
{
  "source": {
    "index": "test-old" //原始索引名
  },
  "dest": {
    "index": "test" //新建索引名
  }
}

  1. 提交请求 ,等待结果

相关文章

网友评论

      本文标题:Elasticsearch 数据迁移

      本文链接:https://www.haomeiwen.com/subject/xgumsdtx.html