CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-elastic--elasticsearch

The official Elasticsearch client for Node.js providing comprehensive access to Elasticsearch clusters through a type-safe JavaScript/TypeScript API

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

cat-apis.mddocs/

CAT APIs

Human-readable cluster information endpoints providing tabular output for monitoring, debugging, and administration of Elasticsearch clusters with customizable formatting and field selection.

Capabilities

Cluster Health

Get cluster health information in human-readable tabular format.

/**
 * Get cluster health in tabular format
 * @param params - CAT health parameters
 * @returns Promise with health records
 */
function health(params?: {
  /** Output format (json, yaml, cbor, smile) */
  format?: string;
  /** Comma-separated list of column names to display */
  h?: string[];
  /** Include column names in output */
  v?: boolean;
  /** Display help information */
  help?: boolean;
  /** Sort by column */
  s?: string[];
  /** Time units for time-based values */
  time?: TimeUnit;
  /** Size units for byte-based values */
  bytes?: Bytes;
}): Promise<TransportResult<CatHealthRecord[], unknown>>;

interface CatHealthRecord {
  epoch?: string;
  timestamp?: string;
  cluster?: string;
  status?: string;
  'node.total'?: string;
  'node.data'?: string;
  shards?: string;
  pri?: string;
  relo?: string;
  init?: string;
  unassign?: string;
  pending_tasks?: string;
  max_task_wait_time?: string;
  active_shards_percent?: string;
}

type TimeUnit = 'nanos' | 'micros' | 'ms' | 's' | 'm' | 'h' | 'd';
type Bytes = 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb';

Usage Examples:

// Basic health check
const health = await client.cat.health({ v: true });

// Specific columns with JSON format
const health = await client.cat.health({
  format: 'json',
  h: ['cluster', 'status', 'node.total', 'active_shards_percent']
});

// Health with custom time units
const health = await client.cat.health({
  v: true,
  time: 's'
});

Indices Information

Get information about indices in tabular format.

/**
 * Get indices information in tabular format
 * @param params - CAT indices parameters
 * @returns Promise with indices records
 */
function indices(params?: {
  /** Target indices */
  index?: Indices;
  /** Output format */
  format?: string;
  /** Column names to display */
  h?: string[];
  /** Include column names */
  v?: boolean;
  /** Display help */
  help?: boolean;
  /** Sort by column */
  s?: string[];
  /** Time units */
  time?: TimeUnit;
  /** Size units */
  bytes?: Bytes;
  /** Health status filter */
  health?: HealthStatus;
  /** Include hidden indices */
  expand_wildcards?: ExpandWildcards;
  /** Pri flag */
  pri?: boolean;
}): Promise<TransportResult<CatIndicesRecord[], unknown>>;

interface CatIndicesRecord {
  health?: string;
  status?: string;
  index?: string;
  uuid?: string;
  pri?: string;
  rep?: string;
  'docs.count'?: string;
  'docs.deleted'?: string;
  'store.size'?: string;
  'pri.store.size'?: string;
  tm?: string;
  'creation.date'?: string;
  'creation.date.string'?: string;
}

Usage Examples:

// List all indices with basic info
const indices = await client.cat.indices({ v: true });

// Show only unhealthy indices
const unhealthyIndices = await client.cat.indices({
  health: 'red',
  format: 'json'
});

// Custom columns for storage analysis
const storageInfo = await client.cat.indices({
  h: ['index', 'docs.count', 'store.size', 'pri.store.size'],
  bytes: 'mb',
  s: ['store.size:desc']
});

Nodes Information

Get information about cluster nodes.

/**
 * Get nodes information in tabular format
 * @param params - CAT nodes parameters
 * @returns Promise with nodes records
 */
function nodes(params?: {
  /** Output format */
  format?: string;
  /** Column names to display */
  h?: string[];
  /** Include column names */
  v?: boolean;
  /** Display help */
  help?: boolean;
  /** Sort by column */
  s?: string[];
  /** Time units */
  time?: TimeUnit;
  /** Size units */
  bytes?: Bytes;
  /** Show full node IDs */
  full_id?: boolean;
  /** Master timeout */
  master_timeout?: Duration;
}): Promise<TransportResult<CatNodesRecord[], unknown>>;

interface CatNodesRecord {
  id?: string;
  pid?: string;
  ip?: string;
  port?: string;
  http_address?: string;
  version?: string;
  flavor?: string;
  type?: string;
  build?: string;
  jdk?: string;
  'disk.total'?: string;
  'disk.used'?: string;
  'disk.avail'?: string;
  'disk.used_percent'?: string;
  'heap.current'?: string;
  'heap.percent'?: string;
  'heap.max'?: string;
  'ram.current'?: string;
  'ram.percent'?: string;
  'ram.max'?: string;
  'file_desc.current'?: string;
  'file_desc.percent'?: string;
  'file_desc.max'?: string;
  cpu?: string;
  load_1m?: string;
  load_5m?: string;
  load_15m?: string;
  uptime?: string;
  'node.role'?: string;
  master?: string;
  name?: string;
  'completion.size'?: string;
  'fielddata.memory_size'?: string;
  'fielddata.evictions'?: string;
  'query_cache.memory_size'?: string;
  'query_cache.evictions'?: string;
  'query_cache.hit_count'?: string;
  'query_cache.miss_count'?: string;
  'request_cache.memory_size'?: string;
  'request_cache.evictions'?: string;
  'request_cache.hit_count'?: string;
  'request_cache.miss_count'?: string;
  'flush.total'?: string;
  'flush.total_time'?: string;
  'get.current'?: string;
  'get.time'?: string;
  'get.total'?: string;
  'get.exists_time'?: string;
  'get.exists_total'?: string;
  'get.missing_time'?: string;
  'get.missing_total'?: string;
  'indexing.delete_current'?: string;
  'indexing.delete_time'?: string;
  'indexing.delete_total'?: string;
  'indexing.index_current'?: string;
  'indexing.index_time'?: string;
  'indexing.index_total'?: string;
  'indexing.index_failed'?: string;
  'merges.current'?: string;
  'merges.current_docs'?: string;
  'merges.current_size'?: string;
  'merges.total'?: string;
  'merges.total_docs'?: string;
  'merges.total_size'?: string;
  'merges.total_time'?: string;
  'refresh.total'?: string;
  'refresh.time'?: string;
  'refresh.external_total'?: string;
  'refresh.external_time'?: string;
  'refresh.listeners'?: string;
  'script.compilations'?: string;
  'script.cache_evictions'?: string;
  'script.compilation_limit_triggered'?: string;
  'search.fetch_current'?: string;
  'search.fetch_time'?: string;
  'search.fetch_total'?: string;
  'search.open_contexts'?: string;
  'search.query_current'?: string;
  'search.query_time'?: string;
  'search.query_total'?: string;
  'search.scroll_current'?: string;
  'search.scroll_time'?: string;
  'search.scroll_total'?: string;
  'segments.count'?: string;
  'segments.memory'?: string;
  'segments.index_writer_memory'?: string;
  'segments.version_map_memory'?: string;
  'segments.fixed_bitset_memory'?: string;
  'suggest.current'?: string;
  'suggest.time'?: string;
  'suggest.total'?: string;
  'bulk.total_operations'?: string;
  'bulk.total_time'?: string;
  'bulk.total_size_in_bytes'?: string;
  'bulk.avg_time'?: string;
  'bulk.avg_size_in_bytes'?: string;
}

Usage Examples:

// Show all nodes with basic info
const nodes = await client.cat.nodes({ v: true });

// Show resource usage
const resources = await client.cat.nodes({
  h: ['name', 'heap.percent', 'ram.percent', 'cpu', 'load_1m'],
  s: ['heap.percent:desc']
});

// Show node roles and master status
const roles = await client.cat.nodes({
  h: ['name', 'node.role', 'master'],
  format: 'json'
});

Shards Information

Get detailed shard allocation information.

/**
 * Get shards information in tabular format
 * @param params - CAT shards parameters
 * @returns Promise with shards records
 */
function shards(params?: {
  /** Target indices */
  index?: Indices;
  /** Output format */
  format?: string;
  /** Column names to display */
  h?: string[];
  /** Include column names */
  v?: boolean;
  /** Sort by column */
  s?: string[];
  /** Time units */
  time?: TimeUnit;
  /** Size units */
  bytes?: Bytes;
  /** Master timeout */
  master_timeout?: Duration;
}): Promise<TransportResult<CatShardsRecord[], unknown>>;

interface CatShardsRecord {
  index?: string;
  shard?: string;
  prirep?: string;
  state?: string;
  docs?: string;
  store?: string;
  ip?: string;
  node?: string;
  sync_id?: string;
  'unassigned.reason'?: string;
  'unassigned.at'?: string;
  'unassigned.for'?: string;
  'unassigned.details'?: string;
  'recoverysource.type'?: string;
}

Usage Examples:

// Show all shards
const shards = await client.cat.shards({ v: true });

// Show unassigned shards
const unassigned = await client.cat.shards({
  h: ['index', 'shard', 'prirep', 'state', 'unassigned.reason'],
  s: ['state']
});

// Show shards for specific index
const indexShards = await client.cat.shards({
  index: 'my-index',
  format: 'json'
});

Aliases Information

Get index aliases information.

/**
 * Get aliases information in tabular format
 * @param params - CAT aliases parameters
 * @returns Promise with aliases records
 */
function aliases(params?: {
  /** Alias names */
  name?: Names;
  /** Output format */
  format?: string;
  /** Column names to display */
  h?: string[];
  /** Include column names */
  v?: boolean;
  /** Sort by column */
  s?: string[];
  /** Expand wildcards */
  expand_wildcards?: ExpandWildcards;
}): Promise<TransportResult<CatAliasesRecord[], unknown>>;

interface CatAliasesRecord {
  alias?: string;
  index?: string;
  filter?: string;
  'routing.index'?: string;
  'routing.search'?: string;
  is_write_index?: string;
}

Usage Examples:

// Show all aliases
const aliases = await client.cat.aliases({ v: true });

// Show aliases for specific pattern
const logAliases = await client.cat.aliases({
  name: 'logs-*',
  format: 'json'
});

Allocation Information

Show shard allocation across nodes.

/**
 * Get allocation information in tabular format
 * @param params - CAT allocation parameters
 * @returns Promise with allocation records
 */
function allocation(params?: {
  /** Node IDs */
  node_id?: NodeIds;
  /** Output format */
  format?: string;
  /** Column names to display */
  h?: string[];
  /** Include column names */
  v?: boolean;
  /** Sort by column */
  s?: string[];
  /** Size units */
  bytes?: Bytes;
  /** Master timeout */
  master_timeout?: Duration;
}): Promise<TransportResult<CatAllocationRecord[], unknown>>;

interface CatAllocationRecord {
  shards?: string;
  'disk.indices'?: string;
  'disk.used'?: string;
  'disk.avail'?: string;
  'disk.total'?: string;
  'disk.percent'?: string;
  host?: string;
  ip?: string;
  node?: string;
}

Templates Information

Show index templates.

/**
 * Get templates information in tabular format
 * @param params - CAT templates parameters
 * @returns Promise with templates records
 */
function templates(params?: {
  /** Template name */
  name?: Name;
  /** Output format */
  format?: string;
  /** Column names to display */
  h?: string[];
  /** Include column names */
  v?: boolean;
  /** Sort by column */
  s?: string[];
  /** Master timeout */
  master_timeout?: Duration;
}): Promise<TransportResult<CatTemplatesRecord[], unknown>>;

interface CatTemplatesRecord {
  name?: string;
  index_patterns?: string;
  order?: string;
  version?: string;
  composed_of?: string;
}

Thread Pool Information

Show thread pool statistics.

/**
 * Get thread pool information in tabular format
 * @param params - CAT thread pool parameters
 * @returns Promise with thread pool records
 */
function threadPool(params?: {
  /** Thread pool names */
  thread_pool_patterns?: Names;
  /** Output format */
  format?: string;
  /** Column names to display */
  h?: string[];
  /** Include column names */
  v?: boolean;
  /** Sort by column */
  s?: string[];
  /** Time units */
  time?: TimeUnit;
  /** Size units for memory */
  size?: SizeUnit;
  /** Master timeout */
  master_timeout?: Duration;
}): Promise<TransportResult<CatThreadPoolRecord[], unknown>>;

interface CatThreadPoolRecord {
  node_name?: string;
  name?: string;
  active?: string;
  queue?: string;
  rejected?: string;
  largest?: string;
  completed?: string;
  core?: string;
  max?: string;
  size?: string;
  keep_alive?: string;
}

type SizeUnit = 'b' | 'k' | 'm' | 'g' | 't' | 'p';

Segments Information

Show Lucene segment information.

/**
 * Get segments information in tabular format
 * @param params - CAT segments parameters
 * @returns Promise with segments records  
 */
function segments(params?: {
  /** Target indices */
  index?: Indices;
  /** Output format */
  format?: string;
  /** Column names to display */
  h?: string[];
  /** Include column names */
  v?: boolean;
  /** Sort by column */
  s?: string[];
  /** Size units */
  bytes?: Bytes;
}): Promise<TransportResult<CatSegmentsRecord[], unknown>>;

interface CatSegmentsRecord {
  index?: string;
  shard?: string;
  prirep?: string;
  ip?: string;
  segment?: string;
  generation?: string;
  'docs.count'?: string;
  'docs.deleted'?: string;
  size?: string;
  'size.memory'?: string;
  committed?: string;
  searchable?: string;
  version?: string;
  compound?: string;
}

Usage Examples:

// Show segment information for all indices
const segments = await client.cat.segments({ v: true });

// Show segments for specific index with size info
const indexSegments = await client.cat.segments({
  index: 'my-large-index',
  h: ['index', 'shard', 'segment', 'docs.count', 'size'],
  bytes: 'mb',
  s: ['size:desc']
});

Types

type Indices = string | string[];
type Names = string | string[];
type Name = string;
type NodeIds = string | string[];
type Duration = string;
type HealthStatus = 'green' | 'yellow' | 'red';
type ExpandWildcards = 'all' | 'open' | 'closed' | 'hidden' | 'none';

Install with Tessl CLI

npx tessl i tessl/npm-elastic--elasticsearch

docs

advanced-features.md

cat-apis.md

client-configuration.md

cluster-operations.md

document-operations.md

helper-functions.md

index-management.md

index.md

machine-learning.md

search-operations.md

security-management.md

tile.json