elasticsearch命令大全

 

创建索引:

 

curl –XPUT 'http://localhost:9200/blog' –d'{

   "settings" : {

      "number_of_shards" : 3,

      "number_of_replicas" : 1

   }

}'

 

curl –XPUT 'http://localhost:9200/blog/_mapping/article?pretty' -d'{

        "properties":{

                  "id":{"type":"long"},

                  "name":{"type":"string"}

         }

}'

 

删除索引:

curl –XDELETE 'http://localhost:9200/blog'

 

插入数据:

curl –XPUT 'http://localhost:9200/blog/article/1' -d '{

                  "id":123,

                  "name":"steve"

}'

 

查询数据:

curl –XGET 'http://localhost:9200/blog/article/1’

 

集群健康:curl -XGET'http://localhost:9200/_cluster/health'

集群分区:curl -s 'http://localhost:9200/_cat/shards'

 

curl -XDELETE 'http://localhost:9200/music/qingtingRadio/山东%23畅行952'

 

path.repo:["/export/servers/elasticsearch-2.4.2/backups/es_backup"]

 

 

创建快照仓库:

curl -XPUT 'http://localhost:9200/_snapshot/bakup' -d '{

    "type":"fs",

    "settings": {

        "location": "/mnt/es/bakup",

        "compress": true

    }

}'

 

 

curl -XPUT 'http://localhost:9200/_snapshot/backup_hdfs' –d '{

  "type":"hdfs",

  "settings": {

    "uri": "hdfs://node:8020/",

    "path": "/elasticsearch/respositories/my_hdfs_repository",

   "conf.dfs.client.read.shortcircuit": "true"

  }

}'

 

快照仓库查询:

curl -XGET 'http://localhost:9200/_snapshot/es_backup?pretty'

 

curl -XGET 'http://localhost:9200/_snapshot'
 
curl -XGET 'http://localhost:9200/_snapshot/_all'

 

 

创建快照:

curl -XPUT 'http://localhost:9200/_snapshot/es_backup/snapshot_2017081815?wait_for_completion=true'
 
 
curl -XPUT 'http://localhost:9200/_snapshot/es_backup/snapshot_music_2017081815' -d '{
    "indices": "indexName",
    "ignore_unavailable": true,
    "include_global_state": false,
    "partial": false
}'
 

 

删除快照:

curl -XDELETE ' http://localhost:9200/_snapshot/es_backup/ snapshot_xxx_2017081815'

 

查询快照信息:

curl -XGET 'http://localhost:9200/_snapshot/es_backup/snapshot_1'
 
curl -XGET 'http://localhost:9200/_snapshot/es_backup/_all'
 

 

 

恢复快照:

curl -XPOST 'http://localhost:9200/_snapshot/es_backup/snapshot_xxx_2017081815/_restore'
 
 
目录:/export/servers/elasticsearch-2.4.2/backups/bakData"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值