| 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::7_0::Direct::Indices; | ||
| 6 | $Search::Elasticsearch::Client::7_0::Direct::Indices::VERSION = '7.30_1'; # TRIAL | ||
| 7 | |||
| 8 | $Search::Elasticsearch::Client::7_0::Direct::Indices::VERSION = '7.301'; | ||
| 9 | use Moo; | ||
| 10 | with 'Search::Elasticsearch::Client::7_0::Role::API'; | ||
| 11 | with 'Search::Elasticsearch::Role::Client::Direct'; | ||
| 12 | __PACKAGE__->_install_api('indices'); | ||
| 13 | |||
| 14 | 1; | ||
| 15 | |||
| 16 | =pod | ||
| 17 | |||
| 18 | =encoding UTF-8 | ||
| 19 | |||
| 20 | =head1 NAME | ||
| 21 | |||
| 22 | Search::Elasticsearch::Client::7_0::Direct::Indices - A client for running index-level requests | ||
| 23 | |||
| 24 | =head1 VERSION | ||
| 25 | |||
| 26 | version 7.30_1 | ||
| 27 | |||
| 28 | =head1 DESCRIPTION | ||
| 29 | |||
| 30 | This module provides methods to make index-level requests, such as | ||
| 31 | creating and deleting indices, managing type mappings, index settings, | ||
| 32 | index templates and aliases. | ||
| 33 | |||
| 34 | It does L<Search::Elasticsearch::Role::Client::Direct>. | ||
| 35 | |||
| 36 | =head1 INDEX METHODS | ||
| 37 | |||
| 38 | =head2 C<create()> | ||
| 39 | |||
| 40 | $result = $e->indices->create( | ||
| 41 | index => 'my_index' # required | ||
| 42 | |||
| 43 | body => { # optional | ||
| 44 | index settings | ||
| 45 | mappings | ||
| 46 | aliases | ||
| 47 | } | ||
| 48 | ); | ||
| 49 | |||
| 50 | The C<create()> method is used to create an index. Optionally, index | ||
| 51 | settings, type mappings, and aliases can be added at the same time. | ||
| 52 | |||
| 53 | Query string parameters: | ||
| 54 | C<error_trace>, | ||
| 55 | C<human>, | ||
| 56 | C<include_type_name>, | ||
| 57 | C<master_timeout>, | ||
| 58 | C<timeout>, | ||
| 59 | C<update_all_types>, | ||
| 60 | C<wait_for_active_shards> | ||
| 61 | |||
| 62 | See the L<create index docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html> | ||
| 63 | for more information. | ||
| 64 | |||
| 65 | =head2 C<get()> | ||
| 66 | |||
| 67 | $response = $e->indices->get( | ||
| 68 | index => 'index' | \@indices # required | ||
| 69 | ); | ||
| 70 | |||
| 71 | Returns the aliases, settings, and mappings for the specified indices. | ||
| 72 | |||
| 73 | See the L<get index docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-index.html>. | ||
| 74 | |||
| 75 | Query string parameters: | ||
| 76 | C<allow_no_indices>, | ||
| 77 | C<error_trace>, | ||
| 78 | C<expand_wildcards>, | ||
| 79 | C<flat_settings>, | ||
| 80 | C<human>, | ||
| 81 | C<ignore_unavailable>, | ||
| 82 | C<include_defaults>, | ||
| 83 | C<include_type_name>, | ||
| 84 | C<local>, | ||
| 85 | C<master_timeout> | ||
| 86 | |||
| 87 | =head2 C<exists()> | ||
| 88 | |||
| 89 | $bool = $e->indices->exists( | ||
| 90 | index => 'index' | \@indices # required | ||
| 91 | ); | ||
| 92 | |||
| 93 | The C<exists()> method returns C<1> or the empty string to indicate | ||
| 94 | whether the specified index or indices exist. | ||
| 95 | |||
| 96 | Query string parameters: | ||
| 97 | C<allow_no_indices>, | ||
| 98 | C<error_trace>, | ||
| 99 | C<expand_wildcards>, | ||
| 100 | C<flat_settings>, | ||
| 101 | C<human>, | ||
| 102 | C<ignore_unavailable>, | ||
| 103 | C<include_defaults>, | ||
| 104 | C<local> | ||
| 105 | |||
| 106 | See the L<index exists docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-indices-exists.html> | ||
| 107 | for more information. | ||
| 108 | |||
| 109 | =head2 C<delete()> | ||
| 110 | |||
| 111 | $response = $e->indices->delete( | ||
| 112 | index => 'index' | \@indices # required | ||
| 113 | ); | ||
| 114 | |||
| 115 | The C<delete()> method deletes the specified indices. | ||
| 116 | |||
| 117 | Query string parameters: | ||
| 118 | C<allow_no_indices>, | ||
| 119 | C<error_trace>, | ||
| 120 | C<expand_wildcards>, | ||
| 121 | C<human>, | ||
| 122 | C<ignore_unavailable>, | ||
| 123 | C<master_timeout>, | ||
| 124 | C<timeout> | ||
| 125 | |||
| 126 | See the L<delete index docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html> | ||
| 127 | for more information. | ||
| 128 | |||
| 129 | =head2 C<close()> | ||
| 130 | |||
| 131 | $response = $e->indices->close( | ||
| 132 | index => 'index' | \@indices # required | ||
| 133 | ); | ||
| 134 | |||
| 135 | The C<close()> method closes the specified indices, reducing resource usage | ||
| 136 | but allowing them to be reopened later. | ||
| 137 | |||
| 138 | Query string parameters: | ||
| 139 | C<allow_no_indices>, | ||
| 140 | C<error_trace>, | ||
| 141 | C<expand_wildcards>, | ||
| 142 | C<human>, | ||
| 143 | C<ignore_unavailable> | ||
| 144 | C<master_timeout>, | ||
| 145 | C<timeout> | ||
| 146 | |||
| 147 | See the L<close index docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html> | ||
| 148 | for more information. | ||
| 149 | |||
| 150 | =head2 C<open()> | ||
| 151 | |||
| 152 | $response = $e->indices->open( | ||
| 153 | index => 'index' | \@indices # required | ||
| 154 | ); | ||
| 155 | |||
| 156 | The C<open()> method opens closed indices. | ||
| 157 | |||
| 158 | Query string parameters: | ||
| 159 | C<allow_no_indices>, | ||
| 160 | C<error_trace>, | ||
| 161 | C<expand_wildcards>, | ||
| 162 | C<human>, | ||
| 163 | C<ignore_unavailable> | ||
| 164 | C<master_timeout>, | ||
| 165 | C<timeout>, | ||
| 166 | C<wait_for_active_shards> | ||
| 167 | |||
| 168 | See the L<open index docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html> | ||
| 169 | for more information. | ||
| 170 | |||
| 171 | =head2 C<rollover()> | ||
| 172 | |||
| 173 | $response = $e->indices->rollover( | ||
| 174 | alias => $alias, # required | ||
| 175 | new_index => $index, # optional | ||
| 176 | body => { rollover conditions } # optional | ||
| 177 | ); | ||
| 178 | |||
| 179 | Rollover an index pointed to by C<alias> if it meets rollover conditions | ||
| 180 | (eg max age, max docs) to a new index name. | ||
| 181 | |||
| 182 | Query string parameters: | ||
| 183 | C<dry_run>, | ||
| 184 | C<error_trace>, | ||
| 185 | C<human>, | ||
| 186 | C<include_type_name>, | ||
| 187 | C<master_timeout>, | ||
| 188 | C<timeout>, | ||
| 189 | C<wait_for_active_shards> | ||
| 190 | |||
| 191 | See the L<rollover index docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-rollover-index.html> | ||
| 192 | for more information. | ||
| 193 | |||
| 194 | =head2 C<shrink()> | ||
| 195 | |||
| 196 | $response = $e->shrink( | ||
| 197 | index => $index, # required | ||
| 198 | target => $target, # required | ||
| 199 | body => { mappings, settings aliases } # optional | ||
| 200 | ); | ||
| 201 | |||
| 202 | The shrink API shrinks the shards of an index down to a single shard (or to a factor | ||
| 203 | of the original shards). | ||
| 204 | |||
| 205 | Query string parameters: | ||
| 206 | C<copy_settings>, | ||
| 207 | C<error_trace>, | ||
| 208 | C<filter_path>, | ||
| 209 | C<human>, | ||
| 210 | C<master_timeout>, | ||
| 211 | C<timeout>, | ||
| 212 | C<wait_for_active_shards> | ||
| 213 | |||
| 214 | See the L<shrink index docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shrink-index.html> | ||
| 215 | for more information. | ||
| 216 | |||
| 217 | =head2 C<split()> | ||
| 218 | |||
| 219 | $response = $e->split( | ||
| 220 | index => $index, # required | ||
| 221 | target => $target, # required | ||
| 222 | ); | ||
| 223 | |||
| 224 | The split API splits a shard into multiple shards. | ||
| 225 | |||
| 226 | Query string parameters: | ||
| 227 | C<copy_settings>, | ||
| 228 | C<error_trace>, | ||
| 229 | C<filter_path>, | ||
| 230 | C<human>, | ||
| 231 | C<master_timeout>, | ||
| 232 | C<timeout>, | ||
| 233 | C<wait_for_active_shards> | ||
| 234 | |||
| 235 | See the L<split index docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-split-index.html> | ||
| 236 | for more information. | ||
| 237 | |||
| 238 | =head2 C<freeze()> | ||
| 239 | |||
| 240 | $response = $e->indices->freeze( | ||
| 241 | $index => $index # required | ||
| 242 | ); | ||
| 243 | |||
| 244 | The C<freeze()> API is used to freeze an index, which puts it in a state which has almost no | ||
| 245 | overhead on the cluster. | ||
| 246 | |||
| 247 | Query string parameters: | ||
| 248 | C<allow_no_indices>, | ||
| 249 | C<error_trace>, | ||
| 250 | C<expand_wildcards>, | ||
| 251 | C<filter_path>, | ||
| 252 | C<human>, | ||
| 253 | C<ignore_unavailable>, | ||
| 254 | C<master_timeout>, | ||
| 255 | C<timeout>, | ||
| 256 | C<wait_for_active_shards> | ||
| 257 | |||
| 258 | See the L<freeze index docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/freeze-index-api.html> | ||
| 259 | for more information. | ||
| 260 | |||
| 261 | =head2 C<unfreeze()> | ||
| 262 | |||
| 263 | $response = $e->indices->unfreeze( | ||
| 264 | $index => $index # required | ||
| 265 | ); | ||
| 266 | |||
| 267 | The C<unfreeze()> API is used to return a frozen index to its normal state. | ||
| 268 | |||
| 269 | Query string parameters: | ||
| 270 | C<allow_no_indices>, | ||
| 271 | C<error_trace>, | ||
| 272 | C<expand_wildcards>, | ||
| 273 | C<filter_path>, | ||
| 274 | C<human>, | ||
| 275 | C<ignore_unavailable>, | ||
| 276 | C<master_timeout>, | ||
| 277 | C<timeout>, | ||
| 278 | C<wait_for_active_shards> | ||
| 279 | |||
| 280 | See the L<unfreeze index docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/freeze-index-api.html> | ||
| 281 | for more information. | ||
| 282 | |||
| 283 | =head2 C<clear_cache()> | ||
| 284 | |||
| 285 | $response = $e->indices->clear_cache( | ||
| 286 | index => 'index' | \@indices # optional | ||
| 287 | ); | ||
| 288 | |||
| 289 | The C<clear_cache()> method is used to clear the in-memory filter, fielddata, | ||
| 290 | or id cache for the specified indices. | ||
| 291 | |||
| 292 | Query string parameters: | ||
| 293 | C<allow_no_indices>, | ||
| 294 | C<error_trace>, | ||
| 295 | C<expand_wildcards>, | ||
| 296 | C<fielddata>, | ||
| 297 | C<fields>, | ||
| 298 | C<human>, | ||
| 299 | C<ignore_unavailable>, | ||
| 300 | C<query>, | ||
| 301 | C<request> | ||
| 302 | |||
| 303 | See the L<clear_cache docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clearcache.html> | ||
| 304 | for more information. | ||
| 305 | |||
| 306 | =head2 C<refresh()> | ||
| 307 | |||
| 308 | $response = $e->indices->refresh( | ||
| 309 | index => 'index' | \@indices # optional | ||
| 310 | ); | ||
| 311 | |||
| 312 | The C<refresh()> method refreshes the specified indices (or all indices), | ||
| 313 | allowing recent changes to become visible to search. This process normally | ||
| 314 | happens automatically once every second by default. | ||
| 315 | |||
| 316 | Query string parameters: | ||
| 317 | C<allow_no_indices>, | ||
| 318 | C<error_trace>, | ||
| 319 | C<expand_wildcards>, | ||
| 320 | C<human>, | ||
| 321 | C<ignore_unavailable> | ||
| 322 | |||
| 323 | See the L<refresh index docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-refresh.html> | ||
| 324 | for more information. | ||
| 325 | |||
| 326 | =head2 C<flush()> | ||
| 327 | |||
| 328 | $response = $e->indices->flush( | ||
| 329 | index => 'index' | \@indices # optional | ||
| 330 | ); | ||
| 331 | |||
| 332 | The C<flush()> method causes the specified indices (or all indices) to be | ||
| 333 | written to disk with an C<fsync>, and clears out the transaction log. | ||
| 334 | This process normally happens automatically. | ||
| 335 | |||
| 336 | Query string parameters: | ||
| 337 | C<allow_no_indices>, | ||
| 338 | C<error_trace>, | ||
| 339 | C<expand_wildcards>, | ||
| 340 | C<force>, | ||
| 341 | C<human>, | ||
| 342 | C<ignore_unavailable>, | ||
| 343 | C<wait_if_ongoing> | ||
| 344 | |||
| 345 | See the L<flush index docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-flush.html> | ||
| 346 | for more information. | ||
| 347 | |||
| 348 | =head2 C<flush_synced()> | ||
| 349 | |||
| 350 | $respnse = $e->indices->flush_synced( | ||
| 351 | index => 'index' | \@indices # optional | ||
| 352 | ); | ||
| 353 | |||
| 354 | The C<flush_synced()> method does a synchronised L<flush()> on the primaries and replicas of | ||
| 355 | all the specified indices. In other words, after flushing it tries to write a C<sync_id> | ||
| 356 | on the primaries and replicas to mark them as containing the same documents. During | ||
| 357 | recovery, if a replica has the same C<sync_id> as the primary, then it doesn't need to check | ||
| 358 | whether the segment files on primary and replica are the same, and it can move on | ||
| 359 | directly to just replaying the translog. This can greatly speed up recovery. | ||
| 360 | |||
| 361 | Synced flushes happens automatically in the background on indices that have not received any | ||
| 362 | writes for a while, but the L<flush_synced()> method can be used to trigger this process | ||
| 363 | manually, eg before shutting down. Any new commits immediately break the sync. | ||
| 364 | |||
| 365 | See the L<flush synced docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-synced-flush.html> | ||
| 366 | for more information. | ||
| 367 | |||
| 368 | Query string parameters: | ||
| 369 | C<allow_no_indices>, | ||
| 370 | C<error_trace>, | ||
| 371 | C<expand_wildcards>, | ||
| 372 | C<human>, | ||
| 373 | C<ignore_unavailable> | ||
| 374 | |||
| 375 | =head2 C<forcemerge()> | ||
| 376 | |||
| 377 | $response = $e->indices->forcemerge( | ||
| 378 | index => 'index' | \@indices # optional | ||
| 379 | ); | ||
| 380 | |||
| 381 | The C<forcemerge()> method rewrites all the data in an index into at most | ||
| 382 | C<max_num_segments>. This is a very heavy operation and should only be run | ||
| 383 | with care, and only on indices that are no longer being updated. | ||
| 384 | |||
| 385 | Query string parameters: | ||
| 386 | C<allow_no_indices>, | ||
| 387 | C<error_trace>, | ||
| 388 | C<expand_wildcards>, | ||
| 389 | C<flush>, | ||
| 390 | C<human>, | ||
| 391 | C<ignore_unavailable>, | ||
| 392 | C<max_num_segments>, | ||
| 393 | C<only_expunge_deletes> | ||
| 394 | |||
| 395 | See the L<forcemerge docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html> | ||
| 396 | for more information. | ||
| 397 | |||
| 398 | =head2 C<get_upgrade()> | ||
| 399 | |||
| 400 | $response = $e->indices->get_upgrade( | ||
| 401 | index => 'index' | \@indices # optional | ||
| 402 | ); | ||
| 403 | |||
| 404 | The C<get_upgrade()> method returns information about which indices need to be | ||
| 405 | upgraded, which can be done with the C<upgrade()> method. | ||
| 406 | |||
| 407 | Query string parameters: | ||
| 408 | C<allow_no_indices>, | ||
| 409 | C<error_trace>, | ||
| 410 | C<expand_wildcards>, | ||
| 411 | C<human>, | ||
| 412 | C<ignore_unavailable> | ||
| 413 | |||
| 414 | See the L<upgrade docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-upgrade.html> | ||
| 415 | for more information. | ||
| 416 | |||
| 417 | =head2 C<upgrade()> | ||
| 418 | |||
| 419 | $response = $e->indices->upgrade( | ||
| 420 | index => 'index' | \@indices # optional | ||
| 421 | ); | ||
| 422 | |||
| 423 | The C<upgrade()> method upgrades all segments in the specified indices to the latest format. | ||
| 424 | |||
| 425 | Query string parameters: | ||
| 426 | C<allow_no_indices>, | ||
| 427 | C<error_trace>, | ||
| 428 | C<expand_wildcards>, | ||
| 429 | C<human>, | ||
| 430 | C<ignore_unavailable>, | ||
| 431 | C<only_ancient_segments>, | ||
| 432 | C<wait_for_completion> | ||
| 433 | |||
| 434 | See the L<upgrade docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-upgrade.html> | ||
| 435 | for more information. | ||
| 436 | |||
| 437 | =head1 MAPPING METHODS | ||
| 438 | |||
| 439 | =head2 C<put_mapping()> | ||
| 440 | |||
| 441 | $response = $e->indices->put_mapping( | ||
| 442 | index => 'index' | \@indices # optional, | ||
| 443 | type => 'type', # optional | ||
| 444 | |||
| 445 | body => { mapping } # required | ||
| 446 | ) | ||
| 447 | |||
| 448 | The C<put_mapping()> method is used to create or update a type | ||
| 449 | mapping on an existing index. Mapping updates are allowed to add new | ||
| 450 | fields, but not to overwrite or change existing fields. | ||
| 451 | |||
| 452 | For instance: | ||
| 453 | |||
| 454 | $response = $e->indices->put_mapping( | ||
| 455 | index => 'users', | ||
| 456 | type => 'user', | ||
| 457 | body => { | ||
| 458 | user => { | ||
| 459 | properties => { | ||
| 460 | name => { type => 'string' }, | ||
| 461 | age => { type => 'integer' } | ||
| 462 | } | ||
| 463 | } | ||
| 464 | } | ||
| 465 | ); | ||
| 466 | |||
| 467 | Query string parameters: | ||
| 468 | C<allow_no_indices>, | ||
| 469 | C<error_trace>, | ||
| 470 | C<expand_wildcards>, | ||
| 471 | C<human>, | ||
| 472 | C<ignore_unavailable>, | ||
| 473 | C<include_type_name>, | ||
| 474 | C<master_timeout>, | ||
| 475 | C<timeout>, | ||
| 476 | C<update_all_types> | ||
| 477 | |||
| 478 | See the L<put_mapping docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html> | ||
| 479 | for more information. | ||
| 480 | |||
| 481 | =head2 C<get_mapping()> | ||
| 482 | |||
| 483 | $result = $e->indices->get_mapping( | ||
| 484 | index => 'index' | \@indices # optional, | ||
| 485 | type => 'type' | \@types # optional | ||
| 486 | ); | ||
| 487 | |||
| 488 | The C<get_mapping()> method returns the type definitions for one, more or | ||
| 489 | all types in one, more or all indices. | ||
| 490 | |||
| 491 | Query string parameters: | ||
| 492 | C<allow_no_indices>, | ||
| 493 | C<error_trace>, | ||
| 494 | C<expand_wildcards>, | ||
| 495 | C<human>, | ||
| 496 | C<ignore_unavailable>, | ||
| 497 | C<include_type_name>, | ||
| 498 | C<local>, | ||
| 499 | C<master_timeout> | ||
| 500 | |||
| 501 | See the L<get_mapping docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html> | ||
| 502 | for more information. | ||
| 503 | |||
| 504 | =head2 C<get_field_mapping()> | ||
| 505 | |||
| 506 | $result = $e->indices->get_field_mapping( | ||
| 507 | index => 'index' | \@indices # optional, | ||
| 508 | type => 'type' | \@types # optional, | ||
| 509 | fields => 'field' | \@fields # required | ||
| 510 | |||
| 511 | include_defaults => 0 | 1 | ||
| 512 | ); | ||
| 513 | |||
| 514 | The C<get_field_mapping()> method returns the field definitions for one, more or | ||
| 515 | all fields in one, more or all types and indices. | ||
| 516 | |||
| 517 | Query string parameters: | ||
| 518 | C<allow_no_indices>, | ||
| 519 | C<error_trace>, | ||
| 520 | C<expand_wildcards>, | ||
| 521 | C<human>, | ||
| 522 | C<ignore_unavailable>, | ||
| 523 | C<include_defaults>, | ||
| 524 | C<include_type_name>, | ||
| 525 | C<local> | ||
| 526 | |||
| 527 | See the L<get_mapping docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html> | ||
| 528 | for more information. | ||
| 529 | |||
| 530 | =head2 C<exists_type()> | ||
| 531 | |||
| 532 | $bool = $e->indices->exists_type( | ||
| 533 | index => 'index' | \@indices # required, | ||
| 534 | type => 'type' | \@types # required | ||
| 535 | ); | ||
| 536 | |||
| 537 | The C<exists_type()> method checks for the existence of all specified types | ||
| 538 | in all specified indices, and returns C<1> or the empty string. | ||
| 539 | |||
| 540 | Query string parameters: | ||
| 541 | C<allow_no_indices>, | ||
| 542 | C<error_trace>, | ||
| 543 | C<expand_wildcards>, | ||
| 544 | C<human>, | ||
| 545 | C<ignore_unavailable>, | ||
| 546 | C<local> | ||
| 547 | |||
| 548 | See the L<exists_type docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-types-exists.html> | ||
| 549 | for more information. | ||
| 550 | |||
| 551 | =head1 ALIAS METHODS | ||
| 552 | |||
| 553 | =head2 C<update_aliases()> | ||
| 554 | |||
| 555 | $response = $e->indices->update_aliases( | ||
| 556 | body => { actions } # required | ||
| 557 | ); | ||
| 558 | |||
| 559 | The C<update_aliases()> method changes (by adding or removing) multiple | ||
| 560 | index aliases atomically. For instance: | ||
| 561 | |||
| 562 | $response = $e->indices->update_aliases( | ||
| 563 | body => { | ||
| 564 | actions => [ | ||
| 565 | { add => { alias => 'current', index => 'logs_2013_09' }}, | ||
| 566 | { remove => { alias => 'current', index => 'logs_2013_08' }} | ||
| 567 | ] | ||
| 568 | } | ||
| 569 | ); | ||
| 570 | |||
| 571 | Query string parameters: | ||
| 572 | C<error_trace>, | ||
| 573 | C<human>, | ||
| 574 | C<master_timeout>, | ||
| 575 | C<timeout> | ||
| 576 | |||
| 577 | See the L<update_aliases docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html> | ||
| 578 | for more information. | ||
| 579 | |||
| 580 | =head2 C<put_alias()> | ||
| 581 | |||
| 582 | $response = $e->indices->put_alias( | ||
| 583 | index => 'index' | \@indices, # required | ||
| 584 | name => 'alias', # required | ||
| 585 | |||
| 586 | body => { alias defn } # optional | ||
| 587 | ); | ||
| 588 | |||
| 589 | The C<put_alias()> method creates an index alias. For instance: | ||
| 590 | |||
| 591 | $response = $e->indices->put_alias( | ||
| 592 | index => 'my_index', | ||
| 593 | name => 'twitter', | ||
| 594 | body => { | ||
| 595 | filter => { term => { user_id => 'twitter' }} | ||
| 596 | } | ||
| 597 | ); | ||
| 598 | |||
| 599 | Query string parameters: | ||
| 600 | C<error_trace>, | ||
| 601 | C<human>, | ||
| 602 | C<master_timeout>, | ||
| 603 | C<timeout> | ||
| 604 | |||
| 605 | See the L<put_alias docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html> | ||
| 606 | for more information. | ||
| 607 | |||
| 608 | =head2 C<get_alias()> | ||
| 609 | |||
| 610 | $result = $e->indices->get_alias( | ||
| 611 | index => 'index' | \@indices, # optional | ||
| 612 | name => 'alias' | \@aliases # optional | ||
| 613 | ); | ||
| 614 | |||
| 615 | The C<get_alias()> method returns the alias definitions for the specified | ||
| 616 | aliases in the specified indices. | ||
| 617 | |||
| 618 | Query string parameters: | ||
| 619 | C<allow_no_indices>, | ||
| 620 | C<error_trace>, | ||
| 621 | C<expand_wildcards>, | ||
| 622 | C<human>, | ||
| 623 | C<ignore_unavailable>, | ||
| 624 | C<local> | ||
| 625 | |||
| 626 | See the L<get_alias docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html> | ||
| 627 | for more information. | ||
| 628 | |||
| 629 | =head2 C<exists_alias()> | ||
| 630 | |||
| 631 | $bool = $e->indices->exists_alias( | ||
| 632 | index => 'index' | \@indices, # optional | ||
| 633 | name => 'alias' | \@aliases # required | ||
| 634 | ); | ||
| 635 | |||
| 636 | The C<exists_alias()> method returns C<1> or the empty string depending on | ||
| 637 | whether the specified aliases exist in the specified indices. | ||
| 638 | |||
| 639 | Query string parameters: | ||
| 640 | C<allow_no_indices>, | ||
| 641 | C<error_trace>, | ||
| 642 | C<expand_wildcards>, | ||
| 643 | C<human>, | ||
| 644 | C<ignore_unavailable>, | ||
| 645 | C<local> | ||
| 646 | |||
| 647 | See the L<exists_alias docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html> | ||
| 648 | for more information. | ||
| 649 | |||
| 650 | =head2 C<delete_alias()> | ||
| 651 | |||
| 652 | $response = $e->indices->delete_alias( | ||
| 653 | index => 'index' | \@indices # required, | ||
| 654 | name => 'alias' | \@aliases # required | ||
| 655 | ); | ||
| 656 | |||
| 657 | The C<delete_alias()> method deletes one or more aliases from one or more | ||
| 658 | indices. | ||
| 659 | |||
| 660 | Query string parameters: | ||
| 661 | C<error_trace>, | ||
| 662 | C<human>, | ||
| 663 | C<master_timeout>, | ||
| 664 | C<timeout> | ||
| 665 | |||
| 666 | See the L<delete_alias docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html> | ||
| 667 | for more information. | ||
| 668 | |||
| 669 | =head1 SETTINGS METHODS | ||
| 670 | |||
| 671 | =head2 C<put_settings()> | ||
| 672 | |||
| 673 | $response = $e->indices->put_settings( | ||
| 674 | index => 'index' | \@indices # optional | ||
| 675 | |||
| 676 | body => { settings } | ||
| 677 | ); | ||
| 678 | |||
| 679 | The C<put_settings()> method sets the index settings for the specified | ||
| 680 | indices or all indices. For instance: | ||
| 681 | |||
| 682 | $response = $e->indices->put_settings( | ||
| 683 | body => { | ||
| 684 | "index.refresh_interval" => -1 | ||
| 685 | } | ||
| 686 | ); | ||
| 687 | |||
| 688 | Query string parameters: | ||
| 689 | C<allow_no_indices>, | ||
| 690 | C<error_trace>, | ||
| 691 | C<expand_wildcards>, | ||
| 692 | C<flat_settings>, | ||
| 693 | C<human>, | ||
| 694 | C<ignore_unavailable>, | ||
| 695 | C<master_timeout>, | ||
| 696 | C<preserve_existing>, | ||
| 697 | C<timeout> | ||
| 698 | |||
| 699 | See the L<put_settings docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html> | ||
| 700 | for more information. | ||
| 701 | |||
| 702 | =head2 C<get_settings()> | ||
| 703 | |||
| 704 | $result = $e->indices->get_settings( | ||
| 705 | index => 'index' | \@indices # optional | ||
| 706 | name => 'name' | \@names # optional | ||
| 707 | ); | ||
| 708 | |||
| 709 | The C<get_settings()> method retrieves the index settings for the specified | ||
| 710 | indices or all indices. | ||
| 711 | |||
| 712 | Query string parameters: | ||
| 713 | C<allow_no_indices>, | ||
| 714 | C<error_trace>, | ||
| 715 | C<expand_wildcards>, | ||
| 716 | C<flat_settings>, | ||
| 717 | C<human>, | ||
| 718 | C<ignore_unavailable>, | ||
| 719 | C<include_defaults>, | ||
| 720 | C<local>, | ||
| 721 | C<master_timeout> | ||
| 722 | |||
| 723 | See the L<get_settings docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-settings.html> | ||
| 724 | for more information. | ||
| 725 | |||
| 726 | =head1 TEMPLATE METHODS | ||
| 727 | |||
| 728 | =head2 C<put_template()> | ||
| 729 | |||
| 730 | $response = $e->indices->put_template( | ||
| 731 | name => 'template' # required | ||
| 732 | body => { template defn } # required | ||
| 733 | ); | ||
| 734 | |||
| 735 | The C<put_template()> method is used to create or update index templates. | ||
| 736 | |||
| 737 | Query string parameters: | ||
| 738 | C<create>, | ||
| 739 | C<error_trace>, | ||
| 740 | C<flat_settings>, | ||
| 741 | C<human>, | ||
| 742 | C<include_type_name>, | ||
| 743 | C<master_timeout>, | ||
| 744 | C<order>, | ||
| 745 | C<timeout> | ||
| 746 | |||
| 747 | See the L<put_template docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html> | ||
| 748 | for more information. | ||
| 749 | |||
| 750 | =head2 C<get_template()> | ||
| 751 | |||
| 752 | $result = $e->indices->get_template( | ||
| 753 | name => 'template' | \@templates # optional | ||
| 754 | ); | ||
| 755 | |||
| 756 | The C<get_template()> method is used to retrieve a named template. | ||
| 757 | |||
| 758 | Query string parameters: | ||
| 759 | C<error_trace>, | ||
| 760 | C<flat_settings>, | ||
| 761 | C<human>, | ||
| 762 | C<include_type_name>, | ||
| 763 | C<local>, | ||
| 764 | C<master_timeout> | ||
| 765 | |||
| 766 | See the L<get_template docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html> | ||
| 767 | for more information. | ||
| 768 | |||
| 769 | =head2 C<exists_template()> | ||
| 770 | |||
| 771 | $result = $e->indices->exists_template( | ||
| 772 | name => 'template' # optional | ||
| 773 | ); | ||
| 774 | |||
| 775 | The C<exists_template()> method is used to check whether the named template exists. | ||
| 776 | |||
| 777 | Query string parameters: | ||
| 778 | C<error_trace>, | ||
| 779 | C<flat_settings>, | ||
| 780 | C<human>, | ||
| 781 | C<local>, | ||
| 782 | C<master_timeout> | ||
| 783 | |||
| 784 | See the L<get_template docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html> | ||
| 785 | for more information. | ||
| 786 | |||
| 787 | =head2 C<delete_template()> | ||
| 788 | |||
| 789 | $response = $e->indices->delete_template( | ||
| 790 | name => 'template' # required | ||
| 791 | ); | ||
| 792 | |||
| 793 | The C<delete_template()> method is used to delete a named template. | ||
| 794 | |||
| 795 | Query string parameters: | ||
| 796 | C<error_trace>, | ||
| 797 | C<human>, | ||
| 798 | C<master_timeout>, | ||
| 799 | C<timeout>, | ||
| 800 | C<version>, | ||
| 801 | C<version_type> | ||
| 802 | |||
| 803 | See the L<delete_template docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html> | ||
| 804 | for more information. | ||
| 805 | |||
| 806 | =head1 STATS METHODS | ||
| 807 | |||
| 808 | =head2 C<stats()> | ||
| 809 | |||
| 810 | $result = $e->indices->stats( | ||
| 811 | index => 'index' | \@indices # optional | ||
| 812 | metric => 'metric' | \@metrics # optional | ||
| 813 | ); | ||
| 814 | |||
| 815 | The C<stats()> method returns statistical information about one, more or all | ||
| 816 | indices. By default it returns all metrics, but you can limit which metrics | ||
| 817 | are returned by specifying the C<metric>. | ||
| 818 | |||
| 819 | Allowed metrics are: | ||
| 820 | C<_all>, | ||
| 821 | C<completion> | ||
| 822 | C<docs>, | ||
| 823 | C<fielddata>, | ||
| 824 | C<filter_cache>, | ||
| 825 | C<flush>, | ||
| 826 | C<get>, | ||
| 827 | C<id_cache>, | ||
| 828 | C<indexing>, | ||
| 829 | C<merge>, | ||
| 830 | C<percolate>, | ||
| 831 | C<query_cache>, | ||
| 832 | C<refresh>, | ||
| 833 | C<request_cache>, | ||
| 834 | C<search>, | ||
| 835 | C<segments>, | ||
| 836 | C<store> | ||
| 837 | |||
| 838 | Query string parameters: | ||
| 839 | C<completion_fields>, | ||
| 840 | C<error_trace>, | ||
| 841 | C<fielddata_fields>, | ||
| 842 | C<fields>, | ||
| 843 | C<groups>, | ||
| 844 | C<human>, | ||
| 845 | C<include_segment_file_sizes>, | ||
| 846 | C<level>, | ||
| 847 | C<types> | ||
| 848 | |||
| 849 | See the L<stats docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html> | ||
| 850 | for more information. | ||
| 851 | |||
| 852 | =head2 C<recovery()> | ||
| 853 | |||
| 854 | $result = $e->indices->recovery( | ||
| 855 | index => 'index' | \@indices # optional | ||
| 856 | ); | ||
| 857 | |||
| 858 | Provides insight into on-going shard recoveries. | ||
| 859 | |||
| 860 | Query string parameters: | ||
| 861 | C<active_only>, | ||
| 862 | C<detailed>, | ||
| 863 | C<error_trace>, | ||
| 864 | C<human> | ||
| 865 | |||
| 866 | See the L<recovery docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-recovery.html> | ||
| 867 | for more information. | ||
| 868 | |||
| 869 | =head2 C<segments()> | ||
| 870 | |||
| 871 | $result = $e->indices->segments( | ||
| 872 | index => 'index' | \@indices # optional | ||
| 873 | ); | ||
| 874 | |||
| 875 | The C<segments()> method is used to return information about the segments | ||
| 876 | that an index contains. | ||
| 877 | |||
| 878 | Query string parameters: | ||
| 879 | C<allow_no_indices>, | ||
| 880 | C<error_trace>, | ||
| 881 | C<expand_wildcards>, | ||
| 882 | C<human>, | ||
| 883 | C<ignore_unavailable>, | ||
| 884 | C<verbose> | ||
| 885 | |||
| 886 | See the L<segments docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-segments.html> | ||
| 887 | for more information. | ||
| 888 | |||
| 889 | =head2 C<shard_stores()> | ||
| 890 | |||
| 891 | $result = $e->indices->shard_stores( | ||
| 892 | index => 'index' | \@indices # optional | ||
| 893 | ); | ||
| 894 | |||
| 895 | The C<shard_stores()> method is used to find out which nodes contain | ||
| 896 | copies of which shards, whether the shards are allocated or not. | ||
| 897 | |||
| 898 | Query string parameters: | ||
| 899 | C<allow_no_indices>, | ||
| 900 | C<error_trace>, | ||
| 901 | C<expand_wildcards>, | ||
| 902 | C<human>, | ||
| 903 | C<ignore_unavailable>, | ||
| 904 | C<status> | ||
| 905 | |||
| 906 | See the L<shard_stores docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shards-stores.html> | ||
| 907 | for more information. | ||
| 908 | |||
| 909 | =head1 QUERY AND ANALYSIS METHODS | ||
| 910 | |||
| 911 | =head2 C<analyze()> | ||
| 912 | |||
| 913 | $result = $e->indices->analyze( | ||
| 914 | index => 'index' # optional, | ||
| 915 | body => 'text to analyze' | ||
| 916 | ); | ||
| 917 | |||
| 918 | The C<analyze()> method passes the text in the C<body> through the specified | ||
| 919 | C<analyzer>, C<tokenizer> or token C<filter> - which may be global, or associated | ||
| 920 | with a particular index or field - and returns the tokens. Very useful | ||
| 921 | for debugging analyzer configurations. | ||
| 922 | |||
| 923 | Query string parameters: | ||
| 924 | C<error_trace>, | ||
| 925 | C<human> | ||
| 926 | |||
| 927 | See the L<analyze docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html> | ||
| 928 | for more information. | ||
| 929 | |||
| 930 | =head2 C<validate_query()> | ||
| 931 | |||
| 932 | $result = $e->indices->validate_query( | ||
| 933 | index => 'index' | \@indices, # optional | ||
| 934 | type => 'type' | \@types, # optional | ||
| 935 | |||
| 936 | body => { query } | ||
| 937 | ); | ||
| 938 | |||
| 939 | The C<validate_query()> method accepts a query in the C<body> and checks | ||
| 940 | whether the query is valid or not. Most useful when C<explain> is set | ||
| 941 | to C<true>, in which case it includes an execution plan in the output. | ||
| 942 | |||
| 943 | Query string parameters: | ||
| 944 | C<all_shards>, | ||
| 945 | C<allow_no_indices>, | ||
| 946 | C<analyze_wildcard>, | ||
| 947 | C<analyzer>, | ||
| 948 | C<default_operator>, | ||
| 949 | C<df>, | ||
| 950 | C<error_trace>, | ||
| 951 | C<explain>, | ||
| 952 | C<expand_wildcards>, | ||
| 953 | C<ignore_unavailable>, | ||
| 954 | C<lenient>, | ||
| 955 | C<q>, | ||
| 956 | C<rewrite> | ||
| 957 | |||
| 958 | See the L<validate_query docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-validate.html> | ||
| 959 | for more information. | ||
| 960 | |||
| 961 | =head1 AUTHOR | ||
| 962 | |||
| 963 | Enrico Zimuel <enrico.zimuel@elastic.co> | ||
| 964 | |||
| 965 | =head1 COPYRIGHT AND LICENSE | ||
| 966 | |||
| 967 | This software is Copyright (c) 2020 by Elasticsearch BV. | ||
| 968 | |||
| 969 | This is free software, licensed under: | ||
| 970 | |||
| 971 | The Apache License, Version 2.0, January 2004 | ||
| 972 | |||
| 973 | =cut | ||
| 974 | |||
| 975 | __END__ |