Elasticsearch 数据迁移

2023-05-15  本文已影响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. 提交请求 ,等待结果
上一篇 下一篇

猜你喜欢

热点阅读