ElasticSearch的基本CRUD和postman調用一些常用的api.

windows的安裝:https://blog.csdn.net/jiabin30/article/details/82850338

elasticsearch是document的數據格式。

1。ES是面向文檔的,文檔中存儲的數據結構,與面向對象的數據結構是一樣的,基於這種文檔數據結構,es可以提供複雜的索引,全文檢索,分析聚合等功能
2.es的document用json數據格式來表達.

 


es提供了一套api,叫做cat api,可以查看es中各種各樣的數據:

1.查看集羣的健康狀態:get請求

http://localhost:9200/_cat/health?v

2.快速查看有那些索引;get請求

http://localhost:9200/_cat/indices

3.簡單的索引操作:

添加:put請求

http://localhost:9200/shubao/

4.刪除索引:DELETE

http://localhost:9200/shubao/

5.創建文檔:以post

article:就是文檔name

http://localhost:9200/shubaos/article

_id是由系統自動生成的,在添加的時候可以加在請求路徑的後面

http://localhost:9200/shubaos/article/1或者2

 

1.查詢文檔:get請求

http://localhost:9200/shubaos/article/2

2.替換文檔

http://localhost:9200/shubaos/article/2

記得修改下body裏面的內容·

替換方式有一個不好,即使必須帶上所有的field,才能去進行信息的修改

3.修改問文檔內容

http://localhost:9200/shubaos/article/2/_update

body

{
  "doc": {
    "name": "jiaqiangban gaolujie yagao"
  }
}

4.刪除文檔

DELETE /ecommerce/product/1

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章