elasticsearch7.6.1 索引数据迁移 旧索引数据迁移至新索引数据

举例子:索引A为旧索引,索引B为新索引。

1、获取A索引(旧索引)的数据结构

GET /index_a/_mapping/
mappings.png

2、创建一个新的索引B,结构同A。

POST /index_b/_mapping/
{
      "properties" : {
        "age" : {
          "type" : "long"
        },
        "education" : {
          "type" : "text"
        },
        "other": {
          "type": "text"
        },
        "name" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "testedu" : {
          "type" : "text"
        }
      }
}

3、迁移数据

POST _reindex
{
  "source": {
    "index": "index_a"
  },
  "dest": {
    "index": "index_b"
  }
}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容