ElasticSearch基本命令

2021-09-17 01:29:45 字數 1053 閱讀 3131

es rest crud常用操作:

1、測試服務正常開啟:

curl -xget "localhost:9200"

2、檢視索引列表:

curl -xget "localhost:9200/_cat/nodes?v"

3、檢視索引列表:

curl -xget "localhost:9200/_cat/indices?v"

4、建立索引

curl -xput "localhost:9200/customer?pretty"

5、索引刪除

curl -xdelete "localhost:9200/customer?pretty"

6、資料獲取

curl -xget "localhost:9200/goods/_search?pretty"

7、文件建立

8、文件更新

9、文件獲取

curl -xget "localhost:9200/goods/_doc/3?pretty"

10、文件刪除

curl -xdelete "localhost:9200/goods/_doc/3?pretty"

esearch查詢 uri方式

curl -xget "localhost:9200/goods/_search?q=title:orange&pretty"

curl -xget "localhost:9200/goods/_search?q=orange&pretty"

esearch查詢 dsl方式

多文件查詢

分詞,查詢 ,ik分詞:

ik安裝文件

"content": }}'

全文分詞檢索高亮使用

},"highlight" : }}

}'sort

stored_fields:}}'

php安裝

jdbc

授權:grant all privileges on *.* to 『username』@『%』 identified by 'password』;

Elasticsearch 基本操作

mget elasticsearch中檢索多個文件,相對於乙個乙個的檢索,更快的方式是在乙個請求中使用multi get或者 mget api。具體應用如下 mget api引數是乙個 docs 陣列,陣列的每個節點定義乙個文件的 index type id 元資料。如果你只想檢索乙個或幾 個確定的...

elasticsearch基本操作

get search 建立索引 指定分片和副本 put lib 建立索引 put lib2 檢視索引的配置 get lib settings get lib2 settings get all settings 新增文件put方式指定id put lib user 1 新增文件,不指定id用post...

Elasticsearch 基本操作

乙個批量匯入elasticsearch 的demo 機器少的話,分片數最好是你的data節點的機器數倍數,這樣請求負載能夠均攤到每個機器上,如果機器比較多,最好保證分片數不要太多,比如最好別超過20 30個,然後根據你的資料量評估一下,盡量保證每個分片在15到20g吧 資料 vi request.j...