elasticsearch常用命令

查看集群状态

request

1
GET _cat/health?v

response

1
2
epoch      timestamp cluster        status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1536485402 17:30:02 my-application yellow 1 1 6 6 0 0 5 0 - 54.5%

查看所有index

request

1
GET _cat/indices?v

response

1
2
3
health status index     uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green open .kibana UHQ4CLYzQECf_nxCqmsNMw 1 0 1 0 4kb 4kb
yellow open testindex cLKhtHKbScWNqjZPRmUAqw 5 1 3 0 11.5kb 11.5kb

index简单操作

1
2
3
4
新增index
PUT /test_index?pretty
删除index
DELETE /test_index?pretty