実行環境
erasticsearchは3ノード1クラスタです。discovery.zen.minimum_master_nodes: 2
の設定で、マスタノードが2つ、Dataノード、ingestノードが3つに設定しています。
Cluster関連
ヘルスチェック
GET
$ curl http://localhost:9200/_cat/health?v
レスポンス
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1546327889 07:31:29 docker-cluster green 3 3 2 1 0 0 0 0 - 100.0%
このAPIよりも詳しい情報を得るときは以下のAPI
GET
$ curl http://localhost:9200/_cluster/health?pretty
レスポンス
{
"cluster_name" : "docker-cluster",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 3,
"number_of_data_nodes" : 3,
"active_primary_shards" : 1,
"active_shards" : 2,
"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
}
cluster topology
GET
$ curl http://localhost:9200/_cat/nodes?v
レスポンス
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
192.168.112.5 30 97 4 0.00 0.12 0.48 mdi * node1
192.168.112.2 46 97 4 0.00 0.12 0.48 di - node3
192.168.112.6 49 97 4 0.00 0.12 0.48 mdi - node2
マスタノード
GET
$ curl http://localhost:9200/_cat/master?v
レスポンス
id host ip node
4wIo7aA2QnKhZI4LWziIsA 192.168.112.5 192.168.112.5 node1
Index関連
一覧
GET
$ curl http://localhost:9200/_cat/indices?v
レスポンス
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open .kibana_1 -rOVd1zWRPmkvUiLZ-lT3Q 1 1 3 0 23.9kb 11.9kb
簡易的にJSONで受け取るとき
GET
$ curl localhost:9200/_aliases?pretty
レスポンス
{
".kibana_1" : {
"aliases" : {
".kibana" : { }
}
}
}
index指定
GET
$ curl http://localhost:9200/_cat/indices/$(indexName)?v
レスポンス
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open test oJzlCNeyS_6M-9msye8t-A 5 1 0 0 2.2kb 1.1kb