- 1.curl192.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
3.curl 192.168.106.58:9200/_cat/indices?v 列出集群索引
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
4.curl -XPUT 192.168.106.58:9200/customer?pretty 創建customer索引 pretty表示打印json響應
{
"acknowledged" : true
}
5.curl -XPUT 192.168.106.58:9200/customer/external/1?pretty '-d { "name":"JOhn Doe"}' 索引數據
6.curl -XGET 192.168.106.58:9200/customer/external/1?pretty get查詢數據
7. curl -XDELETE 192.168.106.58:9200/customer?pretty 刪除索引
8.curl -XPUT 192.168.106.58:9200/customer/external/1?pretty '-d { "name":"JOhn Doe"}' 通過id更新索引數據
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/