[กันลืม] Elasticsearch API พื้นฐาน
INDEX วิธีดูว่ามี index อะไรบ้าง GET /_cat Response เมื่อทราบว่ามี index อะไรบ้าง ต้องการดูรายละเอียด ใส่ query string parameter (qrs) “v”‘ GET /_cat/indices?v Response ต้องการทราบว่า แต่ละ Fields มีความหมายอย่างไร ใช้ qrs ‘help’ GET /_cat/indices?help Response ต้องการแสดงเฉพาะบาง Fields ใช้ qrs ‘h=’ GET /_cat/indices?h=idx,dc,ss&v Response ต้องการดูขนาดจัดเก็บ ใช้ qrs ‘bytes=’ GET /_cat/indices?h=idx,dc,ss&bytes=b&v Response ต้องการเรียงลำดับ ใช้ qrs ‘s=’ และ สามารถกำกับ ‘:desc’, ‘:asc’ GET /_cat/indices?h=idx,dc,ss&bytes=b&s=ss:desc&v ลบ INDEX DELETE /kx01 DOCUMENTS Document เป็น JSON ที่มีรายละเอียดเกี่ยวกับการสร้างขึ้นมา เช่น _id, _version และ _source ซึ่ง source หรือ (stored fields) create / update if exist โดยใน Index เดียวกับ เก็บ Document คนละ Schema กันก็ได้ Check if exist HEAD /kx01/_doc/1/ Response 200 – OK get a source (stored fields) GET /kx01/_doc/1/ Response get only document value GET /kx01/_source/1/ Response อื่น ๆ Source filtering source_include source_exclude