kibana使用


Kibana是一個開源的分析與可視化平台,設計出來用於和Elasticsearch一起使用的。
可以用kibana搜索、查看存放在Elasticsearch中的數據。
Kibana與Elasticsearch的交互方式是各種不同的圖表、表格、地圖等,直觀的展示數據,從而達到高級的數據分析與可視化的目的。

1.下載

  地址 https://www.elastic.co/cn/downloads/kibana

2.啟動

  解壓,進入bin目錄,執行

kibana

瀏覽器打開http://localhost:5601

3.使用

(1)插入兩條數據

curl -XPOST 'localhost:9200/store/category/1?pretty' -H 'Content-type:application/json' -d'{"name":"soap","type":"cleaning","postDate":"2019-9-15","message":"this is a first data"}'
curl -XPOST 'localhost:9200/store/category/2?pretty' -H 'Content-type:application/json' -d'{"name":"soap1","type":"cleaning","postDate":"2019-9-15","message":"this is a second data"}'

A.建立所以

在kibana界面建立一個索引,和elaticsearch建立的索引進行配對

  kibana中的management管理

       單擊index patterns索引模塊

       選擇create index pattern模塊,建立索引

注:

  建立的索引名要和elasticsearch建立的索引對應,否則,無法創建kibana的索引

B.查看 

索引建立完成后,點擊【Discover】,選擇建立的索引,查看數據

數據太少,沒辦法充分發揮Kibana的作用,很多高級的數據分析和圖形化界面都沒法展示出來,所以需要導入一些測試數據到Elasticsearch中

 (2)導入數據

數據 https://pan.baidu.com/s/139UlJ2RcCOUwKunR6R0yDA

curl -XPOST 'localhost:9200/shakespeare/_bulk?pretty' -H 'Content-type:application/json' --data-binary @shakespeare.json

建立索引shakespeare,點擊【Discover】菜單進行查看

 點擊【Visualize】Create new visualization,選擇折線圖Line來展示 Shakespeare數據集並比較劇中的speaking發言部分數量

在“ Metrics”窗格中,展開“ Y-Axis”

將Aggregation聚合設置為Unique Count唯一計數

將Field字段設置為speaker.keyword發言

在“ Custom Label 自定義標簽”框中,輸入Speaking Parts

 

在“ Buckets”窗格中,單擊“ X-Axis”

將Aggregation聚合設置為Terms條款和 Field字段為play_name.keyword

要按字母順序列出表演,請在“ Order”下拉菜單中選擇“ Ascending”

為軸提供自定義標簽Play Name

單擊Apply changes

有多種圖表可供選擇

注:

  Kibana 的版本需要和 Elasticsearch 的版本一致,否則會出現Kibana server is not ready yet

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM