ElasticSearch的各類服務的URL

1.curl 192.168.106.58:9200/_cat/health?v  集羣健康查看
epoch      timestamp cluster       status node.total node.data shards pri relo init unassign 
1400639131 10:25:31  elasticsearch green           1         1     18  18    0    0        0
2. curl 192.168.106.58:9200/_cat/nodes?v 節點健康查看

host    ip             heap.percent ram.percent load node.role master name   
wendah1 192.168.106.58           55          59 6.65 d         *      Primus node

3.curl 192.168.106.58:9200/_cat/indices?v  列出集羣索引json

health index        pri rep docs.count docs.deleted store.size pri.store.size 
green  autoindex      6   0    1800000            0    854.4mb        854.4mb 
green  autoindex111   6   0    1400000            0    864.4mb        864.4mb 
green  product        6   0    3000000            0      1.2gb          1.2gb app

4.curl -XPUT 192.168.106.58:9200/customer?pretty 建立customer索引 pretty表示打印json響應 curl

{
  "acknowledged" : true
}jvm

5.curl -XPUT 192.168.106.58:9200/customer/external/1?pretty '-d { "name":"JOhn Doe"}' 索引數據elasticsearch

6.curl -XGET 192.168.106.58:9200/customer/external/1?pretty get查詢數據優化

7. curl -XDELETE 192.168.106.58:9200/customer?pretty 刪除索引url

8.curl -XPUT 192.168.106.58:9200/customer/external/1?pretty '-d { "name":"JOhn Doe"}' 經過id更新索引數據spa

9.curl -XPOST 192.168.106.58:9200/customer/external?pretty '-d { "name":"JOhn Doe"}' 出入索引數據隨機id線程

10.curl -XDELETE 192.168.106.58:9200/customer/external/2?pretty 經過id刪除

11.curl -XDELETE '192.168.106.58:9200/customer/external/_query?pretty' -d '
{
  "query": { "match": { "name": "John" } }
}' 經過查詢刪除

12.curl -XPOST '192.168.106.58:9200/customer/external/_bulk?pretty' -d '
{"index":{"_id":"1"}}
{"name": "John Doe" }
{"index":{"_id":"2"}}
{"name": "Jane Doe" }
'
curl -XPOST '192.168.106.58:9200/customer/external/_bulk?pretty' -d '
{"update":{"_id":"1"}}
{"doc": { "name": "John Doe becomes Jane Doe" } }
{"delete":{"_id":"2"}}
'

13 curl -XPOST '192.168.106.58:9200/bank/account/_bulk?pretty' --data-binary @accounts.json 讀文件批量索引

 

批量索引操做

14 curl -XPOST '192.168.106.58:9200/bank/_search?pretty' -d '
{
  "query": {
    "bool": {
      "must": [
        { "match": { "address": "mill" } },
        { "match": { "address": "lane" } }
      ]
    }
  }
}' query DSL(後期詳細介紹)

15 curl 192.168.106.58:9200/_nodes/process?pretty 查看進程信息 包括打開文件數,是否鎖定內存等

 

 

索引相關

URL 說明
/index/_search 不解釋
/_aliases 獲取或操做索引的別名
/index/  
/index/type/ 建立或操做類型
/index/_mapping 建立或操做mapping
/index/_settings 建立或操做設置(number_of_shards是不可更改的)
/index/_open 打開被關閉的索引
/index/_close 關閉索引
/index/_refresh 刷新索引(使新加內容對搜索可見)
/index/_flush

刷新索引

將變更提交到lucene索引文件中

並清空elasticsearch的transaction log,

與refresh的區別須要繼續研究

/index/_optimize 優化segement,我的認爲主要是對segement進行合併
/index/_status 得到索引的狀態信息
/index/_segments 得到索引的segments的狀態信息
/index/_explain 不執行實際搜索,而返回解釋信息
/index/_analyze 不執行實際搜索,根據輸入的參數進行文本分析
/index/type/id 操做指定文檔,不解釋
/index/type/id/_create 建立一個文檔,若是該文件已經存在,則返回失敗
/index/type/id/_update 更新一個文件,若是改文件不存在,則返回失敗
   

 


Distributed

URL 說明
/_cluster/nodes 得到集羣中的節點列表和信息
/_cluster/health 得到集羣信息
/_cluster/state 得到集羣裏的全部信息(集羣信息、節點信息、mapping信息等)

 

 


Nodes

URL 說明
/_nodes/process 我主要看file descriptor 這個信息
/_nodes/process/stats 統計信息(內存、CPU能)
/_nodes/jvm 得到各節點的虛擬機統計和配置信息
/_nodes/jvm/stats 更詳細的虛擬機信息
/_nodes/http 得到各個節點的http信息(如ip地址)
/_nodes/http/stats 得到各個節點處理http請求的統計狀況
/_nodes/thread_pool

得到各類類型的線程池

(elasticsearch分別對不一樣的操做提供不一樣的線程池)的配置信息

/_nodes/thread_pool/stats 得到各類類型的線程池的統計信息
   

 

以上這些操做和能夠經過如

/_nodes/${nodeId}/jvm/stats

/_nodes/${nodeip}/jvm/stats

/_nodes/${nodeattribute}/jvm/stats

的形式針對指定節點的操做。

 


其餘

/_template/templateName 建立索引配置模板,好比默認的mapping

/_percolator/indexName/percolatorName 建立percolator(這個詞怎麼翻譯成中文,是個問題)

/index/type/_percolate/ 對payload中指定的文檔進行」反


結束語

將url列出,我的以爲,對把握整個elasticsearch的概念和系統結構頗有幫助,下一步須要針對重點內容(_search必然是重點內容)逐個研究。

參考文獻:http://wwwlouxuemingcom.blog.163.com/blog/static/209747822013287138100/

相關文章
相關標籤/搜索