DEV Community

Mallikarjun H T
Mallikarjun H T

Posted on

ES - CAT APIs

cat APIs

Introduction

All the cat commands accept a query string parameter help to see all the headers and info they provide, and the /_cat command alone lists all the available commands.

Common parameters

  1. Verbose - curl -X GET "localhost:9200/_cat/master?v&pretty"
  2. Help - curl -X GET "localhost:9200/_cat/master?help&pretty"
  3. Headers - curl -X GET "localhost:9200/_cat/nodes?h=ip,port,heapPercent,name&pretty"
  4. Numeric formats - curl 'localhost:9200/_cat/indices?bytes=b' | sort -rnk8
  5. Response as text, json, smile, yaml or cbor - curl 'localhost:9200/_cat/indices?format=json&pretty'
  6. Sort - curl -X GET "localhost:9200/_cat/templates?v&s=order:desc,index_patterns&pretty"

cat aliases

curl -X GET "localhost:9200/_cat/aliases?v&pretty"
Enter fullscreen mode Exit fullscreen mode

cat allocation

curl -X GET "localhost:9200/_cat/allocation?v&pretty"
Enter fullscreen mode Exit fullscreen mode

cat count

curl -X GET "localhost:9200/_cat/count?v&pretty"

curl -X GET "localhost:9200/_cat/count/twitter?v&pretty"
Enter fullscreen mode Exit fullscreen mode

cat fielddata

curl -X GET "localhost:9200/_cat/fielddata?v&pretty"
Enter fullscreen mode Exit fullscreen mode

cat health

curl -X GET "localhost:9200/_cat/health?v&pretty"
Enter fullscreen mode Exit fullscreen mode

cat indices

curl -X GET "localhost:9200/_cat/indices?pretty"
Enter fullscreen mode Exit fullscreen mode

Apply Filter

curl -X GET "localhost:9200/_cat/indices/twi*?pretty"
Enter fullscreen mode Exit fullscreen mode

cat un healthy index

indices which are not ready

curl -X GET "localhost:9200/_cat/indices?v&health=yellow&pretty"
Enter fullscreen mode Exit fullscreen mode

sort by dock count

curl -X GET "localhost:9200/_cat/indices?v&s=docs.count:desc&pretty"
Enter fullscreen mode Exit fullscreen mode

cat master

curl -X GET "localhost:9200/_cat/master?v&pretty"

Enter fullscreen mode Exit fullscreen mode

cat nodes

curl -X GET "localhost:9200/_cat/nodes?v&pretty"
Enter fullscreen mode Exit fullscreen mode

Documentation

cat pending tasks

curl -X GET "localhost:9200/_cat/pending_tasks?v&pretty"
Enter fullscreen mode Exit fullscreen mode

cat plugins

curl -X GET "localhost:9200/_cat/plugins?v&s=component&h=name,component,version,description&pretty"

Enter fullscreen mode Exit fullscreen mode

cat recovery

curl -X GET "localhost:9200/_cat/recovery?v&pretty"
Enter fullscreen mode Exit fullscreen mode

cat repositories

curl -X GET "localhost:9200/_cat/repositories?v&pretty"
Enter fullscreen mode Exit fullscreen mode

cat thread pool

curl -X GET "localhost:9200/_cat/thread_pool?pretty"
Enter fullscreen mode Exit fullscreen mode

for field data visit Documentation

cat shards

curl -X GET "localhost:9200/_cat/shards?pretty"
Enter fullscreen mode Exit fullscreen mode

Reasion for un assigned shared look Documentation

INDEX_CREATED | Unassigned as a result of an API creation of an index.

CLUSTER_RECOVERED | Unassigned as a result of a full cluster recovery.

INDEX_REOPENED | Unassigned as a result of opening a closed index.

DANGLING_INDEX_IMPORTED | Unassigned as a result of importing a dangling index.

NEW_INDEX_RESTORED | Unassigned as a result of restoring into a new index.

EXISTING_INDEX_RESTORED | Unassigned as a result of restoring into a closed index.

REPLICA_ADDED | Unassigned as a result of explicit addition of a replica.

ALLOCATION_FAILED | Unassigned as a result of a failed allocation of the shard.

NODE_LEFT | Unassigned as a result of the node hosting it leaving the cluster.

REROUTE_CANCELLED | Unassigned as a result of explicit cancel reroute command.

REINITIALIZED | When a shard moves from started back to initializing, for example, with shadow replicas.

REALLOCATED_REPLICA | A better replica location is identified and causes the existing replica allocation to be cancelled.

cat segments

this where your data is saved on the FS.

curl -X GET "localhost:9200/_cat/segments?v&pretty"
Enter fullscreen mode Exit fullscreen mode

snapshots

curl -X GET "localhost:9200/_cat/snapshots/repo1?v&s=id&pretty"
Enter fullscreen mode Exit fullscreen mode

templates

curl -X GET "localhost:9200/_cat/templates?v&s=name&pretty"
Enter fullscreen mode Exit fullscreen mode

Top comments (0)