# Elasticsearch REST Api

[喬叔的 Elasticsearch 基礎實務班 (2021.07.24~25) - HackMD](https://hackmd.io/YZNLmE4ZRs28v5XX5lplDg)

[![image-1631848723417.png](http://bookstack.treemanou.com/uploads/images/gallery/2021-09/scaled-1680-/CxAtmrHBPXONsorz-image-1631848723417.png)](http://bookstack.treemanou.com/uploads/images/gallery/2021-09/CxAtmrHBPXONsorz-image-1631848723417.png)

[![image-1631848837295.png](http://bookstack.treemanou.com/uploads/images/gallery/2021-09/scaled-1680-/Heg90G0f3b0Pff09-image-1631848837295.png)](http://bookstack.treemanou.com/uploads/images/gallery/2021-09/Heg90G0f3b0Pff09-image-1631848837295.png)

Index與type欄位是必要的,id若省去,Elasticsearch  
會為document加上自動產生的id。  
– 自動產生的id為22字元長、URL-safe、Base64-encoded  
string UUID。

- 若給予的index或type名稱目前並不存在時  
    ,Elasticsearch會以預設設定值自動建立該名稱的  
    index或type。
- 若不給予id時,index資料應使用POST。
- type 建議使用 \_doc (since 6.0)