es不支持直接修改mappings字段结构,可以通过_reindex 重建索引,方式修改
POST _reindex
{
"source": {
"index": "old index"
},
"dest": {
"index": "new index",
"op_type": "create"
}
}
Elasticsearch重建索引
数据量过大的时候,会报连接超时的异常,其实是kibana连接问题,内部一直在执行
{"statusCode":504,"error":"Gateway Time-out","message":"Client request timeout"}
可以通过
GET _tasks?actions=*reindex&detailed
查询重建索引的执行过程,如下图,看出总共700万数据,已经创建了57.6万
![](https://img-blog.csdnimg.cn/8cc6dca644404e019fbcdbc4ee573f7e.png)