2013-11-14 20:14:39 -05:00
|
|
|
[[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.
|
|
|
|
|
2014-01-06 12:23:24 -05:00
|
|
|
All the cat commands accept a query string parameter `help` to see all
|
2014-03-07 14:21:43 -05:00
|
|
|
the headers and info they provide, and the `/_cat` command alone lists all
|
2013-12-05 08:36:27 -05:00
|
|
|
the available commands.
|
|
|
|
|
2013-11-14 20:14:39 -05:00
|
|
|
[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]
|
|
|
|
--------------------------------------------------
|
2013-12-02 09:30:49 -05:00
|
|
|
% curl 'localhost:9200/_cat/master?v'
|
2013-11-14 20:14:39 -05:00
|
|
|
id ip node
|
|
|
|
EGtKWZlWQYWDmX29fUnp3Q 127.0.0.1 Grey, Sara
|
|
|
|
--------------------------------------------------
|
|
|
|
|
2013-12-23 18:14:56 -05:00
|
|
|
[float]
|
|
|
|
[[help]]
|
|
|
|
=== Help
|
|
|
|
|
2014-01-06 12:23:24 -05:00
|
|
|
Each of the commands accepts a query string parameter `help` which will
|
2013-12-23 18:14:56 -05:00
|
|
|
output its available columns.
|
|
|
|
|
|
|
|
[source,shell]
|
|
|
|
--------------------------------------------------
|
2014-01-06 12:23:24 -05:00
|
|
|
% curl 'localhost:9200/_cat/master?help'
|
2013-12-23 18:14:56 -05:00
|
|
|
id | node id
|
|
|
|
ip | node transport ip address
|
|
|
|
node | node name
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
[float]
|
|
|
|
[[headers]]
|
|
|
|
=== Headers
|
|
|
|
|
2014-01-06 12:23:24 -05:00
|
|
|
Each of the commands accepts a query string parameter `h` which forces
|
|
|
|
only those columns to appear.
|
2013-12-23 18:14:56 -05:00
|
|
|
|
|
|
|
[source,shell]
|
|
|
|
--------------------------------------------------
|
2014-01-06 12:23:24 -05:00
|
|
|
% curl 'n1:9200/_cat/nodes?h=ip,port,heapPercent,name'
|
2013-12-23 18:14:56 -05:00
|
|
|
192.168.56.40 9300 40.3 Captain Universe
|
|
|
|
192.168.56.20 9300 15.3 Kaluu
|
|
|
|
192.168.56.50 9300 17.0 Yellowjacket
|
|
|
|
192.168.56.10 9300 12.3 Remy LeBeau
|
|
|
|
192.168.56.30 9300 43.9 Ramsey, Doug
|
|
|
|
--------------------------------------------------
|
|
|
|
|
2015-05-27 06:05:32 -04:00
|
|
|
You can also request multiple columns using simple wildcards like
|
|
|
|
`/_cat/thread_pool?h=ip,bulk.*` to get all headers (or aliases) starting
|
|
|
|
with `bulk.`.
|
|
|
|
|
2013-11-14 20:14:39 -05:00
|
|
|
[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
|
2013-12-05 08:36:27 -05:00
|
|
|
case is the eight one.
|
2013-11-14 20:14:39 -05:00
|
|
|
|
|
|
|
[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
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
2014-01-20 03:23:00 -05:00
|
|
|
include::cat/alias.asciidoc[]
|
|
|
|
|
2013-11-14 20:14:39 -05:00
|
|
|
include::cat/allocation.asciidoc[]
|
|
|
|
|
|
|
|
include::cat/count.asciidoc[]
|
|
|
|
|
2014-06-03 05:05:26 -04:00
|
|
|
include::cat/fielddata.asciidoc[]
|
|
|
|
|
2013-11-14 20:14:39 -05:00
|
|
|
include::cat/health.asciidoc[]
|
|
|
|
|
|
|
|
include::cat/indices.asciidoc[]
|
|
|
|
|
|
|
|
include::cat/master.asciidoc[]
|
|
|
|
|
|
|
|
include::cat/nodes.asciidoc[]
|
|
|
|
|
2013-11-29 02:08:54 -05:00
|
|
|
include::cat/pending_tasks.asciidoc[]
|
|
|
|
|
2014-06-03 05:05:26 -04:00
|
|
|
include::cat/plugins.asciidoc[]
|
|
|
|
|
2013-11-14 20:14:39 -05:00
|
|
|
include::cat/recovery.asciidoc[]
|
|
|
|
|
2014-01-25 12:20:46 -05:00
|
|
|
include::cat/thread_pool.asciidoc[]
|
|
|
|
|
2013-11-14 20:14:39 -05:00
|
|
|
include::cat/shards.asciidoc[]
|
2014-03-16 07:14:44 -04:00
|
|
|
|
2015-05-27 06:05:32 -04:00
|
|
|
include::cat/segments.asciidoc[]
|