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