1. 程式人生 > >elasticsearch 常用命令

elasticsearch 常用命令

#檢視所有的快照
curl -XGET localhost:9200/_snapshot/倉庫名/_all
#檢視快照資訊
curl -XGET localhost:9200/_snapshot/倉庫名/snapshot_name/_status
#刪除快照
curl -XDELETE "localhost:9200/_snapshot/倉庫名/snapshot_name"
#生成快照  
curl -XPUT -uelastic:2cyR8B9VTB2VvvaMhh http://127.0.0.1:9200/_snapshot/倉庫名/snapshot_name?wait_for_completion=true -d '
{
"indices": "index_name",
"ignore_unavailable": "true",
"include_global_state": false
}'
#恢復快照
curl -XPOST http://127.0.0.1:9200/_snapshot/倉庫名/snapshot_name/_restore?wait_for_completion=true -d '
{
"ignore_unavailable": "true",
"include_global_state": false ,
"index_settings": { "index.number_of_replicas": 0 }
}'

#關閉索引
curl -XPOST localhost:9200/index_name/_close
#檢視索引資料
curl -XGET localhost:9200/index_name/_search