1.重建索引
索引使用一段时间后,无法直接修改静态配置,例如分片的数目,分词器等。
需要通过重建索引来解决。
--创建新的索引
curl -u elastic:elastic -k -XPUT http://192.168.1.800:9200/newindex-3-1-3 -H 'Content-Type: application/json' -d '
{
"settings":{
"number_of_shards":"5",
"number_of_replicas":"1"
}
}'
2.迁移索引
将索引:test-3-2-1 的数据迁移到新的索引中,完成 分片和副本数的变更。
curl -u elastic:elastic -k -XPOST http://192.168.1.800:9200/_reindex -H 'Content-Type: application/json' -d '
{
"source":{"index":"test-3-2-1"},
"dest":{"index":"newindex-3-1-3"}
}'
POST 修改
PUT 创建
GET 查询
--结果显示。
{
"took":2758,
"timed_out":false,
"total":5, #5条记录迁移成功。
"updated":0,
"created":5,
"deleted":0,
"batches":1,
"version_conflicts":0,
"noops":0,
"retries":{
"bulk":0,
"search":0
},
"throttled_millis":0,
"requests_per_second":-1,
"throttled_until_millis":0,
"failures":[
]
}
3010

被折叠的 条评论
为什么被折叠?



