| 1 | # Licensed to Elasticsearch B.V under one or more agreements. | ||
| 2 | # Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
| 3 | # See the LICENSE file in the project root for more information | ||
| 4 | |||
| 5 | package Search::Elasticsearch::Client::8_0::Direct::Cat; | ||
| 6 | $Search::Elasticsearch::Client::8_0::Direct::Cat::VERSION = '8.12'; | ||
| 7 | use Moo; | ||
| 8 | with 'Search::Elasticsearch::Client::8_0::Role::API'; | ||
| 9 | with 'Search::Elasticsearch::Role::Client::Direct'; | ||
| 10 | use Search::Elasticsearch::Util qw(parse_params); | ||
| 11 | use namespace::clean; | ||
| 12 | __PACKAGE__->_install_api('cat'); | ||
| 13 | |||
| 14 | #=================================== | ||
| 15 | sub help { | ||
| 16 | #=================================== | ||
| 17 | my ( $self, $params ) = parse_params(@_); | ||
| 18 | $params->{help} = 1; | ||
| 19 | my $defn = $self->api->{'cat.help'}; | ||
| 20 | $self->perform_request( $defn, $params ); | ||
| 21 | } | ||
| 22 | |||
| 23 | #=================================== | ||
| 24 | around 'perform_request' => sub { | ||
| 25 | #=================================== | ||
| 26 | my $orig = shift; | ||
| 27 | my $self = shift; | ||
| 28 | my ( $defn, $params ) = parse_params(@_); | ||
| 29 | if ( $params->{help} && $params->{help} ne 'false' ) { | ||
| 30 | $defn = { %$defn, parts => {} }; | ||
| 31 | } | ||
| 32 | |||
| 33 | return $orig->( $self, $defn, $params ); | ||
| 34 | |||
| 35 | }; | ||
| 36 | |||
| 37 | 1; | ||
| 38 | |||
| 39 | =pod | ||
| 40 | |||
| 41 | =encoding UTF-8 | ||
| 42 | |||
| 43 | =head1 NAME | ||
| 44 | |||
| 45 | Search::Elasticsearch::Client::8_0::Direct::Cat - A client for running cat debugging requests | ||
| 46 | |||
| 47 | =head1 VERSION | ||
| 48 | |||
| 49 | version 8.12 | ||
| 50 | |||
| 51 | =head1 DESCRIPTION | ||
| 52 | |||
| 53 | The C<cat> API in Elasticsearch provides information about your | ||
| 54 | cluster and indices in a simple, easy to read text format, intended | ||
| 55 | for human consumption. | ||
| 56 | |||
| 57 | These APIs have a number of parameters in common: | ||
| 58 | |||
| 59 | =over | ||
| 60 | |||
| 61 | =item * C<help> | ||
| 62 | |||
| 63 | Returns help about the API, eg: | ||
| 64 | |||
| 65 | say $e->cat->allocation(help => 1); | ||
| 66 | |||
| 67 | =item * C<v> | ||
| 68 | |||
| 69 | Includes the column headers in the output: | ||
| 70 | |||
| 71 | say $e->cat->allocation(v => 1); | ||
| 72 | |||
| 73 | =item * C<h> | ||
| 74 | |||
| 75 | Accepts a list of column names to be output, eg: | ||
| 76 | |||
| 77 | say $e->cat->indices(h => ['health','index']); | ||
| 78 | |||
| 79 | =item * C<bytes> | ||
| 80 | |||
| 81 | Formats byte-based values as bytes (C<b>), kilobytes (C<k>), megabytes | ||
| 82 | (C<m>) or gigabytes (C<g>) | ||
| 83 | |||
| 84 | =back | ||
| 85 | |||
| 86 | It does L<Search::Elasticsearch::Role::Client::Direct>. | ||
| 87 | |||
| 88 | =head1 METHODS | ||
| 89 | |||
| 90 | =head2 C<help()> | ||
| 91 | |||
| 92 | say $e->cat->help; | ||
| 93 | |||
| 94 | Returns the list of supported C<cat> APIs | ||
| 95 | |||
| 96 | =head2 C<aliases()> | ||
| 97 | |||
| 98 | say $e->cat->aliases( | ||
| 99 | name => 'name' | \@names # optional | ||
| 100 | ); | ||
| 101 | |||
| 102 | Returns information about index aliases, optionally limited to the specified | ||
| 103 | index/alias names. | ||
| 104 | |||
| 105 | Query string parameters: | ||
| 106 | C<error_trace>, | ||
| 107 | C<format>, | ||
| 108 | C<h>, | ||
| 109 | C<help>, | ||
| 110 | C<human>, | ||
| 111 | C<local>, | ||
| 112 | C<master_timeout>, | ||
| 113 | C<s>, | ||
| 114 | C<v> | ||
| 115 | |||
| 116 | See the L<cat aliases docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-aliases.html> | ||
| 117 | for more information. | ||
| 118 | |||
| 119 | =head2 C<allocation()> | ||
| 120 | |||
| 121 | say $e->cat->allocation( | ||
| 122 | node_id => 'node' | \@nodes # optional | ||
| 123 | ); | ||
| 124 | |||
| 125 | Provides a snapshot of how shards have located around the cluster and the | ||
| 126 | state of disk usage. | ||
| 127 | |||
| 128 | Query string parameters: | ||
| 129 | C<bytes>, | ||
| 130 | C<error_trace>, | ||
| 131 | C<format>, | ||
| 132 | C<h>, | ||
| 133 | C<help>, | ||
| 134 | C<human>, | ||
| 135 | C<local>, | ||
| 136 | C<master_timeout>, | ||
| 137 | C<s>, | ||
| 138 | C<v> | ||
| 139 | |||
| 140 | See the L<cat allocation docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-allocation.html> | ||
| 141 | for more information. | ||
| 142 | |||
| 143 | =head2 C<count()> | ||
| 144 | |||
| 145 | say $e->cat->count( | ||
| 146 | index => 'index' | \@indices # optional | ||
| 147 | ); | ||
| 148 | |||
| 149 | Provides quick access to the document count of the entire cluster, or | ||
| 150 | individual indices. | ||
| 151 | |||
| 152 | Query string parameters: | ||
| 153 | C<error_trace>, | ||
| 154 | C<format>, | ||
| 155 | C<h>, | ||
| 156 | C<help>, | ||
| 157 | C<human>, | ||
| 158 | C<local>, | ||
| 159 | C<master_timeout>, | ||
| 160 | C<s>, | ||
| 161 | C<v> | ||
| 162 | |||
| 163 | See the L<cat count docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-count.html> | ||
| 164 | for more information. | ||
| 165 | |||
| 166 | =head2 C<fielddata()> | ||
| 167 | |||
| 168 | say $e->cat->fielddata( | ||
| 169 | fields => 'field' | \@fields # optional | ||
| 170 | ); | ||
| 171 | |||
| 172 | Shows the amount of memory used by each of the specified `fields` (or all | ||
| 173 | fields) loaded into fielddata. | ||
| 174 | |||
| 175 | Query string parameters: | ||
| 176 | C<bytes>, | ||
| 177 | C<error_trace>, | ||
| 178 | C<format>, | ||
| 179 | C<h>, | ||
| 180 | C<help>, | ||
| 181 | C<human>, | ||
| 182 | C<local>, | ||
| 183 | C<master_timeout>, | ||
| 184 | C<s>, | ||
| 185 | C<v> | ||
| 186 | |||
| 187 | See the L<cat fielddata docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-fielddata.html> | ||
| 188 | for more information. | ||
| 189 | |||
| 190 | =head2 C<health()> | ||
| 191 | |||
| 192 | say $e->cat->health(); | ||
| 193 | |||
| 194 | Provides a snapshot of how shards have located around the cluster and the | ||
| 195 | state of disk usage. | ||
| 196 | |||
| 197 | Query string parameters: | ||
| 198 | C<error_trace>, | ||
| 199 | C<format>, | ||
| 200 | C<h>, | ||
| 201 | C<help>, | ||
| 202 | C<human>, | ||
| 203 | C<local>, | ||
| 204 | C<master_timeout>, | ||
| 205 | C<ts>, | ||
| 206 | C<s>, | ||
| 207 | C<v> | ||
| 208 | |||
| 209 | See the L<cat health docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-health.html> | ||
| 210 | for more information. | ||
| 211 | |||
| 212 | =head2 C<indices()> | ||
| 213 | |||
| 214 | say $e->cat->indices( | ||
| 215 | index => 'index' | \@indices # optional | ||
| 216 | ); | ||
| 217 | |||
| 218 | Provides a summary of index size and health for the whole cluster | ||
| 219 | or individual indices | ||
| 220 | |||
| 221 | Query string parameters: | ||
| 222 | C<bytes>, | ||
| 223 | C<error_trace>, | ||
| 224 | C<format>, | ||
| 225 | C<h>, | ||
| 226 | C<health>, | ||
| 227 | C<help>, | ||
| 228 | C<human>, | ||
| 229 | C<local>, | ||
| 230 | C<master_timeout>, | ||
| 231 | C<pri>, | ||
| 232 | C<s>, | ||
| 233 | C<v> | ||
| 234 | |||
| 235 | See the L<cat indices docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-indices.html> | ||
| 236 | for more information. | ||
| 237 | |||
| 238 | =head2 C<master()> | ||
| 239 | |||
| 240 | say $e->cat->master(); | ||
| 241 | |||
| 242 | Displays the master’s node ID, bound IP address, and node name. | ||
| 243 | |||
| 244 | Query string parameters: | ||
| 245 | C<error_trace>, | ||
| 246 | C<format>, | ||
| 247 | C<h>, | ||
| 248 | C<help>, | ||
| 249 | C<human>, | ||
| 250 | C<local>, | ||
| 251 | C<master_timeout>, | ||
| 252 | C<s>, | ||
| 253 | C<v> | ||
| 254 | |||
| 255 | See the L<cat master docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-master.html> | ||
| 256 | for more information. | ||
| 257 | |||
| 258 | =head2 C<nodeattrs()> | ||
| 259 | |||
| 260 | say $e->cat->nodeattrs(); | ||
| 261 | |||
| 262 | Returns the node attributes set per node. | ||
| 263 | |||
| 264 | Query string parameters: | ||
| 265 | C<error_trace>, | ||
| 266 | C<format>, | ||
| 267 | C<h>, | ||
| 268 | C<help>, | ||
| 269 | C<human>, | ||
| 270 | C<local>, | ||
| 271 | C<master_timeout>, | ||
| 272 | C<s>, | ||
| 273 | C<v> | ||
| 274 | |||
| 275 | See the L<cat nodeattrs docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-nodeattrs.html> | ||
| 276 | for more information. | ||
| 277 | |||
| 278 | =head2 C<nodes()> | ||
| 279 | |||
| 280 | say $e->cat->nodes(); | ||
| 281 | |||
| 282 | Provides a snapshot of all of the nodes in your cluster. | ||
| 283 | |||
| 284 | Query string parameters: | ||
| 285 | C<error_trace>, | ||
| 286 | C<format>, | ||
| 287 | C<h>, | ||
| 288 | C<help>, | ||
| 289 | C<human>, | ||
| 290 | C<local>, | ||
| 291 | C<master_timeout>, | ||
| 292 | C<s>, | ||
| 293 | C<v> | ||
| 294 | |||
| 295 | See the L<cat nodes docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-nodes.html> | ||
| 296 | for more information. | ||
| 297 | |||
| 298 | =head2 C<pending_tasks()> | ||
| 299 | |||
| 300 | say $e->cat->pending_tasks(); | ||
| 301 | |||
| 302 | Returns any cluster-level tasks which are queued on the master. | ||
| 303 | |||
| 304 | Query string parameters: | ||
| 305 | C<error_trace>, | ||
| 306 | C<format>, | ||
| 307 | C<human>, | ||
| 308 | C<local>, | ||
| 309 | C<master_timeout>, | ||
| 310 | C<h>, | ||
| 311 | C<help>, | ||
| 312 | C<s>, | ||
| 313 | C<v> | ||
| 314 | |||
| 315 | See the L<cat pending-tasks docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-pending-tasks.html> | ||
| 316 | for more information. | ||
| 317 | |||
| 318 | =head2 C<plugins()> | ||
| 319 | |||
| 320 | say $e->cat->plugins(); | ||
| 321 | |||
| 322 | Returns information about plugins installed on each node. | ||
| 323 | |||
| 324 | Query string parameters: | ||
| 325 | C<error_trace>, | ||
| 326 | C<format>, | ||
| 327 | C<human>, | ||
| 328 | C<local>, | ||
| 329 | C<master_timeout>, | ||
| 330 | C<h>, | ||
| 331 | C<help>, | ||
| 332 | C<s>, | ||
| 333 | C<v> | ||
| 334 | |||
| 335 | See the L<cat plugins docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-plugins.html> | ||
| 336 | for more information. | ||
| 337 | |||
| 338 | =head2 C<recovery()> | ||
| 339 | |||
| 340 | say $e->cat->recovery( | ||
| 341 | index => 'index' | \@indices # optional | ||
| 342 | ); | ||
| 343 | |||
| 344 | Provides a view of shard replication. It will show information | ||
| 345 | anytime data from at least one shard is copying to a different node. | ||
| 346 | It can also show up on cluster restarts. If your recovery process seems | ||
| 347 | stuck, try it to see if there’s any movement using C<recovery()>. | ||
| 348 | |||
| 349 | Query string parameters: | ||
| 350 | C<bytes>, | ||
| 351 | C<error_trace>, | ||
| 352 | C<format>, | ||
| 353 | C<h>, | ||
| 354 | C<help>, | ||
| 355 | C<human>, | ||
| 356 | C<master_timeout>, | ||
| 357 | C<s>, | ||
| 358 | C<v> | ||
| 359 | |||
| 360 | See the L<cat recovery docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-recovery.html> | ||
| 361 | for more information. | ||
| 362 | |||
| 363 | =head2 C<repositories()> | ||
| 364 | |||
| 365 | say $e->cat->repositories() | ||
| 366 | |||
| 367 | Provides a list of registered snapshot repositories. | ||
| 368 | |||
| 369 | Query string parameters: | ||
| 370 | C<error_trace>, | ||
| 371 | C<format>, | ||
| 372 | C<h>, | ||
| 373 | C<help>, | ||
| 374 | C<human>, | ||
| 375 | C<local>, | ||
| 376 | C<master_timeout>, | ||
| 377 | C<s>, | ||
| 378 | C<v> | ||
| 379 | |||
| 380 | See the L<cat repositories docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-repositories.html> | ||
| 381 | for more information. | ||
| 382 | |||
| 383 | =head2 C<segments()> | ||
| 384 | |||
| 385 | say $e->cat->segments( | ||
| 386 | index => 'index' | \@indices # optional | ||
| 387 | ); | ||
| 388 | |||
| 389 | Provides low level information about the segments in the shards of an index. | ||
| 390 | |||
| 391 | Query string parameters: | ||
| 392 | C<bytes>, | ||
| 393 | C<error_trace>, | ||
| 394 | C<format>, | ||
| 395 | C<h>, | ||
| 396 | C<help>, | ||
| 397 | C<human>, | ||
| 398 | C<s>, | ||
| 399 | C<v> | ||
| 400 | |||
| 401 | See the L<cat shards docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-segments.html> | ||
| 402 | for more information. | ||
| 403 | |||
| 404 | =head2 C<shards()> | ||
| 405 | |||
| 406 | say $e->cat->shards( | ||
| 407 | index => 'index' | \@indices # optional | ||
| 408 | ); | ||
| 409 | |||
| 410 | Provides a detailed view of what nodes contain which shards, the state and | ||
| 411 | size of each shard. | ||
| 412 | |||
| 413 | Query string parameters: | ||
| 414 | C<bytes>, | ||
| 415 | C<error_trace>, | ||
| 416 | C<format>, | ||
| 417 | C<h>, | ||
| 418 | C<help>, | ||
| 419 | C<human>, | ||
| 420 | C<local>, | ||
| 421 | C<master_timeout>, | ||
| 422 | C<s>, | ||
| 423 | C<v> | ||
| 424 | |||
| 425 | See the L<cat shards docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-shards.html> | ||
| 426 | for more information. | ||
| 427 | |||
| 428 | =head2 C<snapshots()> | ||
| 429 | |||
| 430 | say $e->cat->snapshots( | ||
| 431 | repository => 'repository' | \@repositories # optional | ||
| 432 | ) | ||
| 433 | |||
| 434 | Provides a list of all snapshots that belong to the specified repositories. | ||
| 435 | |||
| 436 | Query string parameters: | ||
| 437 | C<error_trace>, | ||
| 438 | C<format>, | ||
| 439 | C<h>, | ||
| 440 | C<help>, | ||
| 441 | C<human>, | ||
| 442 | C<ignore_unavailable>, | ||
| 443 | C<master_timeout>, | ||
| 444 | C<s>, | ||
| 445 | C<v> | ||
| 446 | |||
| 447 | See the L<cat snapshots docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-snapshots.html> | ||
| 448 | for more information. | ||
| 449 | |||
| 450 | =head2 C<tasks()> | ||
| 451 | |||
| 452 | say $e->cat->tasks() | ||
| 453 | |||
| 454 | Provides a list of node-level tasks. | ||
| 455 | |||
| 456 | Query string parameters: | ||
| 457 | C<actions>, | ||
| 458 | C<detailed>, | ||
| 459 | C<error_trace>, | ||
| 460 | C<format>, | ||
| 461 | C<h>, | ||
| 462 | C<help>, | ||
| 463 | C<human>, | ||
| 464 | C<node_id>, | ||
| 465 | C<parent_node>, | ||
| 466 | C<parent_task>, | ||
| 467 | C<s>, | ||
| 468 | C<v> | ||
| 469 | |||
| 470 | See the L<cat tasks docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html> | ||
| 471 | for more information. | ||
| 472 | |||
| 473 | =head2 C<templates()> | ||
| 474 | |||
| 475 | say $e->cat->templates( | ||
| 476 | name => $name # optional | ||
| 477 | ) | ||
| 478 | |||
| 479 | Provides a list of index templates. | ||
| 480 | |||
| 481 | Query string parameters: | ||
| 482 | C<error_trace>, | ||
| 483 | C<format>, | ||
| 484 | C<h>, | ||
| 485 | C<help>, | ||
| 486 | C<human>, | ||
| 487 | C<local>, | ||
| 488 | C<master_timeout>, | ||
| 489 | C<s>, | ||
| 490 | C<v> | ||
| 491 | |||
| 492 | See the L<cat templates docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/templates.html> | ||
| 493 | for more information. | ||
| 494 | |||
| 495 | =head2 C<thread_pool()> | ||
| 496 | |||
| 497 | say $e->cat->thread_pool( | ||
| 498 | index => 'index' | \@indices # optional | ||
| 499 | ); | ||
| 500 | |||
| 501 | Shows cluster wide thread pool statistics per node. By default the C<active>, | ||
| 502 | C<queue> and C<rejected> statistics are returned for the C<bulk>, C<index> and | ||
| 503 | C<search> thread pools. | ||
| 504 | |||
| 505 | Query string parameters: | ||
| 506 | C<error_trace>, | ||
| 507 | C<format>, | ||
| 508 | C<h>, | ||
| 509 | C<help>, | ||
| 510 | C<human>, | ||
| 511 | C<local>, | ||
| 512 | C<master_timeout>, | ||
| 513 | C<size>, | ||
| 514 | C<s>, | ||
| 515 | C<v> | ||
| 516 | |||
| 517 | See the L<cat thread_pool docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-thread-pool.html> | ||
| 518 | for more information. | ||
| 519 | |||
| 520 | =head1 AUTHOR | ||
| 521 | |||
| 522 | Enrico Zimuel <enrico.zimuel@elastic.co> | ||
| 523 | |||
| 524 | =head1 COPYRIGHT AND LICENSE | ||
| 525 | |||
| 526 | This software is Copyright (c) 2024 by Elasticsearch BV. | ||
| 527 | |||
| 528 | This is free software, licensed under: | ||
| 529 | |||
| 530 | The Apache License, Version 2.0, January 2004 | ||
| 531 | |||
| 532 | =cut | ||
| 533 | |||
| 534 | __END__ |