kibana客户端工具操作ElasticSearch(增删改查三)
生活随笔
收集整理的這篇文章主要介紹了
kibana客户端工具操作ElasticSearch(增删改查三)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
之前一直我們講的是添加文檔和查看文檔,下面我們看下怎么修改文檔,
第一種方式PUT? 覆蓋原來的文檔
?
修改文檔(覆蓋原來的):
PUT /lib/user/1 {"first_name":"Jane","last_name":"Smith","age":32,"about":"I like to collect rock albums","interests":["music"] }返回結果
{"_index" : "lib","_type" : "user","_id" : "1","_version" : 2,"result" : "updated","_shards" : {"total" : 1,"successful" : 1,"failed" : 0},"_seq_no" : 3,"_primary_term" : 1 }?
將年齡修改為36
?
第二種方式:POST??
獲取一下GET? 年齡變成了48? 版本號也增到了4
GET /lib/user/1 {"_index" : "lib","_type" : "user","_id" : "1","_version" : 4,"_seq_no" : 5,"_primary_term" : 1,"found" : true,"_source" : {"first_name" : "Jane","last_name" : "Smith","age" : 48,"about" : "I like to collect rock albums","interests" : ["music"]} }?
刪除文檔:
#刪除文檔 就相當簡單 DELETE /lib/user/1刪除成功返回的信息
{"_index" : "lib","_type" : "user","_id" : "1","_version" : 5,"result" : "deleted","_shards" : {"total" : 1,"successful" : 1,"failed" : 0},"_seq_no" : 6,"_primary_term" : 1 }我們在查看下是不是還有沒有這個文檔
GET /lib/user/1found為false,沒有找到說明我們已經刪除成功
{"_index" : "lib","_type" : "user","_id" : "1","found" : false }?
上面是刪除文檔刪除索引呢?
PUT lib2 GET /lib2/_settings#返回索引信息 {"lib2" : {"settings" : {"index" : {"creation_date" : "1583416309156","number_of_shards" : "5","number_of_replicas" : "1","uuid" : "9Ta0EnpkQwya8BVgnzLxCQ","version" : {"created" : "6080699"},"provided_name" : "lib2"}}} }刪除索引就更簡單了
?
GET /lib2/_settings返回信息? index沒有找到,說明已經刪除了
{"error" : {"root_cause" : [{"type" : "index_not_found_exception","reason" : "no such index","resource.type" : "index_or_alias","resource.id" : "lib2","index_uuid" : "_na_","index" : "lib2"}],"type" : "index_not_found_exception","reason" : "no such index","resource.type" : "index_or_alias","resource.id" : "lib2","index_uuid" : "_na_","index" : "lib2"},"status" : 404 }?
?
?
?
總結
以上是生活随笔為你收集整理的kibana客户端工具操作ElasticSearch(增删改查三)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 电子科大计算机学院硕士培养方案,电子科技
- 下一篇: 计算机与外部设备通讯的接口,总线接口与计