一、調(diào)整副本數(shù)
如調(diào)整副本數(shù)為0
curl -XPUT 'node3:9205/downloads/_settings' -d '{
"index": {
"number_of_replicas": "0"
}
}'
返回
{"acknowledged":true}
二、調(diào)整索引分片
索引分片數(shù)在索引創(chuàng)建好了之后就不能調(diào)整了,只能重建索引
(ES 5.X 版本中有一個(gè)縮小分片的api械拍,需要先設(shè)置為只讀,然后縮減過(guò)程需要大量的IO)
先創(chuàng)建索引
curl -XPUT 'http://localhost:9200/wwh_test2/' -d '{
"settings" : {
"index" : {
"number_of_shards" : 2,
"number_of_replicas" : 2
}
}
}'
或者同時(shí)指定mappings
curl -XPOST localhost:9200/test -d '{
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"type1" : {
"properties" : {
"field1" : { "type" : "string", "index" : "not_analyzed" }
}
}
}
}'
之后再進(jìn)行重新索引
curl -XPOST 'http://localhost:9200/_reindex' -d '{
"source": {
"index": "twitter"
},
"dest": {
"index": "new_twitter"
}
}'
開(kāi)關(guān)索引
關(guān)閉
curl -XPOST 'localhost:9200/lookupindex/_close'
打開(kāi)
curl -XPOST 'localhost:9200/lookupindex/_open'