我想列出ElasticSearch服务器上的所有索引。我试了一下:

curl -XGET localhost:9200/

但它给了我这个:

{
  "ok" : true,
  "status" : 200,
  "name" : "El Aguila",
  "version" : {
    "number" : "0.19.3",
    "snapshot_build" : false
  },
  "tagline" : "You Know, for Search"
}

我想要一个所有索引的列表..


当前回答

对于Elasticsearch 6。X,我发现下面的方法最有帮助。每个响应提供不同的数据。

# more verbose
curl -sS 'localhost:9200/_stats' | jq -C ".indices" | less

# less verbose, summary
curl -sS 'localhost:9200/_cluster/health?level=indices' | jq -C ".indices" | less

其他回答

您可以查询localhost:9200/_status,这将为您提供关于每个索引和信息的列表。响应看起来像这样:

{
  "ok" : true,
  "_shards" : { ... },
  "indices" : {
    "my_index" : { ... },
    "another_index" : { ... }
  }
}

curl -XGET 'http://localhost:9200/_cluster/health?水平=指数'

这将输出如下所示

{
  "cluster_name": "XXXXXX:name",
  "status": "green",
  "timed_out": false,
  "number_of_nodes": 3,
  "number_of_data_nodes": 3,
  "active_primary_shards": 199,
  "active_shards": 398,
  "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,
  "indices": {
    "logstash-2017.06.19": {
      "status": "green",
      "number_of_shards": 3,
      "number_of_replicas": 1,
      "active_primary_shards": 3,
      "active_shards": 6,
      "relocating_shards": 0,
      "initializing_shards": 0,
      "unassigned_shards": 0
    },
    "logstash-2017.06.18": {
      "status": "green",
      "number_of_shards": 3,
      "number_of_replicas": 1,
      "active_primary_shards": 3,
      "active_shards": 6,
      "relocating_shards": 0,
      "initializing_shards": 0,
      "unassigned_shards": 0
    }}

如果你的系统上安装了curl,那么试试这个简单的命令: -XGET xx.xx.xx.xx:9200/_cat/ indexes ?v

上述命令给出的结果如下所示: 结果获取所有索引

我会给你一个可以在kibana上运行的查询。

GET /_cat/indices?v

而CURL版本将是

CURL -XGET http://localhost:9200/_cat/indices?v

我在一台机器上安装了Kibana和ES。但是我不知道该机器上ES节点的详细信息(在什么路径或端口)。

那么,如何从Kibana(5.6版)进行操作呢?

转到开发工具 请参阅控制台部分,并运行以下查询:

把_cat - indices

我感兴趣的是找到特定ES索引的大小