76 lines
2.0 KiB
Plaintext
76 lines
2.0 KiB
Plaintext
[[cat]]
|
|
= cat APIs
|
|
|
|
[partintro]
|
|
--
|
|
|
|
["float",id="intro"]
|
|
== Introduction
|
|
|
|
JSON is great... for computers. Even if it's pretty-printed, trying
|
|
to find relationships in the data is tedious. Human eyes, especially
|
|
when looking at an ssh terminal, need compact and aligned text. The
|
|
cat API aims to meet this need.
|
|
|
|
[float]
|
|
[[common-parameters]]
|
|
== Common parameters
|
|
|
|
[float]
|
|
[[verbose]]
|
|
=== Verbose
|
|
|
|
Each of the commands accepts a query string parameter `v` to turn on
|
|
verbose output.
|
|
|
|
[source,shell]
|
|
--------------------------------------------------
|
|
% curl 'localhost:9200/_cat/master?v=true'
|
|
id ip node
|
|
EGtKWZlWQYWDmX29fUnp3Q 127.0.0.1 Grey, Sara
|
|
--------------------------------------------------
|
|
|
|
[float]
|
|
[[numeric-formats]]
|
|
=== Numeric formats
|
|
|
|
Many commands provide a few types of numeric output, either a byte
|
|
value or a time value. By default, these types are human-formatted,
|
|
for example, `3.5mb` instead of `3763212`. The human values are not
|
|
sortable numerically, so in order to operate on these values where
|
|
order is important, you can change it.
|
|
|
|
Say you want to find the largest index in your cluster (storage used
|
|
by all the shards, not number of documents). The `/_cat/indices` API
|
|
is ideal. We only need to tweak two things. First, we want to turn
|
|
off human mode. We'll use a byte-level resolution. Then we'll pipe
|
|
our output into `sort` using the appropriate column, which in this
|
|
case is the eigth one.
|
|
|
|
[source,shell]
|
|
--------------------------------------------------
|
|
% 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
|
|
--------------------------------------------------
|
|
|
|
|
|
--
|
|
|
|
include::cat/allocation.asciidoc[]
|
|
|
|
include::cat/count.asciidoc[]
|
|
|
|
include::cat/health.asciidoc[]
|
|
|
|
include::cat/indices.asciidoc[]
|
|
|
|
include::cat/master.asciidoc[]
|
|
|
|
include::cat/nodes.asciidoc[]
|
|
|
|
include::cat/recovery.asciidoc[]
|
|
|
|
include::cat/shards.asciidoc[]
|