
- Elasticsearch 教程
- Elasticsearch - 首頁
- Elasticsearch - 基本概念
- Elasticsearch - 安裝
- Elasticsearch - 資料填充
- 版本間遷移
- Elasticsearch - API 約定
- Elasticsearch - 文件 APIs
- Elasticsearch - 搜尋 APIs
- Elasticsearch - 聚合
- Elasticsearch - 索引 APIs
- Elasticsearch - CAT APIs
- Elasticsearch - 叢集 APIs
- Elasticsearch - 查詢 DSL
- Elasticsearch - 對映
- Elasticsearch - 分析
- Elasticsearch - 模組
- Elasticsearch - 索引模組
- Elasticsearch - Ingest 節點
- Elasticsearch - 管理索引生命週期
- Elasticsearch - SQL 訪問
- Elasticsearch - 監控
- Elasticsearch - 資料彙總
- Elasticsearch - 凍結索引
- Elasticsearch - 測試
- Elasticsearch - Kibana 儀表盤
- Elasticsearch - 按欄位過濾
- Elasticsearch - 資料表格
- Elasticsearch - 區域地圖
- Elasticsearch - 餅圖
- Elasticsearch - 面積圖和條形圖
- Elasticsearch - 時間序列
- Elasticsearch - 標籤雲
- Elasticsearch - 熱力圖
- Elasticsearch - Canvas
- Elasticsearch - 日誌 UI
- Elasticsearch 有用資源
- Elasticsearch - 快速指南
- Elasticsearch - 有用資源
- Elasticsearch - 討論
Elasticsearch - Cat APIs
通常,各種 Elasticsearch API 的結果以 JSON 格式顯示。但 JSON 並不總是容易閱讀。因此,Elasticsearch 中提供了 cat API 功能,有助於以更易於閱讀和理解的列印格式顯示結果。cat API 中使用了各種引數,用於不同的目的,例如 - 術語 V 使輸出變得詳細。
在本章中,我們將更詳細地瞭解 cat API。
詳細輸出
詳細輸出提供了 cat 命令結果的清晰顯示。在下面給出的示例中,我們獲得了叢集中存在的各種索引的詳細資訊。
GET /_cat/indices?v
執行以上程式碼後,我們將獲得如下所示的響應 -
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size yellow open schools RkMyEn2SQ4yUgzT6EQYuAA 1 1 2 1 21.6kb 21.6kb yellow open index_4_analysis zVmZdM1sTV61YJYrNXf1gg 1 1 0 0 283b 283b yellow open sensor-2018-01-01 KIrrHwABRB-ilGqTu3OaVQ 1 1 1 0 4.2kb 4.2kb yellow open colleges 3ExJbdl2R1qDLssIkwDAug 1 1 0 0 283b 283b
標題
h 引數(也稱為標題)用於僅顯示命令中提到的那些列。
GET /_cat/nodes?h=ip,port
執行以上程式碼後,我們將獲得如下所示的響應 -
127.0.0.1 9300
排序
sort 命令接受查詢字串,該字串可以按查詢中指定的列對錶格進行排序。預設排序為升序,但可以透過向列新增 :desc 來更改。
以下示例給出了按 index patterns 欄位降序排列的模板結果。
GET _cat/templates?v&s=order:desc,index_patterns
執行以上程式碼後,我們將獲得如下所示的響應 -
name index_patterns order version .triggered_watches [.triggered_watches*] 2147483647 .watch-history-9 [.watcher-history-9*] 2147483647 .watches [.watches*] 2147483647 .kibana_task_manager [.kibana_task_manager] 0 7000099
計數
count 引數提供整個叢集中文件總數的計數。
GET /_cat/count?v
執行以上程式碼後,我們將獲得如下所示的響應 -
epoch timestamp count 1557633536 03:58:56 17809
廣告