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