es基本操作
es基本操作
簡介
es的基本操作是restfull風(fēng)格的,我們可以通過get/post/delete/put等操作與es交互,本節(jié)簡單的介紹如何一些基本的操作命令
基本操作
獲取es狀態(tài)
nick@nicks-MacBook-Pro ~/Desktop/software/es/elasticsearch-7.13.1 curl -X GET "http://localhost:9200" { "name" : "nicks-MacBook-Pro.local", "cluster_name" : "elasticsearch", "cluster_uuid" : "p17icuWURHastv80WGtpFg", "version" : { "number" : "7.13.1", "build_flavor" : "default", "build_type" : "tar", "build_hash" : "9a7758028e4ea59bcab41c12004603c5a7dd84a9", "build_date" : "2021-05-28T17:40:59.346932922Z", "build_snapshot" : false, "lucene_version" : "8.8.2", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" }
新增一個(gè)文檔
# 應(yīng)答如下 curl -X PUT "localhost:9200/student/_doc/1" -H 'Content-type: application/json' -d' { "name": "Nick", "age": "30" } ' # 應(yīng)答如下 {"_index":"student","_type":"_doc","_id":"1","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1}
查詢這個(gè)文檔
# 查詢指定文檔 curl -X GET "localhost:9200/student/_doc/1" # 查詢index(索引)下所有文檔 curl -X GET "localhost:9200/student"
刪除文檔
curl -X DELETE "localhost:9200/student/_doc/1"
Elasticsearch
版權(quán)聲明:本文內(nèi)容由網(wǎng)絡(luò)用戶投稿,版權(quán)歸原作者所有,本站不擁有其著作權(quán),亦不承擔(dān)相應(yīng)法律責(zé)任。如果您發(fā)現(xiàn)本站中有涉嫌抄襲或描述失實(shí)的內(nèi)容,請聯(lián)系我們jiasou666@gmail.com 處理,核實(shí)后本網(wǎng)站將在24小時(shí)內(nèi)刪除侵權(quán)內(nèi)容。
版權(quán)聲明:本文內(nèi)容由網(wǎng)絡(luò)用戶投稿,版權(quán)歸原作者所有,本站不擁有其著作權(quán),亦不承擔(dān)相應(yīng)法律責(zé)任。如果您發(fā)現(xiàn)本站中有涉嫌抄襲或描述失實(shí)的內(nèi)容,請聯(lián)系我們jiasou666@gmail.com 處理,核實(shí)后本網(wǎng)站將在24小時(shí)內(nèi)刪除侵權(quán)內(nèi)容。