elastic集群管理

查看集群狀態(tài)

命令行:curl -XGET "http://localhost:9200/_cat/health?v"
kibana控制臺(tái):GET /_cat/health?v

列出集群中的節(jié)點(diǎn)

命令行:curl -XGET "http://localhost:9200/_cat/nodes?v"
kibana控制臺(tái):GET /_cat/nodes?v

列出集群所有的索引

命令行:curl -XGET "http://localhost:9200/_cat/indices?v"
kibana控制臺(tái):GET /_cat/indices?v

創(chuàng)建索引:

創(chuàng)建名為customer的索引:
命令行:curl -XPUT "http://localhost:9200/customer?pretty"
kibana控制臺(tái):PUT /customer?pretty

索引并且查詢一個(gè)文檔

PUT /customer/external/1?pretty
{
"name": "John Doe"
}
GET /customer/external/1?pretty

刪除一個(gè)索引

DELETE /customer?pretty
DELETE /customer/external/1?pretty

更新數(shù)據(jù)

PUT /customer/external/1?pretty
{
"name": "John Doe"
}
如果對(duì)相同的文檔多次執(zhí)行以上的命令,elastic將重新索引,ID為1,Version號(hào)碼遞增

更新記錄

POST /customer/external/1/_update?pretty
{
"doc": { "name": "Jane Doe" }
}

POST /customer/external/1/_update?pretty
{
"doc": { "name": "Jane Doe", "age": 20 }
}

POST /customer/external/1/_update?pretty
{
"script" : "ctx._source.age += 5"
}

刪除記錄

DELETE /cutomer/external/1?pretty

批處理

POST /customer/external/_bulk?pretty
{"index":{"_id":"1"}}
{"name": "John Doe" }
{"index":{"_id":"2"}}
{"name": "Jane Doe" }

POST /customer/external/_bulk?pretty
{"update":{"_id":"1"}}
{"doc": { "name": "John Doe becomes Jane Doe" } }
{"delete":{"_id":"2"}}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 基礎(chǔ)概念 Elasticsearch有幾個(gè)核心概念,從一開始理解這些概念會(huì)對(duì)整個(gè)學(xué)習(xí)過(guò)程有莫大的幫助。 接近實(shí)時(shí)(...
    山天大畜閱讀 2,163評(píng)論 0 4
  • 一些概念 索引-index: 一個(gè)索引就是一個(gè)擁有幾分相似特征的文檔的集合。比如說(shuō),你可以有一個(gè)客戶數(shù)據(jù)的索引,另...
    perfect_jimmy閱讀 3,582評(píng)論 0 0
  • 博客原文一博客原文二 翻譯作品,水平有限,如有錯(cuò)誤,煩請(qǐng)留言指正。原文請(qǐng)見 官網(wǎng)英文文檔 起步 Elasticse...
    rabbitGYK閱讀 3,389評(píng)論 0 68
  • 一、環(huán)境搭建 軟件版本: Linux:centos7 64bit JDK:1.8.0 elasticsearch:...
    lailai900201閱讀 3,688評(píng)論 0 12
  • elasticsearch使用--簡(jiǎn)單入門(一) 一、下載安裝 安裝java 下載elasticsearch相應(yīng)版...
    ifeelok0319閱讀 415評(píng)論 0 0

友情鏈接更多精彩內(nèi)容