elasticsearch命令curl(学习笔记)

好记性不如烂笔头,这年头少了笔多了互联网。是个好东西。
先知道一些elasticsearch的命令是干嘛的,才能写代码吧。呵呵
curl -XGET 'localhost:9200/_cat/indices?v&pretty' #查看索引
health status index                  pri rep docs.count docs.deleted store.size pri.store.size
green  open   xxx_xxx_2017-02-10   5   1          0            0      1.5kb           795b
green  open   xxx_xxx_2017-02-17   5   1         10            0      119kb         59.5kb
green  open   xxx_xxx_2017-02-14   5   1          0            0      1.5kb           795b

curl -XGET 'localhost:9200/_cat/nodes?v&pretty' #查看节点状态
host            ip              heap.percent ram.percent  load node.role master name  
192.168.151.190 192.168.151.190           10          83 -1.00 d         m      node-2
192.168.151.190 192.168.151.190            9          83 -1.00 d         *      node-1
192.168.151.190 192.168.151.190           20          83 -1.00 d         m      node-3
curl -XGET http://localhost:9200/_cluster/health?pretty   #查看集群状态
{
  "cluster_name" : "elasticsearch",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 3,
  "number_of_data_nodes" : 3,
  "active_primary_shards" : 60,
  "active_shards" : 120,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}
curl -XGET http://localhost:9200/_all  #查看所有索引信息
{"xxx_xxx_2017-02-17":{"aliases":{},"mappings":{"xxx":{"properties":{"Content":{"type":"string"},"ErrorType":{"type":"string"},"OrderID":{"type":"string"},"RequestType":{"type":"string"},"SessionID":{"type":"string"},"TimeStamp":{"type":"string"},"Type":{"type":"string"}}},"CarQuery":{"properties":{"Content":{"type":"string"},"RequestType":{"type":"string"},"SessionID":{"type":"string"},"TimeStamp":{"type":"string"}}}},"settings":{"index":{"creation_date":"1487297244079","uuid":"RIUMHuf5QROGUWOvxzVCkw","number_of_replicas":"1","number_of_shards":"5","version":{"created":"2030499"}}},"warmers":{}}}

curl -XDELETE 'http://localhost:9200/twitter,fgfg,ghjg/' #删除一个或多个索引 中间用,隔开 _all表示删除所有,并支持通配符*

curl -XGET 'http://localhost:9200/twitter/_settings,_mappings' #支持参数 The available features are _settings, _mappings, _warmers and _aliases.

JavaScriptAPI 调用

client.indices.get({index:'_all',feature:'_mappings'},function (error,response) {
        //console.log("gel_allindex:"+ JSON.stringify(response));
});





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值