cat.asciidoc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. [float]
  12. [[common-parameters]]
  13. == Common parameters
  14. [float]
  15. [[verbose]]
  16. === Verbose
  17. Each of the commands accepts a query string parameter `v` to turn on
  18. verbose output.
  19. [source,shell]
  20. --------------------------------------------------
  21. % curl 'localhost:9200/_cat/master?v'
  22. id ip node
  23. EGtKWZlWQYWDmX29fUnp3Q 127.0.0.1 Grey, Sara
  24. --------------------------------------------------
  25. [float]
  26. [[numeric-formats]]
  27. === Numeric formats
  28. Many commands provide a few types of numeric output, either a byte
  29. value or a time value. By default, these types are human-formatted,
  30. for example, `3.5mb` instead of `3763212`. The human values are not
  31. sortable numerically, so in order to operate on these values where
  32. order is important, you can change it.
  33. Say you want to find the largest index in your cluster (storage used
  34. by all the shards, not number of documents). The `/_cat/indices` API
  35. is ideal. We only need to tweak two things. First, we want to turn
  36. off human mode. We'll use a byte-level resolution. Then we'll pipe
  37. our output into `sort` using the appropriate column, which in this
  38. case is the eigth one.
  39. [source,shell]
  40. --------------------------------------------------
  41. % curl '192.168.56.10:9200/_cat/indices?bytes=b' | sort -rnk8
  42. green wiki2 3 0 10000 0 105274918 105274918
  43. green wiki1 3 0 10000 413 103776272 103776272
  44. green foo 1 0 227 0 2065131 2065131
  45. --------------------------------------------------
  46. --
  47. include::cat/allocation.asciidoc[]
  48. include::cat/count.asciidoc[]
  49. include::cat/health.asciidoc[]
  50. include::cat/indices.asciidoc[]
  51. include::cat/master.asciidoc[]
  52. include::cat/nodes.asciidoc[]
  53. include::cat/pending_tasks.asciidoc[]
  54. include::cat/recovery.asciidoc[]
  55. include::cat/shards.asciidoc[]