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