Basic API

การตรวจสอบสถานะการทำงานของ cluster และ node

/_nodes

  • ใข้สำหรับดูข้อมูลของแต่ละ node ใน cluster โดยจะแสดงข้อมูลต่างๆของ node ใน cluster เช่น cluster name, role ,ip , setting

elasticsearch_ip:port/_nodes
{
  "_nodes": {
    "total": 1,
    "successful": 1,
    "failed": 0
  },
  "cluster_name": "ilog-demo",
  "nodes": {
    "raiANraHQJdadsADSw2sx": {
      "name": "raiANra",
      "transport_address": "100.1.23.52:9300",
      "host": "100.1.23.52",
      "ip": "100.1.23.52",
      "version": "6.7.0",
      "build_flavor": "default",
      "build_type": "docker",
      "build_hash": "8453f77",
      "total_indexing_buffer": 157574758,
      "roles": [
        "master",
        "data",
        "ingest"
      ],
      "attributes": {
        "ml.machine_memory": "33245134848",
        "xpack.installed": "true",
        "ml.max_open_jobs": "20",
        "ml.enabled": "true"
      }
}

/_stats

  • ใช้สำหรับดูสถิติในการใช้งาน

elasticsearch_ip:port/_stats
{
  "_shards": {
    "total": 10,
    "successful": 5,
    "failed": 0
  },
  "_all": {
    "primaries": {
      "docs": {
        "count": 676847,
        "deleted": 0
      },
      "store": {
        "size_in_bytes": 804005415
      },
      "indexing": {
        "index_total": 676855,
        "index_time_in_millis": 1046021,
        "index_current": 0,
        "index_failed": 0,
        "delete_total": 0,
        "delete_time_in_millis": 0,
        "delete_current": 0,
        "noop_update_total": 0,
        "is_throttled": false,
        "throttle_time_in_millis": 0
      }
}

/_cluster/health

  • สำหรับดูข้อมูลและสถานะของ cluster

elasticsearch_ip:port/_cluster/health
{
  "cluster_name": "ilog-demo",
  "status": "green",
  "timed_out": false,
  "number_of_nodes": 1,
  "number_of_data_nodes": 1,
  "active_primary_shards": 10,
  "active_shards": 10,
  "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
}

การตรวจสอบสถานะของ index

/_cat/indices?v

  • สำหรับดูข้อมูลและสถานะของ index ว่ามีขนาดเท่าไร ,size ของ index เป็นอย่างไร

elasticsearch_ip:port/_cat/indices?v
health status index             uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   fortigate-2020.01 G1huz9ubTQu_WprwA9KALw   5   1     686214            0    777.7mb        777.7mb

Last updated