Es重建索引

参考博客:https://www.cnblogs.com/royfans/p/11436395.html

1、修改映射

PUT goods2
{
    "mappings": {
        "_doc": {
            "properties": {
              "good_id": {
                    "type": "integer"
                },
                "orginal_id": {
                    "type": "integer"
                },
                "remark": {
                    "type": "text",
                    "fields": {
                        "raw": {
                            "ignore_above": 256,
                            "type": "keyword"
                        }
                    }
                },
                "create_time": {
                    "type": "date",
                    "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
                }
            }
        }
    }
}

2、同步数据

POST _reindex                   
{
  "source": {
    "index": "goods"
  },
  "dest": {
    "index": "goods2"
  }
}

3、删除之前的index

DELETE goods

4、将修改后的index更名

POST /_aliases
  {
        "actions": [
            {"add": {"index": "goods2", "alias": "goods"}}
        ]
  }
原文地址:https://www.cnblogs.com/ywjfx/p/13952443.html