<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # cat APIs 原文鏈接 : [https://www.elastic.co/guide/en/elasticsearch/reference/5.0/cat.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/cat.html) 譯文鏈接 : [http://www.apache.wiki/display/Elasticsearch/cat+APIs](http://www.apache.wiki/display/Elasticsearch/cat+APIs) 貢獻者 : [那伊抹微笑](/display/~wangyangting) ## Introduction(介紹) 對于計算機來說,**JSON** 是一種很好的格式,雖然它便于打印,但是嘗試找出潛在的數據關系是比較麻煩的。人們的眼睛,特別是在一個 **ssh** 終端看東西時,需要緊湊的,對齊的文本。該 **cat API** 的目標就是為了滿足這種需求。 所有的 **cat** 命令接受一個查詢字符串的參數 **help** 以看到它提供的所有的 **header**(頭部)和其它的信息,以及單個的 **/_cat** 命令可以列出所有可用的命令。 ## 常見參數 ### Verbose(詳細的) 每個命令都可以接受一個查詢字符串參數 **v** 以在運行時輸出更詳細的信息。例如 :? ``` curl -XGET 'localhost:9200/_cat/master?v&pretty' ``` 可能會響應 :? ``` id host ip node u_n93zwxThWHi1PDBJAGAg 127.0.0.1 127.0.0.1 u_n93zw ``` ### Help(幫助) 每個命令都可以接受一個查詢字符串參數 **help**,它將輸出命令中可用的列。例如 :? ``` curl -XGET 'localhost:9200/_cat/master?help&pretty' ``` 可能響應如下 :? ``` id | | node id host | h | host name ip | | ip address node | n | node name ``` ### Headers(頁眉) 每個命令都可以接受一個查詢字符串參數 **h**,它將會強制只顯示那些出現的列。例如 :? ``` curl -XGET 'localhost:9200/_cat/nodes?h=ip,port,heapPercent,name&pretty' ``` 響應如下 :? ``` 127.0.0.1 9300 27 sLBaIGK ``` 您也可以像 **/_cat/thread_pool?h=ip,bulk.*** 這樣從 **bulk..** 這里開始使用簡單的通配符請求多個列以獲取所有的 **header**(頁眉或者別名)。 ### Numberic formats(數字格式) 許多命令提供了一個數字輸出的類型,可能是一個字節,大小,或者時間值。默認情況下,這些類型對于人們是友好的格式,例如,**3.5mb**(而不是 **3763212**),但是卻不適合排序。所以為了可以在這些值上進行操作,順序是很重要的,您必須改變它的格式。 假設您想找出集群中最大的索引(使用分片存儲,而不是文檔的數量)。**/_cat/indices API** 是可以做到的。我們只需要調整兩件事情。首先,我們希望關閉對人們友好的模式。我們就可以使用 **byte-level**(字節級別)的原理。然后我們使用合適的列將我們的輸出重定向到 **sort** 中。下面的例子演示了根據第**8**列數值的大小按照降序排序 :? ``` % curl '192.168.56.10:9200/_cat/indices?bytes=b' | sort -rnk8 green wiki2 3 0 10000 0 105274918 105274918 green wiki1 3 0 10000 413 103776272 103776272 green foo 1 0 227 0 2065131 2065131 ``` 如果您希望改變?[time units](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/common-options.html#time-units "Time unitsedit"),請使用?**`time`?**參數。 如果您希望改變?[size units](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/common-options.html#size-units "Unit-less quantitiesedit"),請使用?**`size`?**參數。 如果您希望改變?[byte units](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/common-options.html#byte-units "Byte size unitsedit"),請使用?**`bytes`?**參數。 ### Response as text, json, smile, yaml or cbor(作為?text, json, smile, yaml 或者 cbor 格式響應) ``` % curl 'localhost:9200/_cat/indices?format=json&pretty' [ { "pri.store.size": "650b", "health": "yellow", "status": "open", "index": "twitter", "pri": "5", "rep": "1", "docs.count": "0", "docs.deleted": "0", "store.size": "650b" } ] ``` 當前支持的格式(為 **?format**= 參數): - **text**(默認)- **json** - **smile** - **yaml** - **cbor**。此外,還可以設置 “**Accept**” **HTTP** **header** 到相應的媒體格式。以上所有格式都支持,**GET** 參數優先于 **header**。例如 :? ``` % curl '192.168.56.10:9200/_cat/indices?pretty' -H "Accept: application/json" [ { "pri.store.size": "650b", "health": "yellow", "status": "open", "index": "twitter", "pri": "5", "rep": "1", "docs.count": "0", "docs.deleted": "0", "store.size": "650b" } ] ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看