cat.asciidoc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. [[cat]]
  2. = cat APIs
  3. [partintro]
  4. --
  5. ["float",id="intro"]
  6. == Introduction
  7. JSON is great... for computers. Even if it's pretty-printed, trying
  8. to find relationships in the data is tedious. Human eyes, especially
  9. when looking at an ssh terminal, need compact and aligned text. The
  10. cat API aims to meet this need.
  11. All the cat commands accept a query string parameter `help` to see all
  12. the headers and info they provide, and the `/_cat` command alone lists all
  13. the available commands.
  14. [float]
  15. [[common-parameters]]
  16. == Common parameters
  17. [float]
  18. [[verbose]]
  19. === Verbose
  20. Each of the commands accepts a query string parameter `v` to turn on
  21. verbose output.
  22. [source,sh]
  23. --------------------------------------------------
  24. % curl 'localhost:9200/_cat/master?v'
  25. id ip node
  26. EGtKWZlWQYWDmX29fUnp3Q 127.0.0.1 Grey, Sara
  27. --------------------------------------------------
  28. [float]
  29. [[help]]
  30. === Help
  31. Each of the commands accepts a query string parameter `help` which will
  32. output its available columns.
  33. [source,sh]
  34. --------------------------------------------------
  35. % curl 'localhost:9200/_cat/master?help'
  36. id | node id
  37. ip | node transport ip address
  38. node | node name
  39. --------------------------------------------------
  40. [float]
  41. [[headers]]
  42. === Headers
  43. Each of the commands accepts a query string parameter `h` which forces
  44. only those columns to appear.
  45. [source,sh]
  46. --------------------------------------------------
  47. % curl 'n1:9200/_cat/nodes?h=ip,port,heapPercent,name'
  48. 192.168.56.40 9300 40.3 Captain Universe
  49. 192.168.56.20 9300 15.3 Kaluu
  50. 192.168.56.50 9300 17.0 Yellowjacket
  51. 192.168.56.10 9300 12.3 Remy LeBeau
  52. 192.168.56.30 9300 43.9 Ramsey, Doug
  53. --------------------------------------------------
  54. You can also request multiple columns using simple wildcards like
  55. `/_cat/thread_pool?h=ip,bulk.*` to get all headers (or aliases) starting
  56. with `bulk.`.
  57. [float]
  58. [[numeric-formats]]
  59. === Numeric formats
  60. Many commands provide a few types of numeric output, either a byte
  61. value or a time value. By default, these types are human-formatted,
  62. for example, `3.5mb` instead of `3763212`. The human values are not
  63. sortable numerically, so in order to operate on these values where
  64. order is important, you can change it.
  65. Say you want to find the largest index in your cluster (storage used
  66. by all the shards, not number of documents). The `/_cat/indices` API
  67. is ideal. We only need to tweak two things. First, we want to turn
  68. off human mode. We'll use a byte-level resolution. Then we'll pipe
  69. our output into `sort` using the appropriate column, which in this
  70. case is the eight one.
  71. [source,sh]
  72. --------------------------------------------------
  73. % curl '192.168.56.10:9200/_cat/indices?bytes=b' | sort -rnk8
  74. green wiki2 3 0 10000 0 105274918 105274918
  75. green wiki1 3 0 10000 413 103776272 103776272
  76. green foo 1 0 227 0 2065131 2065131
  77. --------------------------------------------------
  78. --
  79. include::cat/alias.asciidoc[]
  80. include::cat/allocation.asciidoc[]
  81. include::cat/count.asciidoc[]
  82. include::cat/fielddata.asciidoc[]
  83. include::cat/health.asciidoc[]
  84. include::cat/indices.asciidoc[]
  85. include::cat/master.asciidoc[]
  86. include::cat/nodeattrs.asciidoc[]
  87. include::cat/nodes.asciidoc[]
  88. include::cat/pending_tasks.asciidoc[]
  89. include::cat/plugins.asciidoc[]
  90. include::cat/recovery.asciidoc[]
  91. include::cat/thread_pool.asciidoc[]
  92. include::cat/shards.asciidoc[]
  93. include::cat/segments.asciidoc[]