Elasticsearch 重建索引
兜里的Elasticsearch的索引在创建的时候没注意index.number_of_shards
这个大小,结果导致只有一个主分片,使得整个索引最大长度只有2147483519(原因
所以被迫重建索引
这回,先创建一个number_of_shards为2的索引,具体多少取决于你的业务大小
PUT http://'es节点'/'新索引名字'
{
"mappings": {
"properties": {
"username": {
"type": "keyword",
"index": "true"
},
"password": {
"type": "keyword",
"index": "true"
}
}
},
"settings": {
"index.number_of_shards": 2
}
}
然后使用reindex api重新索引
POST http://'es节点'/_reindex?wait_for_completion=false
{
"source": {
"index": "旧索引名字"
},
"dest": {
"index": "新索引名字"
}
}
返回一个task id,可以使用
http://'es节点'/_tasks/'task id'
查看任务情况