7_0/Direct.pm untested

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