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