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