7_0/Direct.pm untested

filter: Statementstmt 0.0% 0 / 95 Branchbran n/a Conditioncond 0.0% 0 / 10 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 40 Podpod 0.0% 0 / 37 totaltotal 0.0% 0 / 182 CC 1 SCAR 6.9
CC
1
Cov
0%
_namespace
2.0
_build__bulk_class
2.0
_build__scroll_class
2.0
CRAP 2.0
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::7_0::Direct;
6 $Search::Elasticsearch::Client::7_0::Direct::VERSION = '7.712';
7 use Moo;
8 with 'Search::Elasticsearch::Client::7_0::Role::API';
9 with 'Search::Elasticsearch::Role::Client::Direct';
10  
11 use Search::Elasticsearch::Util qw(parse_params is_compat);
12 use namespace::clean;
13  
14 sub _namespace {__PACKAGE__}
15  
16 has 'async_search' => ( is => 'lazy', init_arg => undef );
17 has 'autoscaling' => ( is => 'lazy', init_arg => undef );
18 has 'cat' => ( is => 'lazy', init_arg => undef );
19 has 'ccr' => ( is => 'lazy', init_arg => undef );
20 has 'cluster' => ( is => 'lazy', init_arg => undef );
21 has 'dangling_indices' => ( is => 'lazy', init_arg => undef );
22 has 'data_frame_transform_deprecated' => ( is => 'lazy', init_arg => undef );
23 has 'enrich' => ( is => 'lazy', init_arg => undef );
24 has 'eql' => ( is => 'lazy', init_arg => undef );
25 has 'features' => ( is => 'lazy', init_arg => undef );
26 has 'graph' => ( is => 'lazy', init_arg => undef );
27 has 'ilm' => ( is => 'lazy', init_arg => undef );
28 has 'indices' => ( is => 'lazy', init_arg => undef );
29 has 'ingest' => ( is => 'lazy', init_arg => undef );
30 has 'license' => ( is => 'lazy', init_arg => undef );
31 has 'logstash' => ( is => 'lazy', init_arg => undef );
32 has 'migration' => ( is => 'lazy', init_arg => undef );
33 has 'ml' => ( is => 'lazy', init_arg => undef );
34 has 'monitoring' => ( is => 'lazy', init_arg => undef );
35 has 'nodes' => ( is => 'lazy', init_arg => undef );
36 has 'rollup' => ( is => 'lazy', init_arg => undef );
37 has 'searchable_snapshots' => ( is => 'lazy', init_arg => undef );
38 has 'security' => ( is => 'lazy', init_arg => undef );
39 has 'snapshot' => ( is => 'lazy', init_arg => undef );
40 has 'slm' => ( is => 'lazy', init_arg => undef );
41 has 'sql' => ( is => 'lazy', init_arg => undef );
42 has 'ssl' => ( is => 'lazy', init_arg => undef );
43 has 'tasks' => ( is => 'lazy', init_arg => undef );
44 has 'text_structure' => ( is => 'lazy', init_arg => undef );
45 has 'transform' => ( is => 'lazy', init_arg => undef );
46 has 'watcher' => ( is => 'lazy', init_arg => undef );
47 has 'xpack' => ( is => 'lazy', init_arg => undef );
48 has 'bulk_helper_class' => ( is => 'rw' );
49 has 'scroll_helper_class' => ( is => 'rw' );
50 has '_bulk_class' => ( is => 'lazy' );
51 has '_scroll_class' => ( is => 'lazy' );
52  
53 #===================================
54 sub _build__bulk_class {
55 #===================================
56 my $self = shift;
57 my $bulk_class = $self->bulk_helper_class
58 || 'Client::' . $self->api_version . '::Bulk';
59 $self->_build_helper( 'bulk', $bulk_class );
60 }
61  
62 #===================================
63 sub _build__scroll_class {
64 #===================================
65 my $self = shift;
66 my $scroll_class = $self->scroll_helper_class
67 || 'Client::' . $self->api_version . '::Scroll';
68 $self->_build_helper( 'scroll', $scroll_class );
69 }
70  
71 #===================================
72 sub bulk_helper {
73 #===================================
74 my ( $self, $params ) = parse_params(@_);
75 $params->{es} ||= $self;
76 $self->_bulk_class->new($params);
77 }
78  
79 #===================================
80 sub scroll_helper {
81 #===================================
82 my ( $self, $params ) = parse_params(@_);
83 $params->{es} ||= $self;
84 $self->_scroll_class->new($params);
85 }
86  
87 #===================================
88 sub _build_autoscaling { shift->_build_namespace('Autoscaling') }
89 sub _build_async_search { shift->_build_namespace('AsyncSearch') }
90 sub _build_cat { shift->_build_namespace('Cat') }
91 sub _build_ccr { shift->_build_namespace('CCR') }
92 sub _build_cluster { shift->_build_namespace('Cluster') }
93 sub _build_dangling_indices { shift->_build_namespace('DanglingIndices') }
94 sub _build_data_frame_transform_deprecated { shift->_build_namespace('DataFrameTransformDeprecated') }
95 sub _build_enrich { shift->_build_namespace('Enrich') }
96 sub _build_eql { shift->_build_namespace('Eql') }
97 sub _build_features { shift->_build_namespace('Features') }
98 sub _build_graph { shift->_build_namespace('Graph') }
99 sub _build_ilm { shift->_build_namespace('ILM') }
100 sub _build_indices { shift->_build_namespace('Indices') }
101 sub _build_ingest { shift->_build_namespace('Ingest') }
102 sub _build_license { shift->_build_namespace('License') }
103 sub _build_logstash { shift->_build_namespace('Logstash') }
104 sub _build_migration { shift->_build_namespace('Migration') }
105 sub _build_ml { shift->_build_namespace('ML') }
106 sub _build_monitoring { shift->_build_namespace('Monitoring') }
107 sub _build_nodes { shift->_build_namespace('Nodes') }
108 sub _build_rollup { shift->_build_namespace('Rollup') }
109 sub _build_searchable_snapshots { shift->_build_namespace('SearchableSnapshots') }
110 sub _build_security { shift->_build_namespace('Security') }
111 sub _build_snapshot { shift->_build_namespace('Snapshot') }
112 sub _build_slm { shift->_build_namespace('Slm') }
113 sub _build_sql { shift->_build_namespace('SQL') }
114 sub _build_ssl { shift->_build_namespace('SSL') }
115 sub _build_tasks { shift->_build_namespace('Tasks') }
116 sub _build_text_structure { shift->_build_namespace('TextStructure') }
117 sub _build_transform { shift->_build_namespace('Transform') }
118 sub _build_watcher { shift->_build_namespace('Watcher') }
119 sub _build_xpack { shift->_build_namespace('XPack') }
120 #===================================
121  
122 __PACKAGE__->_install_api('');
123  
124 1;
125  
126 =pod
127  
128 =encoding UTF-8
129  
130 =head1 NAME
131  
132 Search::Elasticsearch::Client::7_0::Direct - Thin client with full support for Elasticsearch 7.x APIs
133  
134 =head1 VERSION
135  
136 version 7.712
137  
138 =head1 SYNOPSIS
139  
140 Create a client:
141  
142 use Search::Elasticsearch;
143 my $e = Search::Elasticsearch->new(
144 client => '7_0::Direct'
145 );
146  
147 Index a doc:
148  
149 $e->index(
150 index => 'my_index',
151 type => 'blog_post',
152 id => 123,
153 body => {
154 title => "Elasticsearch clients",
155 content => "Interesting content...",
156 date => "2013-09-23"
157 }
158 );
159  
160 Get a doc:
161  
162 $e->get(
163 index => 'my_index',
164 type => 'my_type',
165 id => 123
166 );
167  
168 Search for docs:
169  
170 $results = $e->search(
171 index => 'my_index',
172 body => {
173 query => {
174 match => {
175 title => "elasticsearch"
176 }
177 }
178 }
179 );
180  
181 Index-level requests:
182  
183 $e->indices->create( index => 'my_index' );
184 $e->indices->delete( index => 'my_index' )
185  
186 Ingest pipeline requests:
187  
188 $e->ingest->get_pipeline( id => 'apache-logs' );
189  
190 Cluster-level requests:
191  
192 $health = $e->cluster->health;
193  
194 Node-level requests:
195  
196 $info = $e->nodes->info;
197 $stats = $e->nodes->stats;
198  
199 Snapshot and restore:
200  
201 $e->snapshot->create_repository(
202 repository => 'my_backups',
203 type => 'fs',
204 settings => {
205 location => '/mnt/backups'
206 }
207 );
208  
209 $e->snapshot->create(
210 repository => 'my_backups',
211 snapshot => 'backup_2014'
212 );
213  
214 Task management:
215  
216 $e->tasks->list;
217  
218 `cat` debugging:
219  
220 say $e->cat->allocation;
221 say $e->cat->health;
222  
223 Cross-cluster replication requests:
224  
225 say $e->ccr->follow;
226  
227 Index lifecycle management requests:
228  
229 say $e->ilm->put_lifecycle;
230  
231 =head1 DESCRIPTION
232  
233 The L<Search::Elasticsearch::Client::7_0::Direct> class provides the
234 Elasticsearch 7.x compatible client returned by:
235  
236 $e = Search::Elasticsearch->new(
237 client => "7_0::Direct" # default
238 );
239  
240 It is intended to be as close as possible to the native REST API that
241 Elasticsearch uses, so that it is easy to translate the
242 L<Elasticsearch reference documentation|http://www.elasticsearch/guide>
243 for an API to the equivalent in this client.
244  
245 This class provides the methods for L<document CRUD|/DOCUMENT CRUD METHODS>,
246 L<bulk document CRUD|/BULK DOCUMENT CRUD METHODS> and L<search|/SEARCH METHODS>.
247 It also provides access to clients for managing L<indices|/indices()>
248 and the L<cluster|/cluster()>.
249  
250 =head1 PREVIOUS VERSIONS OF ELASTICSEARCH
251  
252 This version of the client supports the Elasticsearch 7.0 branch,
253 which is not backwards compatible with earlier branches.
254  
255 If you need to talk to a version of Elasticsearch before 7.0.0, please
256 install one of the following modules:
257  
258 =over
259  
260 =item *
261  
262 L<Search::Elasticsearch::Client::6_0>
263  
264 =item *
265  
266 L<Search::Elasticsearch::Client::5_0>
267  
268 =item *
269  
270 L<Search::Elasticsearch::Client::2_0>
271  
272 =item *
273  
274 L<Search::Elasticsearch::Client::1_0>
275  
276 =item *
277  
278 L<Search::Elasticsearch::Client::0_90>
279  
280 =back
281  
282 =head1 CONVENTIONS
283  
284 =head2 Parameter passing
285  
286 Parameters can be passed to any request method as a list or as a hash
287 reference. The following two statements are equivalent:
288  
289 $e->search( size => 10 );
290 $e->search({size => 10});
291  
292 =head2 Path parameters
293  
294 Any values that should be included in the URL path, eg C</{index}/{type}>
295 should be passed as top level parameters:
296  
297 $e->search( index => 'my_index', type => 'my_type' );
298  
299 Alternatively, you can specify a C<path> parameter directly:
300  
301 $e->search( path => '/my_index/my_type' );
302  
303 =head2 Query-string parameters
304  
305 Any values that should be included in the query string should be passed
306 as top level parameters:
307  
308 $e->search( size => 10 );
309  
310 If you pass in a C<\%params> hash, then it will be included in the
311 query string parameters without any error checking. The following:
312  
313 $e->search( size => 10, params => { from => 6, size => 6 })
314  
315 would result in this query string:
316  
317 ?from=6&size=10
318  
319 =head2 Body parameter
320  
321 The request body should be passed in the C<body> key:
322  
323 $e->search(
324 body => {
325 query => {...}
326 }
327 );
328  
329 The body can also be a UTF8-decoded string, which will be converted into
330 UTF-8 bytes and passed as is:
331  
332 $e->indices->analyze( body => "The quick brown fox");
333  
334 =head2 Boolean parameters
335  
336 Elasticsearch 7.0.0 and above no longer accepts truthy and falsey values for booleans. Instead,
337 it will accept only a JSON C<true> or C<false>, or the string equivalents C<"true"> or C<"false">.
338  
339 In the Perl client, you can use the following values:
340  
341 =over
342  
343 =item * True: C<true>, C<\1>, or a L<JSON::PP::Boolean> object.
344  
345 =item * False: C<false>, C<\0>, or a L<JSON::PP::Boolean> object.
346  
347 =back
348  
349 =head2 Filter path parameter
350  
351 Any API which returns a JSON body accepts a C<filter_path> parameter
352 which will filter the JSON down to only the specified paths. For instance,
353 if you are running a search request and only want the C<total> hits and
354 the C<_source> field for each hit (without the C<_id>, C<_index> etc),
355 you can do:
356  
357 $e->search(
358 query => {...},
359 filter_paths => [ 'hits.total', 'hits.hits._source' ]
360 );
361  
362 =head2 Ignore parameter
363  
364 Normally, any HTTP status code outside the 200-299 range will result in
365 an error being thrown. To suppress these errors, you can specify which
366 status codes to ignore in the C<ignore> parameter.
367  
368 $e->indices->delete(
369 index => 'my_index',
370 ignore => 404
371 );
372  
373 This is most useful for
374 L<Missing|Search::Elasticsearch::Error/Search::Elasticsearch::Error::Missing> errors, which
375 are triggered by a C<404> status code when some requested resource does
376 not exist.
377  
378 Multiple error codes can be specified with an array:
379  
380 $e->indices->delete(
381 index => 'my_index',
382 ignore => [404,409]
383 );
384  
385 =head1 CONFIGURATION
386  
387 =head2 C<bulk_helper_class>
388  
389 The class to use for the L</bulk_helper()> method. Defaults to
390 L<Search::Elasticsearch::Client::7_0::Bulk>.
391  
392 =head2 C<scroll_helper_class>
393  
394 The class to use for the L</scroll_helper()> method. Defaults to
395 L<Search::Elasticsearch::Client::7_0::Scroll>.
396  
397 =head1 GENERAL METHODS
398  
399 =head2 C<info()>
400  
401 $info = $e->info
402  
403 Returns information about the version of Elasticsearch that the responding node
404 is running.
405  
406 =head2 C<ping()>
407  
408 $e->ping
409  
410 Pings a node in the cluster and returns C<1> if it receives a C<200>
411 response, otherwise it throws an error.
412  
413 =head2 C<indices()>
414  
415 $indices_client = $e->indices;
416  
417 Returns a L<Search::Elasticsearch::Client::7_0::Direct::Indices> object which can be used
418 for managing indices, eg creating, deleting indices, managing mapping,
419 index settings etc.
420  
421 =head2 C<ingest()>
422  
423 $ingest_client = $e->ingest;
424  
425 Returns a L<Search::Elasticsearch::Client::7_0::Direct::Ingest> object which can be used
426 for managing ingest pipelines.
427  
428 =head2 C<cluster()>
429  
430 $cluster_client = $e->cluster;
431  
432 Returns a L<Search::Elasticsearch::Client::7_0::Direct::Cluster> object which can be used
433 for managing the cluster, eg cluster-wide settings and cluster health.
434  
435 =head2 C<nodes()>
436  
437 $node_client = $e->nodes;
438  
439 Returns a L<Search::Elasticsearch::Client::7_0::Direct::Nodes> object which can be used
440 to retrieve node info and stats.
441  
442 =head2 C<snapshot()>
443  
444 $snapshot_client = $e->snapshot;
445  
446 Returns a L<Search::Elasticsearch::Client::7_0::Direct::Snapshot> object which
447 is used for managing backup repositories and creating and restoring
448 snapshots.
449  
450 =head2 C<tasks()>
451  
452 $tasks_client = $e->tasks;
453  
454 Returns a L<Search::Elasticsearch::Client::7_0::Direct::Tasks> object which
455 is used for accessing the task management API.
456  
457 =head2 C<cat()>
458  
459 $cat_client = $e->cat;
460  
461 Returns a L<Search::Elasticsearch::Client::7_0::Direct::Cat> object which can be used
462 to retrieve simple to read text info for debugging and monitoring an
463 Elasticsearch cluster.
464  
465 =head2 C<ccr()>
466  
467 $ccr_client = $e->ccr;
468  
469 Returns a L<Search::Elasticsearch::Client::7_0::Direct::CCR> object which can be used
470 to handle cross-cluster replication requests.
471  
472 =head2 C<ilm()>
473  
474 $ilm_client = $e->ilm;
475  
476 Returns a L<Search::Elasticsearch::Client::7_0::Direct::ILM> object which can be used
477 to handle index lifecycle management requests.
478  
479 =head1 DOCUMENT CRUD METHODS
480  
481 These methods allow you to perform create, index, update and delete requests
482 for single documents:
483  
484 =head2 C<index()>
485  
486 $response = $e->index(
487 index => 'index_name', # required
488 type => 'type_name', # required
489 id => 'doc_id', # optional, otherwise auto-generated
490  
491 body => { document } # required
492 );
493  
494 The C<index()> method is used to index a new document or to reindex
495 an existing document.
496  
497 Query string parameters:
498 C<error_trace>,
499 C<human>,
500 C<if_primary_term>,
501 C<if_seq_no>,
502 C<op_type>,
503 C<parent>,
504 C<pipeline>,
505 C<refresh>,
506 C<routing>,
507 C<timeout>,
508 C<version>,
509 C<version_type>,
510 C<wait_for_active_shards>
511  
512 See the L<index docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html>
513 for more information.
514  
515 =head2 C<create()>
516  
517 $response = $e->create(
518 index => 'index_name', # required
519 type => 'type_name', # required
520 id => 'doc_id', # required
521  
522 body => { document } # required
523 );
524  
525 The C<create()> method works exactly like the L</index()> method, except
526 that it will throw a C<Conflict> error if a document with the same
527 C<index>, C<type> and C<id> already exists.
528  
529 Query string parameters:
530 C<consistency>,
531 C<error_trace>,
532 C<human>,
533 C<op_type>,
534 C<parent>,
535 C<refresh>,
536 C<routing>,
537 C<timeout>,
538 C<version>,
539 C<version_type>
540  
541 See the L<create docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-create.html>
542 for more information.
543  
544 =head2 C<get()>
545  
546 $response = $e->get(
547 index => 'index_name', # required
548 type => 'type_name', # required
549 id => 'doc_id', # required
550 );
551  
552 The C<get()> method will retrieve the document with the specified
553 C<index>, C<type> and C<id>, or will throw a C<Missing> error.
554  
555 Query string parameters:
556 C<_source>,
557 C<_source_excludes>,
558 C<_source_includes>,
559 C<error_trace>,
560 C<human>,
561 C<parent>,
562 C<preference>,
563 C<realtime>,
564 C<refresh>,
565 C<routing>,
566 C<stored_fields>,
567 C<version>,
568 C<version_type>
569  
570 See the L<get docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html>
571 for more information.
572  
573 =head2 C<get_source()>
574  
575 $response = $e->get_source(
576 index => 'index_name', # required
577 type => 'type_name', # required
578 id => 'doc_id', # required
579 );
580  
581 The C<get_source()> method works just like the L</get()> method except that
582 it returns just the C<_source> field (the value of the C<body> parameter
583 in the L</index()> method) instead of returning the C<_source> field
584 plus the document metadata, ie the C<_index>, C<_type> etc.
585  
586 Query string parameters:
587 C<_source>,
588 C<_source_excludes>,
589 C<_source_includes>,
590 C<error_trace>,
591 C<human>,
592 C<parent>,
593 C<preference>,
594 C<realtime>,
595 C<refresh>,
596 C<routing>,
597 C<version>,
598 C<version_type>
599  
600 See the L<get_source docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html>
601 for more information.
602  
603 =head2 C<exists()>
604  
605 $response = $e->exists(
606 index => 'index_name', # required
607 type => 'type_name', # required
608 id => 'doc_id', # required
609 );
610  
611 The C<exists()> method returns C<1> if a document with the specified
612 C<index>, C<type> and C<id> exists, or an empty string if it doesn't.
613  
614 Query string parameters:
615 C<_source>,
616 C<_source_excludes>,
617 C<_source_includes>,
618 C<error_trace>,
619 C<human>,
620 C<parent>,
621 C<preference>,
622 C<realtime>,
623 C<refresh>,
624 C<routing>,
625 C<version>,
626 C<version_type>
627  
628 See the L<exists docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html>
629 for more information.
630  
631 =head2 C<delete()>
632  
633 $response = $e->delete(
634 index => 'index_name', # required
635 type => 'type_name', # required
636 id => 'doc_id', # required
637 );
638  
639 The C<delete()> method will delete the document with the specified
640 C<index>, C<type> and C<id>, or will throw a C<Missing> error.
641  
642 Query string parameters:
643 C<error_trace>,
644 C<human>,
645 C<if_primary_term>,
646 C<if_seq_no>,
647 C<parent>,
648 C<refresh>,
649 C<routing>,
650 C<timeout>,
651 C<version>,
652 C<version_type>,
653 C<wait_for_active_shards>
654  
655 See the L<delete docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html>
656 for more information.
657  
658 =head2 C<update()>
659  
660 $response = $e->update(
661 index => 'index_name', # required
662 type => 'type_name', # required
663 id => 'doc_id', # required
664  
665 body => { update } # required
666 );
667  
668 The C<update()> method updates a document with the corresponding
669 C<index>, C<type> and C<id> if it exists. Updates can be performed either by:
670  
671 =over
672  
673 =item * providing a partial document to be merged in to the existing document:
674  
675 $response = $e->update(
676 ...,
677 body => {
678 doc => { new_field => 'new_value'},
679 }
680 );
681  
682 =item * with an inline script:
683  
684 $response = $e->update(
685 ...,
686 body => {
687 script => {
688 source => "ctx._source.counter += incr",
689 params => { incr => 6 }
690 }
691 }
692 );
693  
694 =item * with an indexed script:
695  
696 $response = $e->update(
697 ...,
698 body => {
699 script => {
700 id => $id,
701 lang => 'painless',
702 params => { incr => 6 }
703 }
704 }
705 );
706  
707 See L<indexed scripts|https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#_indexed_scripts>
708 for more information.
709  
710 =item * with a script stored as a file:
711  
712 $response = $e->update(
713 ...,
714 body => {
715 script => {
716 file => 'counter',
717 lang => 'painless',
718 params => { incr => 6 }
719 }
720 }
721 );
722  
723 See L<scripting docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html>
724 for more information.
725  
726 =back
727  
728 Query string parameters:
729 C<_source>,
730 C<_source_excludes>,
731 C<_source_includes>,
732 C<error_trace>,
733 C<fields>,
734 C<human>,
735 C<if_primary_term>,
736 C<if_seq_no>,
737 C<lang>,
738 C<parent>,
739 C<refresh>,
740 C<retry_on_conflict>,
741 C<routing>,
742 C<timeout>,
743 C<version>,
744 C<version_type>,
745 C<wait_for_active_shards>
746  
747 See the L<update docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html>
748 for more information.
749  
750 =head2 C<termvectors()>
751  
752 $results = $e->termvectors(
753 index => $index, # required
754 type => $type, # required
755  
756 id => $id, # optional
757 body => {...} # optional
758 )
759  
760 The C<termvectors()> method retrieves term and field statistics, positions,
761 offsets and payloads for the specified document, assuming that termvectors
762 have been enabled.
763  
764 Query string parameters:
765 C<error_trace>,
766 C<field_statistics>,
767 C<fields>,
768 C<human>,
769 C<offsets>,
770 C<parent>,
771 C<payloads>,
772 C<positions>,
773 C<preference>,
774 C<realtime>,
775 C<routing>,
776 C<term_statistics>,
777 C<version>,
778 C<version_type>
779  
780 See the L<termvector docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html>
781 for more information.
782  
783 =head1 BULK DOCUMENT CRUD METHODS
784  
785 The bulk document CRUD methods are used for running multiple CRUD actions
786 within a single request. By reducing the number of network requests
787 that need to be made, bulk requests greatly improve performance.
788  
789 =head2 C<bulk()>
790  
791 $response = $e->bulk(
792 index => 'index_name', # required if type specified
793 type => 'type_name', # optional
794  
795 body => [ actions ] # required
796 );
797  
798 See L<Search::Elasticsearch::Client::7_0::Bulk> and L</bulk_helper()> for a helper module that makes
799 bulk indexing simpler to use.
800  
801 The C<bulk()> method can perform multiple L</index()>, L</create()>,
802 L</delete()> or L</update()> actions with a single request. The C<body>
803 parameter expects an array containing the list of actions to perform.
804  
805 An I<action> consists of an initial metadata hash ref containing the action
806 type, plus the associated metadata, eg :
807  
808 { delete => { _index => 'index', _type => 'type', _id => 123 }}
809  
810 The C<index> and C<create> actions then expect a hashref containing
811 the document itself:
812  
813 { create => { _index => 'index', _type => 'type', _id => 123 }},
814 { title => "A newly created document" }
815  
816 And the C<update> action expects a hashref containing the update commands,
817 eg:
818  
819 { update => { _index => 'index', _type => 'type', _id => 123 }},
820 { script => "ctx._source.counter+=1" }
821  
822 Each action can include the same parameters that you would pass to
823 the equivalent L</index()>, L</create()>, L</delete()> or L</update()>
824 request, except that C<_index>, C<_type> and C<_id> must be specified with
825 the preceding underscore. All other parameters can be specified with or
826 without the underscore.
827  
828 For instance:
829  
830 $response = $e->bulk(
831 index => 'index_name', # default index name
832 type => 'type_name', # default type name
833 body => [
834  
835 # create action
836 { create => {
837 _index => 'not_the_default_index',
838 _type => 'not_the_default_type',
839 _id => 123
840 }},
841 { title => 'Foo' },
842  
843 # index action
844 { index => { _id => 124 }},
845 { title => 'Foo' },
846  
847 # delete action
848 { delete => { _id => 126 }},
849  
850 # update action
851 { update => { _id => 126 }},
852 { script => "ctx._source.counter+1" }
853 ]
854 );
855  
856 Each action is performed separately. One failed action will not
857 cause the others to fail as well.
858  
859 Query string parameters:
860 C<_source>,
861 C<_source_excludes>,
862 C<_source_includes>,
863 C<error_trace>,
864 C<fields>,
865 C<human>,
866 C<pipeline>,
867 C<refresh>,
868 C<routing>,
869 C<timeout>,
870 C<wait_for_active_shards>
871  
872 See the L<bulk docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html>
873 for more information.
874  
875 =head2 C<bulk_helper()>
876  
877 $bulk_helper = $e->bulk_helper( @args );
878  
879 Returns a new instance of the class specified in the L</bulk_helper_class>,
880 which defaults to L<Search::Elasticsearch::Client::7_0::Bulk>.
881  
882 =head2 C<mget()>
883  
884 $results = $e->mget(
885 index => 'default_index', # optional, required when type specified
886 type => 'default_type', # optional
887  
888 body => { docs or ids } # required
889 );
890  
891 The C<mget()> method will retrieve multiple documents with a single request.
892 The C<body> consists of an array of documents to retrieve:
893  
894 $results = $e->mget(
895 index => 'default_index',
896 type => 'default_type',
897 body => {
898 docs => [
899 { _id => 1},
900 { _id => 2, _type => 'not_the_default_type' }
901 ]
902 }
903 );
904  
905 You can also pass any of the other parameters that the L</get()> request
906 accepts.
907  
908 If you have specified an C<index> and C<type>, you can just include the
909 C<ids> of the documents to retrieve:
910  
911 $results = $e->mget(
912 index => 'default_index',
913 type => 'default_type',
914 body => {
915 ids => [ 1, 2, 3]
916 }
917 );
918  
919 Query string parameters:
920 C<_source>,
921 C<_source_excludes>,
922 C<_source_includes>,
923 C<error_trace>,
924 C<human>,
925 C<preference>,
926 C<realtime>,
927 C<refresh>,
928 C<routing>,
929 C<stored_fields>
930  
931 See the L<mget docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html>
932 for more information.
933  
934 =head2 C<mtermvectors()>
935  
936 $results = $e->mtermvectors(
937 index => $index, # required if type specified
938 type => $type, # optional
939  
940 body => { } # optional
941 )
942  
943 Runs multiple L</termvector()> requests in a single request, eg:
944  
945 $results = $e->mtermvectors(
946 index => 'test',
947 body => {
948 docs => [
949 { _type => 'test', _id => 1, fields => ['text'] },
950 { _type => 'test', _id => 2, payloads => 1 },
951 ]
952 }
953 );
954  
955 Query string parameters:
956 C<error_trace>,
957 C<field_statistics>,
958 C<fields>,
959 C<human>,
960 C<ids>,
961 C<offsets>,
962 C<parent>,
963 C<payloads>,
964 C<positions>,
965 C<preference>,
966 C<realtime>,
967 C<routing>,
968 C<term_statistics>,
969 C<version>,
970 C<version_type>
971  
972 See the L<mtermvectors docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html>
973 for more information.
974  
975 =head1 SEARCH METHODS
976  
977 The search methods are used for querying documents in one, more or all indices
978 and of one, more or all types:
979  
980 =head2 C<search()>
981  
982 $results = $e->search(
983 index => 'index' | \@indices, # optional
984 type => 'type' | \@types, # optional
985  
986 body => { search params } # optional
987 );
988  
989 The C<search()> method searches for matching documents in one or more
990 indices. It is just as easy to search a single index as it is to search
991 all the indices in your cluster. It can also return
992 L<aggregations|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html>
993 L<highlighted snippets|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-highlighting.html>
994 and L<did-you-mean|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-phrase.html>
995 or L<search-as-you-type|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-completion.html>
996 suggestions.
997  
998 The I<lite> L<version of search|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-uri-request.html>
999 allows you to specify a query string in the C<q> parameter, using the
1000 Lucene query string syntax:
1001  
1002 $results = $e->search( q => 'title:(elasticsearch clients)');
1003  
1004 However, the preferred way to search is by using the
1005 L<Query DSL|http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html>
1006 to create a query, and passing that C<query> in the
1007 L<request body|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html>:
1008  
1009 $results = $e->search(
1010 body => {
1011 query => {
1012 match => { title => 'Elasticsearch clients'}
1013 }
1014 }
1015 );
1016  
1017 Query string parameters:
1018 C<_source>,
1019 C<_source_excludes>,
1020 C<_source_includes>,
1021 C<allow_no_indices>,
1022 C<allow_partial_search_results>,
1023 C<analyze_wildcard>,
1024 C<analyzer>,
1025 C<batched_reduce_size>,
1026 C<default_operator>,
1027 C<df>,
1028 C<docvalue_fields>,
1029 C<error_trace>,
1030 C<expand_wildcards>,
1031 C<explain>,
1032 C<from>,
1033 C<human>,
1034 C<ignore_throttled>,
1035 C<ignore_unavailable>,
1036 C<lenient>,
1037 C<max_concurrent_shard_requests>,
1038 C<pre_filter_shard_size>,
1039 C<preference>,
1040 C<q>,
1041 C<request_cache>,
1042 C<rest_total_hits_as_int>,
1043 C<routing>,
1044 C<scroll>,
1045 C<search_type>,
1046 C<seq_no_primary_term>,
1047 C<size>,
1048 C<sort>,
1049 C<stats>,
1050 C<stored_fields>,
1051 C<suggest_field>,
1052 C<suggest_mode>,
1053 C<suggest_size>,
1054 C<suggest_text>,
1055 C<terminate_after>,
1056 C<timeout>,
1057 C<track_scores>,
1058 C<track_total_hits>,
1059 C<typed_keys>,
1060 C<version>
1061  
1062 See the L<search reference|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html>
1063 for more information.
1064  
1065 Also see L<Search::Elasticsearch::Transport/send_get_body_as>.
1066  
1067 =head2 C<count()>
1068  
1069 $results = $e->count(
1070 index => 'index' | \@indices, # optional
1071 type => 'type' | \@types, # optional
1072  
1073 body => { query } # optional
1074 )
1075  
1076 The C<count()> method returns the total count of all documents matching the
1077 query:
1078  
1079 $results = $e->count(
1080 body => {
1081 query => {
1082 match => { title => 'Elasticsearch clients' }
1083 }
1084 }
1085 );
1086  
1087 Query string parameters:
1088 C<allow_no_indices>,
1089 C<analyze_wildcard>,
1090 C<analyzer>,
1091 C<default_operator>,
1092 C<df>,
1093 C<error_trace>,
1094 C<expand_wildcards>,
1095 C<human>,
1096 C<ignore_throttled>,
1097 C<ignore_unavailable>,
1098 C<lenient>,
1099 C<lowercase_expanded_terms>
1100 C<min_score>,
1101 C<preference>,
1102 C<q>,
1103 C<routing>,
1104 C<terminate_after>
1105  
1106 See the L<count docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html>
1107 for more information.
1108  
1109 =head2 C<search_template()>
1110  
1111 $results = $e->search_template(
1112 index => 'index' | \@indices, # optional
1113 type => 'type' | \@types, # optional
1114  
1115 body => { search params } # required
1116 );
1117  
1118 Perform a search by specifying a template (either predefined or defined
1119 within the C<body>) and parameters to use with the template, eg:
1120  
1121 $results = $e->search_template(
1122 body => {
1123 source => {
1124 query => {
1125 match => {
1126 "{{my_field}}" => "{{my_value}}"
1127 }
1128 },
1129 size => "{{my_size}}"
1130 },
1131 params => {
1132 my_field => 'foo',
1133 my_value => 'bar',
1134 my_size => 6
1135 }
1136 }
1137 );
1138  
1139 See the L<search template docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html>
1140 for more information.
1141  
1142 Query string parameters:
1143 C<allow_no_indices>,
1144 C<error_trace>,
1145 C<expand_wildcards>,
1146 C<explain>,
1147 C<human>,
1148 C<ignore_throttled>,
1149 C<ignore_unavailable>,
1150 C<preference>,
1151 C<profile>,
1152 C<rest_total_hits_as_int>,
1153 C<scroll>,
1154 C<search_type>,
1155 C<typed_keys>
1156  
1157 =head2 C<render_search_template()>
1158  
1159 $response = $e->render_search_template(
1160 id => 'id', # optional
1161 body => { template } # optional
1162 );
1163  
1164 Renders the template, filling in the passed-in parameters and returns the resulting JSON, eg:
1165  
1166 $results = $e->render_search_template(
1167 body => {
1168 source => {
1169 query => {
1170 match => {
1171 "{{my_field}}" => "{{my_value}}"
1172 }
1173 },
1174 size => "{{my_size}}"
1175 },
1176 params => {
1177 my_field => 'foo',
1178 my_value => 'bar',
1179 my_size => 6
1180 }
1181 }
1182 );
1183  
1184 See the L<search template docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html>
1185 for more information.
1186  
1187 =head2 C<scroll()>
1188  
1189 $results = $e->scroll(
1190 scroll => '1m',
1191 body => {
1192 scroll_id => $id
1193 }
1194 );
1195  
1196 When a L</search()> has been performed with the
1197 C<scroll> parameter, the C<scroll()>
1198 method allows you to keep pulling more results until the results
1199 are exhausted.
1200  
1201 See L</scroll_helper()> and L<Search::Elasticsearch::Client::7_0::Scroll> for a helper utility
1202 which makes managing scroll requests much easier.
1203  
1204 Query string parameters:
1205 C<error_trace>,
1206 C<human>,
1207 C<rest_total_hits_as_int>,
1208 C<scroll>,
1209 C<scroll_id>
1210  
1211 See the L<scroll docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html>
1212 and the L<search_type docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/search.html/search-request-search-type.html>
1213 for more information.
1214  
1215 =head2 C<clear_scroll()>
1216  
1217 $response = $e->clear_scroll(
1218 body => {
1219 scroll_id => $id | \@ids # required
1220 }
1221 );
1222  
1223 The C<clear_scroll()> method can clear unfinished scroll requests, freeing
1224 up resources on the server.
1225  
1226 =head2 C<scroll_helper()>
1227  
1228 $scroll_helper = $e->scroll_helper( @args );
1229  
1230 Returns a new instance of the class specified in the L</scroll_helper_class>,
1231 which defaults to L<Search::Elasticsearch::Client::7_0::Scroll>.
1232  
1233 =head2 C<msearch()>
1234  
1235 $results = $e->msearch(
1236 index => 'default_index' | \@indices, # optional
1237 type => 'default_type' | \@types, # optional
1238  
1239 body => [ searches ] # required
1240 );
1241  
1242 The C<msearch()> method allows you to perform multiple searches in a single
1243 request. Similar to the L</bulk()> request, each search request in the
1244 C<body> consists of two hashes: the metadata hash then the search request
1245 hash (the same data that you'd specify in the C<body> of a L</search()>
1246 request). For instance:
1247  
1248 $results = $e->msearch(
1249 index => 'default_index',
1250 type => ['default_type_1', 'default_type_2'],
1251 body => [
1252 # uses defaults
1253 {},
1254 { query => { match_all => {} }},
1255  
1256 # uses a custom index
1257 { index => 'not_the_default_index' },
1258 { query => { match_all => {} }}
1259 ]
1260 );
1261  
1262 Query string parameters:
1263 C<error_trace>,
1264 C<human>,
1265 C<max_concurrent_searches>,
1266 C<max__concurrent_shard_requests>,
1267 C<pre_filter_shard_size>,
1268 C<rest_total_hits_as_int>,
1269 C<search_type>,
1270 C<typed_keys>
1271  
1272 See the L<msearch docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html>
1273 for more information.
1274  
1275 =head2 C<msearch_template()>
1276  
1277 $results = $e->msearch_template(
1278 index => 'default_index' | \@indices, # optional
1279 type => 'default_type' | \@types, # optional
1280  
1281 body => [ search_templates ] # required
1282 );
1283  
1284 The C<msearch_template()> method allows you to perform multiple searches in a single
1285 request using search templates. Similar to the L</bulk()> request, each search
1286 request in the C<body> consists of two hashes: the metadata hash then the search request
1287 hash (the same data that you'd specify in the C<body> of a L</search()>
1288 request). For instance:
1289  
1290 $results = $e->msearch(
1291 index => 'default_index',
1292 type => ['default_type_1', 'default_type_2'],
1293 body => [
1294 # uses defaults
1295 {},
1296 { source => { query => { match => { user => "{{user}}" }}} params => { user => 'joe' }},
1297  
1298 # uses a custom index
1299 { index => 'not_the_default_index' },
1300 { source => { query => { match => { user => "{{user}}" }}} params => { user => 'joe' }},
1301 ]
1302 );
1303  
1304 Query string parameters:
1305 C<error_trace>,
1306 C<human>,
1307 C<max_concurrent_searches>,
1308 C<rest_total_hits_as_int>,
1309 C<search_type>,
1310 C<typed_keys>
1311  
1312 See the L<msearch-template docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html>
1313 for more information.
1314  
1315 =head2 C<explain()>
1316  
1317 $response = $e->explain(
1318 index => 'my_index', # required
1319 type => 'my_type', # required
1320 id => 123, # required
1321  
1322 body => { search } # required
1323 );
1324  
1325 The C<explain()> method explains why the specified document did or
1326 did not match a query, and how the relevance score was calculated.
1327 For instance:
1328  
1329 $response = $e->explain(
1330 index => 'my_index',
1331 type => 'my_type',
1332 id => 123,
1333 body => {
1334 query => {
1335 match => { title => 'Elasticsearch clients' }
1336 }
1337 }
1338 );
1339  
1340 Query string parameters:
1341 C<_source>,
1342 C<_source_excludes>,
1343 C<_source_includes>,
1344 C<analyze_wildcard>,
1345 C<analyzer>,
1346 C<default_operator>,
1347 C<df>,
1348 C<error_trace>,
1349 C<human>,
1350 C<lenient>,
1351 C<parent>,
1352 C<preference>,
1353 C<q>,
1354 C<routing>,
1355 C<stored_fields>
1356  
1357 See the L<explain docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html>
1358 for more information.
1359  
1360 =head2 C<field_caps()>
1361  
1362 $response = $e->field_caps(
1363 index => 'index' | \@indices, # optional
1364 body => { filters } # optional
1365 );
1366  
1367 The C<field-caps> API returns field types and abilities, merged across indices.
1368  
1369 Query string parameters:
1370 C<allow_no_indices>,
1371 C<error_trace>,
1372 C<expand_wildcards>,
1373 C<fields>,
1374 C<human>,
1375 C<ignore_unavailable>
1376  
1377 See the L<field-caps docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html>
1378 for more information.
1379  
1380 =head2 C<search_shards()>
1381  
1382 $response = $e->search_shards(
1383 index => 'index' | \@indices, # optional
1384 )
1385  
1386 The C<search_shards()> method returns information about which shards on
1387 which nodes will execute a search request.
1388  
1389 Query string parameters:
1390 C<allow_no_indices>,
1391 C<error_trace>,
1392 C<expand_wildcards>,
1393 C<human>,
1394 C<ignore_unavailable>,
1395 C<local>,
1396 C<preference>,
1397 C<routing>
1398  
1399 See the L<search-shards docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html>
1400 for more information.
1401  
1402 =head2 C<rank_eval()>
1403  
1404 $result = $e->rank_eval(
1405 index => 'index' | \@indices, # optional
1406 body => {...} # required
1407 );
1408  
1409 The ranking evaluation API provides a way to execute test cases to determine whether search results
1410 are improving or worsening.
1411  
1412 Query string parameters:
1413 C<allow_no_indices>,
1414 C<error_trace>,
1415 C<expand_wildcards>,
1416 C<filter_path>,
1417 C<human>,
1418 C<ignore_unavailable>
1419  
1420 See the L<rank-eval docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/search-rank-eval.html>
1421 for more information.
1422  
1423 =head1 CRUD-BY-QUERY METHODS
1424  
1425 =head2 C<delete_by_query()>
1426  
1427 $response = $e->delete_by_query(
1428 index => 'index' | \@indices, # optional
1429 type => 'type' | \@types, # optional,
1430 body => { delete-by-query } # required
1431 );
1432  
1433 The C<delete_by_query()> method deletes all documents which match the specified query.
1434  
1435 Query string parameters:
1436 C<_source>,
1437 C<_source_excludes>,
1438 C<_source_includes>,
1439 C<allow_no_indices>,
1440 C<analyze_wildcard>,
1441 C<analyzer>,
1442 C<conflicts>,
1443 C<default_operator>,
1444 C<df>,
1445 C<error_trace>,
1446 C<expand_wildcards>,
1447 C<from>,
1448 C<human>,
1449 C<ignore_unavailable>,
1450 C<lenient>,
1451 C<preference>,
1452 C<q>,
1453 C<refresh>,
1454 C<request_cache>,
1455 C<requests_per_second>,
1456 C<routing>,
1457 C<scroll>,
1458 C<scroll_size>,
1459 C<search_timeout>,
1460 C<search_type>,
1461 C<size>,
1462 C<slices>,
1463 C<sort>,
1464 C<stats>,
1465 C<terminate_after>,
1466 C<version>,
1467 C<timeout>,
1468 C<wait_for_active_shards>,
1469 C<wait_for_completion>
1470  
1471 See the L<delete-by-query docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html>
1472 for more information.
1473  
1474 =head2 C<delete_by_query_rethrottle()>
1475  
1476 $response = $e->delete_by_query_rethrottle(
1477 task_id => 'id' # required
1478 requests_per_second => num
1479 );
1480  
1481 The C<delete_by_query_rethrottle()> API is used to dynamically update the throtting
1482 of an existing delete-by-query request, identified by C<task_id>.
1483  
1484 Query string parameters:
1485 C<error_trace>,
1486 C<filter_path>,
1487 C<human>,
1488 C<requests_per_second>
1489  
1490 See the L<delete-by-query-rethrottle docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html>
1491 for more information.
1492  
1493 =head2 C<reindex()>
1494  
1495 $response = $e->reindex(
1496 body => { reindex } # required
1497 );
1498  
1499 The C<reindex()> API is used to index documents from one index or multiple indices
1500 to a new index.
1501  
1502 Query string parameters:
1503 C<error_trace>,
1504 C<human>,
1505 C<refresh>,
1506 C<requests_per_second>,
1507 C<slices>,
1508 C<timeout>,
1509 C<wait_for_active_shards>,
1510 C<wait_for_completion>
1511  
1512 See the L<reindex docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html>
1513 for more information.
1514  
1515 =head2 C<reindex_rethrottle()>
1516  
1517 $response = $e->delete_by_query_rethrottle(
1518 task_id => 'id', # required
1519 requests_per_second => num
1520 );
1521  
1522 The C<reindex_rethrottle()> API is used to dynamically update the throtting
1523 of an existing reindex request, identified by C<task_id>.
1524  
1525 Query string parameters:
1526 C<error_trace>,
1527 C<filter_path>,
1528 C<human>,
1529 C<requests_per_second>
1530  
1531 See the L<reindex-rethrottle docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html>
1532 for more information.
1533  
1534 =head2 C<update_by_query()>
1535  
1536 $response = $e->update_by_query(
1537 index => 'index' | \@indices, # optional
1538 type => 'type' | \@types, # optional,
1539 body => { update-by-query } # optional
1540 );
1541  
1542 The C<update_by_query()> API is used to bulk update documents from one index or
1543 multiple indices using a script.
1544  
1545 Query string parameters:
1546 C<_source>,
1547 C<_source_excludes>,
1548 C<_source_includes>,
1549 C<allow_no_indices>,
1550 C<analyze_wildcard>,
1551 C<analyzer>,
1552 C<conflicts>,
1553 C<default_operator>,
1554 C<df>,
1555 C<error_trace>,
1556 C<expand_wildcards>,
1557 C<from>,
1558 C<human>,
1559 C<ignore_unavailable>,
1560 C<lenient>,
1561 C<pipeline>,
1562 C<preference>,
1563 C<q>,
1564 C<refresh>,
1565 C<request_cache>,
1566 C<requests_per_second>,
1567 C<routing>,
1568 C<scroll>,
1569 C<scroll_size>,
1570 C<search_timeout>,
1571 C<search_type>,
1572 C<size>,
1573 C<slices>,
1574 C<sort>,
1575 C<stats>,
1576 C<terminate_after>,
1577 C<timeout>,
1578 C<version>,
1579 C<version_type>,
1580 C<wait_for_active_shards>,
1581 C<wait_for_completion>
1582  
1583 See the L<update_by_query docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html>
1584 for more information.
1585  
1586 =head2 C<update_by_query_rethrottle()>
1587  
1588 $response = $e->update_by_query_rethrottle(
1589 task_id => 'id' # required
1590 requests_per_second => num
1591 );
1592  
1593 The C<update_by_query_rethrottle()> API is used to dynamically update the throtting
1594 of an existing update-by-query request, identified by C<task_id>.
1595  
1596 Query string parameters:
1597 C<error_trace>,
1598 C<filter_path>,
1599 C<human>,
1600 C<requests_per_second>
1601  
1602 See the L<update-by-query-rethrottle docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html>
1603 for more information.
1604  
1605 =head1 INDEXED SCRIPT METHODS
1606  
1607 Elasticsearch allows you to store scripts in the cluster state
1608 and reference them by id. The methods to manage indexed scripts are as follows:
1609  
1610 =head2 C<put_script()>
1611  
1612 $result = $e->put_script(
1613 id => 'id', # required
1614 context => $context, # optional
1615 body => { script } # required
1616 );
1617  
1618 The C<put_script()> method is used to store a script in the cluster state. For instance:
1619  
1620 $result = $e->put_scripts(
1621 id => 'hello_world',
1622 body => {
1623 script => {
1624 lang => 'painless',
1625 source => q(return "hello world")
1626 }
1627 }
1628 );
1629  
1630 Query string parameters:
1631 C<error_trace>,
1632 C<human>
1633  
1634 See the L<indexed scripts docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#_indexed_scripts> for more.
1635  
1636 =head2 C<get_script()>
1637  
1638 $script = $e->get_script(
1639 id => 'id', # required
1640 );
1641  
1642 Retrieve the indexed script from the cluster state.
1643  
1644 Query string parameters:
1645 C<error_trace>,
1646 C<human>,
1647 C<master_timeout>
1648  
1649 See the L<indexed scripts docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#_indexed_scripts> for more.
1650  
1651 =head2 C<delete_script()>
1652  
1653 $script = $e->delete_script(
1654 id => 'id', # required
1655 );
1656  
1657 Delete the indexed script from the cluster state.
1658  
1659 Query string parameters:
1660 C<error_trace>,
1661 C<human>,
1662 C<master_timeout>,
1663 C<timeout>
1664  
1665 See the L<indexed scripts docs|http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#_indexed_scripts> for more.
1666  
1667 =head2 C<scripts_painless_execute()>
1668  
1669 $result = $e->scripts_painless_execute(
1670 body => {...} # required
1671 );
1672  
1673 The Painless execute API allows an arbitrary script to be executed and a result to be returned.
1674  
1675 Query string parameters:
1676 C<error_trace>,
1677 C<filter_path>,
1678 C<human>
1679  
1680 See the L<painless execution docs|https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-execute-api.html> for more.
1681  
1682 =head1 AUTHOR
1683  
1684 Enrico Zimuel <enrico.zimuel@elastic.co>
1685  
1686 =head1 COPYRIGHT AND LICENSE
1687  
1688 This software is Copyright (c) 2021 by Elasticsearch BV.
1689  
1690 This is free software, licensed under:
1691  
1692 The Apache License, Version 2.0, January 2004
1693  
1694 =cut
1695  
1696 __END__