cat.asciidoc 2.2 KB

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