One - One Code All

Blog Content

elasticsearch常用查询统计

ElasticSearch   2017-07-02 10:23:27

整体查询

curl -XGET 127.0.0.1:9200/_cat/health?v
curl -XGET 127.0.0.1:9200/_cat/nodes?v
curl -XGET 127.0.0.1:9200/_cat/shards?v
curl -XGET 127.0.0.1:9200/_cluster/health?pretty
curl -XGET 127.0.0.1:9200/_cluster/pending_tasks


索引统计

curl -XGET 127.0.0.1:9200/_cat/count
curl -XGET '127.0.0.1:9200/_cat/indices?v' | sort | wc -l
curl -XGET 127.0.0.1:9200/_cat/shards?v | egrep 'one_|two_|xk_' |  awk '{print $6}'
curl -X GET "localhost:9200/_cat/count/index_name?v"

单独统计

 curl -X GET 127.0.0.1:9200/dialogue_*/_count
{"count":108435,"_shards":{"total":741,"successful":741,"skipped":0,"failed":0}}

统计总数据条数

GET /page-access/_count

{

}

或  通配符

GET /logstash-*/_count

{

}

或  多个

GET /page-access,logstash-*/_count

{

}


url中前面的部分就是匹配需统计的索引


返回内容:

{

  "count" : 3478311,

  "_shards" : {

    "total" : 50,

    "successful" : 50,

    "skipped" : 0,

    "failed" : 0

  }

}

其中count就是制定索引的总数据条数


统计总存储空间占用

GET /_cat/shards?v

其中store列就是占用的存储空间。



上一篇:Django 设置自增主键
下一篇:Ubuntu 安装 JDK 7 / JDK8 的两种方式

The minute you think of giving up, think of the reason why you held on so long.