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