CAT API

Introduced 1.0

You can get essential statistics about your cluster in an easy-to-understand, tabular format using the compact and aligned text (CAT) API. The CAT API is a human-readable interface that returns plain text instead of traditional JSON.

Using the CAT API, you can answer questions like which node is the elected master, what state is the cluster in, how many documents are in each index, and so on.

Example

To see the available operations in the CAT API, use the following command:

  1. GET _cat

copy

The response is an ASCII cat (=^.^=) and a list of operations:

  1. =^.^=
  2. /_cat/allocation
  3. /_cat/segment_replication
  4. /_cat/segment_replication/{index}
  5. /_cat/shards
  6. /_cat/shards/{index}
  7. /_cat/cluster_manager
  8. /_cat/nodes
  9. /_cat/tasks
  10. /_cat/indices
  11. /_cat/indices/{index}
  12. /_cat/segments
  13. /_cat/segments/{index}
  14. /_cat/count
  15. /_cat/count/{index}
  16. /_cat/recovery
  17. /_cat/recovery/{index}
  18. /_cat/health
  19. /_cat/pending_tasks
  20. /_cat/aliases
  21. /_cat/aliases/{alias}
  22. /_cat/thread_pool
  23. /_cat/thread_pool/{thread_pools}
  24. /_cat/plugins
  25. /_cat/fielddata
  26. /_cat/fielddata/{fields}
  27. /_cat/nodeattrs
  28. /_cat/repositories
  29. /_cat/snapshots/{repository}
  30. /_cat/templates
  31. /_cat/pit_segments
  32. /_cat/pit_segments/{pit_id}

Optional query parameters

The root _cat API does not take any parameters, but individual APIs, such as /_cat/nodes accept the following query parameters.

ParameterDescription
vProvides verbose output by adding headers to the columns. It also adds some formatting to help align each of the columns together. All examples in this section include the v parameter.
helpLists the default and other available headers for a given operation.
hLimits the output to specific headers.
formatThe format in which to return the result. Valid values are json, yaml, cbor, and smile.
sSorts the output by the specified columns.

Query parameter usage examples

You can specify a query parameter to any CAT operation to obtain more specific results.

Get verbose output

To query aliases and get verbose output that includes all column headings in the response, use the v query parameter.

  1. GET _cat/aliases?v

copy

The response provides more details, such as names of each column in the response.

  1. alias index filter routing.index routing.search is_write_index
  2. .kibana .kibana_1 - - - -
  3. sample-alias1 sample-index-1 - - - -

Without the verbose parameter, v, the response simply returns the alias names:

  1. .kibana .kibana_1 - - - -
  2. sample-alias1 sample-index-1 - - - -

Get all available headers

To see all the available headers, use the help parameter:

  1. GET _cat/<operation_name>?help

For example, to see the available headers for the CAT aliases operation, send the following request:

  1. GET _cat/aliases?help

copy

The response contains the available headers:

  1. alias | a | alias name
  2. index | i,idx | index alias points to
  3. filter | f,fi | filter
  4. routing.index | ri,routingIndex | index routing
  5. routing.search | rs,routingSearch | search routing
  6. is_write_index | w,isWriteIndex | write index

Get a subset of headers

To limit the output to a subset of headers, use the h parameter:

  1. GET _cat/<operation_name>?h=<header_name_1>,<header_name_2>&v

For example, to limit aliases to only the alias name and index, send the following request:

  1. GET _cat/aliases?h=alias,index

copy

The response contains the requested information:

  1. .kibana .kibana_1
  2. sample-alias1 sample-index-1

Typically, for any operation you can find out what headers are available using the help parameter, and then use the h parameter to limit the output to only the headers that you care about.

Sort by a header

To sort the output by a header, use the s parameter:

  1. GET _cat/<operation_name>?s=<header_name_1>,<header_name_2>

For example, to sort aliases by alias and then index, send the following request:

  1. GET _cat/aliases?s=i,a

copy

The response contains the requested information:

  1. sample-alias2 sample-index-1
  2. sample-alias1 sample-index-2

Retrieve data in JSON format

By default, CAT APIs return data in text/plain format.

To retrieve data in JSON format, use the format=json parameter:

  1. GET _cat/<operation_name>?format=json

For example, to retrieve aliases in JSON format, send the following request:

  1. GET _cat/aliases?format=json

copy

The response contains data in JSON format:

  1. [
  2. {"alias":".kibana","index":".kibana_1","filter":"-","routing.index":"-","routing.search":"-","is_write_index":"-"},
  3. {"alias":"sample-alias-1","index":"sample-index-1","filter":"-","routing.index":"-","routing.search":"-","is_write_index":"-"}
  4. ]

Other supported formats are YAML, CBOR, and Smile.

If you use the Security plugin, make sure you have the appropriate permissions.