1Search::Elasticsearch::UCsleirenCto:n:t7r_i0bS:ue:taDeridcrheP:ce:trE(ll3a)Dsotciucmseenatracthi:o:nClient::7_0::Direct(3)
2
3
4

NAME

6       Search::Elasticsearch::Client::7_0::Direct - Thin client with full
7       support for Elasticsearch 7.x APIs
8

VERSION

10       version 7.30
11

SYNOPSIS

13       Create a client:
14
15           use Search::Elasticsearch;
16           my $e = Search::Elasticsearch->new(
17               client => '7_0::Direct'
18           );
19
20       Index a doc:
21
22           $e->index(
23               index   => 'my_index',
24               type    => 'blog_post',
25               id      => 123,
26               body    => {
27                   title   => "Elasticsearch clients",
28                   content => "Interesting content...",
29                   date    => "2013-09-23"
30               }
31           );
32
33       Get a doc:
34
35           $e->get(
36               index   => 'my_index',
37               type    => 'my_type',
38               id      => 123
39           );
40
41       Search for docs:
42
43           $results = $e->search(
44               index   => 'my_index',
45               body    => {
46                   query => {
47                       match => {
48                           title => "elasticsearch"
49                       }
50                   }
51               }
52           );
53
54       Index-level requests:
55
56           $e->indices->create( index => 'my_index' );
57           $e->indices->delete( index => 'my_index' )
58
59       Ingest pipeline requests:
60
61           $e->ingest->get_pipeline( id => 'apache-logs' );
62
63       Cluster-level requests:
64
65           $health = $e->cluster->health;
66
67       Node-level requests:
68
69           $info  = $e->nodes->info;
70           $stats = $e->nodes->stats;
71
72       Snapshot and restore:
73
74           $e->snapshot->create_repository(
75               repository => 'my_backups',
76               type       => 'fs',
77               settings   => {
78                   location => '/mnt/backups'
79               }
80           );
81
82           $e->snapshot->create(
83               repository => 'my_backups',
84               snapshot   => 'backup_2014'
85           );
86
87       Task management:
88
89           $e->tasks->list;
90
91       `cat` debugging:
92
93           say $e->cat->allocation;
94           say $e->cat->health;
95
96       Cross-cluster replication requests:
97
98           say $e->ccr->follow;
99
100       Index lifecycle management requests:
101
102           say $e->ilm->put_lifecycle;
103

DESCRIPTION

105       The Search::Elasticsearch::Client::7_0::Direct class provides the
106       Elasticsearch 7.x compatible client returned by:
107
108           $e = Search::Elasticsearch->new(
109               client => "7_0::Direct"  # default
110           );
111
112       It is intended to be as close as possible to the native REST API that
113       Elasticsearch uses, so that it is easy to translate the Elasticsearch
114       reference documentation <http://www.elasticsearch/guide> for an API to
115       the equivalent in this client.
116
117       This class provides the methods for document CRUD, bulk document CRUD
118       and search.  It also provides access to clients for managing indices
119       and the cluster.
120

PREVIOUS VERSIONS OF ELASTICSEARCH

122       This version of the client supports the Elasticsearch 7.0 branch, which
123       is not backwards compatible with earlier branches.
124
125       If you need to talk to a version of Elasticsearch before 7.0.0, please
126       install one of the following modules:
127
128       •   Search::Elasticsearch::Client::6_0
129
130       •   Search::Elasticsearch::Client::5_0
131
132       •   Search::Elasticsearch::Client::2_0
133
134       •   Search::Elasticsearch::Client::1_0
135
136       •   Search::Elasticsearch::Client::0_90
137

CONVENTIONS

139   Parameter passing
140       Parameters can be passed to any request method as a list or as a hash
141       reference. The following two statements are equivalent:
142
143           $e->search( size => 10 );
144           $e->search({size => 10});
145
146   Path parameters
147       Any values that should be included in the URL path, eg
148       "/{index}/{type}" should be passed as top level parameters:
149
150           $e->search( index => 'my_index', type => 'my_type' );
151
152       Alternatively, you can specify a "path" parameter directly:
153
154           $e->search( path => '/my_index/my_type' );
155
156   Query-string parameters
157       Any values that should be included in the query string should be passed
158       as top level parameters:
159
160           $e->search( size => 10 );
161
162       If you pass in a "\%params" hash, then it will be included in the query
163       string parameters without any error checking. The following:
164
165           $e->search( size => 10, params => { from => 6, size => 6 })
166
167       would result in this query string:
168
169           ?from=6&size=10
170
171   Body parameter
172       The request body should be passed in the "body" key:
173
174           $e->search(
175               body => {
176                   query => {...}
177               }
178           );
179
180       The body can also be a UTF8-decoded string, which will be converted
181       into UTF-8 bytes and passed as is:
182
183           $e->indices->analyze( body => "The quick brown fox");
184
185   Boolean parameters
186       Elasticsearch 7.0.0 and above no longer accepts truthy and falsey
187       values for booleans.  Instead, it will accept only a JSON "true" or
188       "false", or the string equivalents "true" or "false".
189
190       In the Perl client, you can use the following values:
191
192       •   True: "true", "\1", or a JSON::PP::Boolean object.
193
194       •   False: "false", "\0", or a JSON::PP::Boolean object.
195
196   Filter path parameter
197       Any API which returns a JSON body accepts a "filter_path" parameter
198       which will filter the JSON down to only the specified paths.  For
199       instance, if you are running a search request and only want the "total"
200       hits and the "_source" field for each hit (without the "_id", "_index"
201       etc), you can do:
202
203           $e->search(
204               query => {...},
205               filter_paths => [ 'hits.total', 'hits.hits._source' ]
206           );
207
208   Ignore parameter
209       Normally, any HTTP status code outside the 200-299 range will result in
210       an error being thrown.  To suppress these errors, you can specify which
211       status codes to ignore in the "ignore" parameter.
212
213           $e->indices->delete(
214               index  => 'my_index',
215               ignore => 404
216           );
217
218       This is most useful for Missing errors, which are triggered by a 404
219       status code when some requested resource does not exist.
220
221       Multiple error codes can be specified with an array:
222
223           $e->indices->delete(
224               index  => 'my_index',
225               ignore => [404,409]
226           );
227

CONFIGURATION

229   "bulk_helper_class"
230       The class to use for the "bulk_helper()" method. Defaults to
231       Search::Elasticsearch::Client::7_0::Bulk.
232
233   "scroll_helper_class"
234       The class to use for the "scroll_helper()" method. Defaults to
235       Search::Elasticsearch::Client::7_0::Scroll.
236

GENERAL METHODS

238   "info()"
239           $info = $e->info
240
241       Returns information about the version of Elasticsearch that the
242       responding node is running.
243
244   "ping()"
245           $e->ping
246
247       Pings a node in the cluster and returns 1 if it receives a 200
248       response, otherwise it throws an error.
249
250   "indices()"
251           $indices_client = $e->indices;
252
253       Returns a Search::Elasticsearch::Client::7_0::Direct::Indices object
254       which can be used for managing indices, eg creating, deleting indices,
255       managing mapping, index settings etc.
256
257   "ingest()"
258           $ingest_client = $e->ingest;
259
260       Returns a Search::Elasticsearch::Client::7_0::Direct::Ingest object
261       which can be used for managing ingest pipelines.
262
263   "cluster()"
264           $cluster_client = $e->cluster;
265
266       Returns a Search::Elasticsearch::Client::7_0::Direct::Cluster object
267       which can be used for managing the cluster, eg cluster-wide settings
268       and cluster health.
269
270   "nodes()"
271           $node_client = $e->nodes;
272
273       Returns a Search::Elasticsearch::Client::7_0::Direct::Nodes object
274       which can be used to retrieve node info and stats.
275
276   "snapshot()"
277           $snapshot_client = $e->snapshot;
278
279       Returns a Search::Elasticsearch::Client::7_0::Direct::Snapshot object
280       which is used for managing backup repositories and creating and
281       restoring snapshots.
282
283   "tasks()"
284           $tasks_client = $e->tasks;
285
286       Returns a Search::Elasticsearch::Client::7_0::Direct::Tasks object
287       which is used for accessing the task management API.
288
289   "cat()"
290           $cat_client = $e->cat;
291
292       Returns a Search::Elasticsearch::Client::7_0::Direct::Cat object which
293       can be used to retrieve simple to read text info for debugging and
294       monitoring an Elasticsearch cluster.
295
296   "ccr()"
297           $ccr_client = $e->ccr;
298
299       Returns a Search::Elasticsearch::Client::7_0::Direct::CCR object which
300       can be used to handle cross-cluster replication requests.
301
302   "ilm()"
303           $ilm_client = $e->ilm;
304
305       Returns a Search::Elasticsearch::Client::7_0::Direct::ILM object which
306       can be used to handle index lifecycle management requests.
307

DOCUMENT CRUD METHODS

309       These methods allow you to perform create, index, update and delete
310       requests for single documents:
311
312   "index()"
313           $response = $e->index(
314               index   => 'index_name',        # required
315               type    => 'type_name',         # required
316               id      => 'doc_id',            # optional, otherwise auto-generated
317
318               body    => { document }         # required
319           );
320
321       The "index()" method is used to index a new document or to reindex an
322       existing document.
323
324       Query string parameters:
325           "error_trace",
326           "human",
327           "if_primary_term",
328           "if_seq_no",
329           "op_type",
330           "parent",
331           "pipeline",
332           "refresh",
333           "routing",
334           "timeout",
335           "version",
336           "version_type",
337           "wait_for_active_shards"
338
339       See the index docs
340       <http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
341       index_.html> for more information.
342
343   "create()"
344           $response = $e->create(
345               index   => 'index_name',        # required
346               type    => 'type_name',         # required
347               id      => 'doc_id',            # required
348
349               body    => { document }         # required
350           );
351
352       The "create()" method works exactly like the "index()" method, except
353       that it will throw a "Conflict" error if a document with the same
354       "index", "type" and "id" already exists.
355
356       Query string parameters:
357           "consistency",
358           "error_trace",
359           "human",
360           "op_type",
361           "parent",
362           "refresh",
363           "routing",
364           "timeout",
365           "version",
366           "version_type"
367
368       See the create docs
369       <http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
370       create.html> for more information.
371
372   "get()"
373           $response = $e->get(
374               index   => 'index_name',        # required
375               type    => 'type_name',         # required
376               id      => 'doc_id',            # required
377           );
378
379       The "get()" method will retrieve the document with the specified
380       "index", "type" and "id", or will throw a "Missing" error.
381
382       Query string parameters:
383           "_source",
384           "_source_excludes",
385           "_source_includes",
386           "error_trace",
387           "human",
388           "parent",
389           "preference",
390           "realtime",
391           "refresh",
392           "routing",
393           "stored_fields",
394           "version",
395           "version_type"
396
397       See the get docs
398       <http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
399       get.html> for more information.
400
401   "get_source()"
402           $response = $e->get_source(
403               index   => 'index_name',        # required
404               type    => 'type_name',         # required
405               id      => 'doc_id',            # required
406           );
407
408       The "get_source()" method works just like the "get()" method except
409       that it returns just the "_source" field (the value of the "body"
410       parameter in the "index()" method) instead of returning the "_source"
411       field plus the document metadata, ie the "_index", "_type" etc.
412
413       Query string parameters:
414           "_source",
415           "_source_excludes",
416           "_source_includes",
417           "error_trace",
418           "human",
419           "parent",
420           "preference",
421           "realtime",
422           "refresh",
423           "routing",
424           "version",
425           "version_type"
426
427       See the get_source docs
428       <http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
429       get.html> for more information.
430
431   "exists()"
432           $response = $e->exists(
433               index   => 'index_name',        # required
434               type    => 'type_name',         # required
435               id      => 'doc_id',            # required
436           );
437
438       The "exists()" method returns 1 if a document with the specified
439       "index", "type" and "id" exists, or an empty string if it doesn't.
440
441       Query string parameters:
442           "_source",
443           "_source_excludes",
444           "_source_includes",
445           "error_trace",
446           "human",
447           "parent",
448           "preference",
449           "realtime",
450           "refresh",
451           "routing",
452           "version",
453           "version_type"
454
455       See the exists docs
456       <http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
457       get.html> for more information.
458
459   "delete()"
460           $response = $e->delete(
461               index   => 'index_name',        # required
462               type    => 'type_name',         # required
463               id      => 'doc_id',            # required
464           );
465
466       The "delete()" method will delete the document with the specified
467       "index", "type" and "id", or will throw a "Missing" error.
468
469       Query string parameters:
470           "error_trace",
471           "human",
472           "if_primary_term",
473           "if_seq_no",
474           "parent",
475           "refresh",
476           "routing",
477           "timeout",
478           "version",
479           "version_type",
480           "wait_for_active_shards"
481
482       See the delete docs
483       <http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
484       delete.html> for more information.
485
486   "update()"
487           $response = $e->update(
488               index   => 'index_name',        # required
489               type    => 'type_name',         # required
490               id      => 'doc_id',            # required
491
492               body    => { update }           # required
493           );
494
495       The "update()" method updates a document with the corresponding
496       "index", "type" and "id" if it exists. Updates can be performed either
497       by:
498
499       •   providing a partial document to be merged in to the existing
500           document:
501
502               $response = $e->update(
503                   ...,
504                   body => {
505                       doc => { new_field => 'new_value'},
506                   }
507               );
508
509       •   with an inline script:
510
511               $response = $e->update(
512                   ...,
513                   body => {
514                       script => {
515                           source => "ctx._source.counter += incr",
516                           params => { incr => 6 }
517                       }
518                   }
519               );
520
521       •   with an indexed script:
522
523               $response = $e->update(
524                   ...,
525                   body => {
526                       script => {
527                           id     => $id,
528                           lang   => 'painless',
529                           params => { incr => 6 }
530                       }
531                   }
532               );
533
534           See indexed scripts
535           <https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-
536           scripting.html#_indexed_scripts> for more information.
537
538       •   with a script stored as a file:
539
540               $response = $e->update(
541                   ...,
542                   body => {
543                       script => {
544                           file   => 'counter',
545                           lang   => 'painless',
546                           params => { incr => 6 }
547                       }
548                   }
549               );
550
551           See scripting docs
552           <https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-
553           scripting.html> for more information.
554
555       Query string parameters:
556           "_source",
557           "_source_excludes",
558           "_source_includes",
559           "error_trace",
560           "fields",
561           "human",
562           "if_primary_term",
563           "if_seq_no",
564           "lang",
565           "parent",
566           "refresh",
567           "retry_on_conflict",
568           "routing",
569           "timeout",
570           "version",
571           "version_type",
572           "wait_for_active_shards"
573
574       See the update docs
575       <http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
576       update.html> for more information.
577
578   "termvectors()"
579           $results = $e->termvectors(
580               index   => $index,          # required
581               type    => $type,           # required
582
583               id      => $id,             # optional
584               body    => {...}            # optional
585           )
586
587       The "termvectors()" method retrieves term and field statistics,
588       positions, offsets and payloads for the specified document, assuming
589       that termvectors have been enabled.
590
591       Query string parameters:
592           "error_trace",
593           "field_statistics",
594           "fields",
595           "human",
596           "offsets",
597           "parent",
598           "payloads",
599           "positions",
600           "preference",
601           "realtime",
602           "routing",
603           "term_statistics",
604           "version",
605           "version_type"
606
607       See the termvector docs
608       <http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
609       termvectors.html> for more information.
610

BULK DOCUMENT CRUD METHODS

612       The bulk document CRUD methods are used for running multiple CRUD
613       actions within a single request.  By reducing the number of network
614       requests that need to be made, bulk requests greatly improve
615       performance.
616
617   "bulk()"
618           $response = $e->bulk(
619               index   => 'index_name',        # required if type specified
620               type    => 'type_name',         # optional
621
622               body    => [ actions ]          # required
623           );
624
625       See Search::Elasticsearch::Client::7_0::Bulk and "bulk_helper()" for a
626       helper module that makes bulk indexing simpler to use.
627
628       The "bulk()" method can perform multiple "index()", "create()",
629       "delete()" or "update()" actions with a single request. The "body"
630       parameter expects an array containing the list of actions to perform.
631
632       An action consists of an initial metadata hash ref containing the
633       action type, plus the associated metadata, eg :
634
635           { delete => { _index => 'index', _type => 'type', _id => 123 }}
636
637       The "index" and "create" actions then expect a hashref containing the
638       document itself:
639
640           { create => { _index => 'index', _type => 'type', _id => 123 }},
641           { title => "A newly created document" }
642
643       And the "update" action expects a hashref containing the update
644       commands, eg:
645
646           { update => { _index => 'index', _type => 'type', _id => 123 }},
647           { script => "ctx._source.counter+=1" }
648
649       Each action can include the same parameters that you would pass to the
650       equivalent "index()", "create()", "delete()" or "update()" request,
651       except that "_index", "_type" and "_id" must be specified with the
652       preceding underscore. All other parameters can be specified with or
653       without the underscore.
654
655       For instance:
656
657           $response = $e->bulk(
658               index   => 'index_name',        # default index name
659               type    => 'type_name',         # default type name
660               body    => [
661
662                   # create action
663                   { create => {
664                       _index => 'not_the_default_index',
665                       _type  => 'not_the_default_type',
666                       _id    => 123
667                   }},
668                   { title => 'Foo' },
669
670                   # index action
671                   { index => { _id => 124 }},
672                   { title => 'Foo' },
673
674                   # delete action
675                   { delete => { _id => 126 }},
676
677                   # update action
678                   { update => { _id => 126 }},
679                   { script => "ctx._source.counter+1" }
680               ]
681           );
682
683       Each action is performed separately. One failed action will not cause
684       the others to fail as well.
685
686       Query string parameters:
687           "_source",
688           "_source_excludes",
689           "_source_includes",
690           "error_trace",
691           "fields",
692           "human",
693           "pipeline",
694           "refresh",
695           "routing",
696           "timeout",
697           "wait_for_active_shards"
698
699       See the bulk docs
700       <http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
701       bulk.html> for more information.
702
703   "bulk_helper()"
704           $bulk_helper = $e->bulk_helper( @args );
705
706       Returns a new instance of the class specified in the
707       "bulk_helper_class", which defaults to
708       Search::Elasticsearch::Client::7_0::Bulk.
709
710   "mget()"
711           $results = $e->mget(
712               index   => 'default_index',     # optional, required when type specified
713               type    => 'default_type',      # optional
714
715               body    => { docs or ids }      # required
716           );
717
718       The "mget()" method will retrieve multiple documents with a single
719       request.  The "body" consists of an array of documents to retrieve:
720
721           $results = $e->mget(
722               index   => 'default_index',
723               type    => 'default_type',
724               body    => {
725                   docs => [
726                       { _id => 1},
727                       { _id => 2, _type => 'not_the_default_type' }
728                   ]
729               }
730           );
731
732       You can also pass any of the other parameters that the "get()" request
733       accepts.
734
735       If you have specified an "index" and "type", you can just include the
736       "ids" of the documents to retrieve:
737
738           $results = $e->mget(
739               index   => 'default_index',
740               type    => 'default_type',
741               body    => {
742                   ids => [ 1, 2, 3]
743               }
744           );
745
746       Query string parameters:
747           "_source",
748           "_source_excludes",
749           "_source_includes",
750           "error_trace",
751           "human",
752           "preference",
753           "realtime",
754           "refresh",
755           "routing",
756           "stored_fields"
757
758       See the mget docs
759       <http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
760       multi-get.html> for more information.
761
762   "mtermvectors()"
763           $results = $e->mtermvectors(
764               index   => $index,          # required if type specified
765               type    => $type,           # optional
766
767               body    => { }              # optional
768           )
769
770       Runs multiple "termvector()" requests in a single request, eg:
771
772           $results = $e->mtermvectors(
773               index   => 'test',
774               body    => {
775                   docs => [
776                       { _type => 'test', _id => 1, fields => ['text'] },
777                       { _type => 'test', _id => 2, payloads => 1 },
778                   ]
779               }
780           );
781
782       Query string parameters:
783           "error_trace",
784           "field_statistics",
785           "fields",
786           "human",
787           "ids",
788           "offsets",
789           "parent",
790           "payloads",
791           "positions",
792           "preference",
793           "realtime",
794           "routing",
795           "term_statistics",
796           "version",
797           "version_type"
798
799       See the mtermvectors docs
800       <http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
801       multi-termvectors.html> for more information.
802

SEARCH METHODS

804       The search methods are used for querying documents in one, more or all
805       indices and of one, more or all types:
806
807   "search()"
808           $results = $e->search(
809               index   => 'index' | \@indices,     # optional
810               type    => 'type'  | \@types,       # optional
811
812               body    => { search params }        # optional
813           );
814
815       The "search()" method searches for matching documents in one or more
816       indices.  It is just as easy to search a single index as it is to
817       search all the indices in your cluster.  It can also return
818       aggregations
819       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
820       aggregations.html> highlighted snippets
821       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
822       highlighting.html> and did-you-mean
823       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
824       suggesters-phrase.html> or search-as-you-type
825       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
826       suggesters-completion.html> suggestions.
827
828       The lite version of search
829       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
830       uri-request.html> allows you to specify a query string in the "q"
831       parameter, using the Lucene query string syntax:
832
833           $results = $e->search( q => 'title:(elasticsearch clients)');
834
835       However, the preferred way to search is by using the Query DSL
836       <http://www.elastic.co/guide/en/elasticsearch/reference/current/query-
837       dsl.html> to create a query, and passing that "query" in the request
838       body
839       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
840       request-body.html>:
841
842           $results = $e->search(
843               body => {
844                   query => {
845                       match => { title => 'Elasticsearch clients'}
846                   }
847               }
848           );
849
850       Query string parameters:
851           "_source",
852           "_source_excludes",
853           "_source_includes",
854           "allow_no_indices",
855           "allow_partial_search_results",
856           "analyze_wildcard",
857           "analyzer",
858           "batched_reduce_size",
859           "default_operator",
860           "df",
861           "docvalue_fields",
862           "error_trace",
863           "expand_wildcards",
864           "explain",
865           "from",
866           "human",
867           "ignore_throttled",
868           "ignore_unavailable",
869           "lenient",
870           "max_concurrent_shard_requests",
871           "pre_filter_shard_size",
872           "preference",
873           "q",
874           "request_cache",
875           "rest_total_hits_as_int",
876           "routing",
877           "scroll",
878           "search_type",
879           "seq_no_primary_term",
880           "size",
881           "sort",
882           "stats",
883           "stored_fields",
884           "suggest_field",
885           "suggest_mode",
886           "suggest_size",
887           "suggest_text",
888           "terminate_after",
889           "timeout",
890           "track_scores",
891           "track_total_hits",
892           "typed_keys",
893           "version"
894
895       See the search reference
896       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
897       request-body.html> for more information.
898
899       Also see "send_get_body_as" in Search::Elasticsearch::Transport.
900
901   "count()"
902           $results = $e->count(
903               index   => 'index' | \@indices,     # optional
904               type    => 'type'  | \@types,       # optional
905
906               body    => { query }                # optional
907           )
908
909       The "count()" method returns the total count of all documents matching
910       the query:
911
912           $results = $e->count(
913               body => {
914                   query => {
915                       match => { title => 'Elasticsearch clients' }
916                   }
917               }
918           );
919
920       Query string parameters:
921           "allow_no_indices",
922           "analyze_wildcard",
923           "analyzer",
924           "default_operator",
925           "df",
926           "error_trace",
927           "expand_wildcards",
928           "human",
929           "ignore_throttled",
930           "ignore_unavailable",
931           "lenient",
932           "lowercase_expanded_terms"
933           "min_score",
934           "preference",
935           "q",
936           "routing",
937           "terminate_after"
938
939       See the count docs
940       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
941       count.html> for more information.
942
943   "search_template()"
944           $results = $e->search_template(
945               index   => 'index' | \@indices,     # optional
946               type    => 'type'  | \@types,       # optional
947
948               body    => { search params }        # required
949           );
950
951       Perform a search by specifying a template (either predefined or defined
952       within the "body") and parameters to use with the template, eg:
953
954           $results = $e->search_template(
955               body => {
956                   source => {
957                       query => {
958                           match => {
959                               "{{my_field}}" => "{{my_value}}"
960                           }
961                       },
962                       size => "{{my_size}}"
963                   },
964                   params => {
965                       my_field => 'foo',
966                       my_value => 'bar',
967                       my_size  => 6
968                   }
969               }
970           );
971
972       See the search template docs
973       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
974       template.html> for more information.
975
976       Query string parameters:
977           "allow_no_indices",
978           "error_trace",
979           "expand_wildcards",
980           "explain",
981           "human",
982           "ignore_throttled",
983           "ignore_unavailable",
984           "preference",
985           "profile",
986           "rest_total_hits_as_int",
987           "scroll",
988           "search_type",
989           "typed_keys"
990
991   "render_search_template()"
992           $response = $e->render_search_template(
993               id   => 'id',           # optional
994               body => { template }    # optional
995           );
996
997       Renders the template, filling in the passed-in parameters and returns
998       the resulting JSON, eg:
999
1000           $results = $e->render_search_template(
1001               body => {
1002                   source => {
1003                       query => {
1004                           match => {
1005                               "{{my_field}}" => "{{my_value}}"
1006                           }
1007                       },
1008                       size => "{{my_size}}"
1009                   },
1010                   params => {
1011                       my_field => 'foo',
1012                       my_value => 'bar',
1013                       my_size  => 6
1014                   }
1015               }
1016           );
1017
1018       See the search template docs
1019       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
1020       template.html> for more information.
1021
1022   "scroll()"
1023           $results = $e->scroll(
1024               scroll      => '1m',
1025               body => {
1026                   scroll_id   => $id
1027               }
1028           );
1029
1030       When a "search()" has been performed with the "scroll" parameter, the
1031       "scroll()" method allows you to keep pulling more results until the
1032       results are exhausted.
1033
1034       See "scroll_helper()" and Search::Elasticsearch::Client::7_0::Scroll
1035       for a helper utility which makes managing scroll requests much easier.
1036
1037       Query string parameters:
1038           "error_trace",
1039           "human",
1040           "rest_total_hits_as_int",
1041           "scroll",
1042           "scroll_id"
1043
1044       See the scroll docs
1045       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
1046       request-scroll.html> and the search_type docs
1047       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search.html/search-
1048       request-search-type.html> for more information.
1049
1050   "clear_scroll()"
1051           $response = $e->clear_scroll(
1052               body => {
1053                   scroll_id => $id | \@ids    # required
1054               }
1055           );
1056
1057       The "clear_scroll()" method can clear unfinished scroll requests,
1058       freeing up resources on the server.
1059
1060   "scroll_helper()"
1061           $scroll_helper = $e->scroll_helper( @args );
1062
1063       Returns a new instance of the class specified in the
1064       "scroll_helper_class", which defaults to
1065       Search::Elasticsearch::Client::7_0::Scroll.
1066
1067   "msearch()"
1068           $results = $e->msearch(
1069               index   => 'default_index' | \@indices,     # optional
1070               type    => 'default_type'  | \@types,       # optional
1071
1072               body    => [ searches ]                     # required
1073           );
1074
1075       The "msearch()" method allows you to perform multiple searches in a
1076       single request.  Similar to the "bulk()" request, each search request
1077       in the "body" consists of two hashes: the metadata hash then the search
1078       request hash (the same data that you'd specify in the "body" of a
1079       "search()" request).  For instance:
1080
1081           $results = $e->msearch(
1082               index   => 'default_index',
1083               type    => ['default_type_1', 'default_type_2'],
1084               body => [
1085                   # uses defaults
1086                   {},
1087                   { query => { match_all => {} }},
1088
1089                   # uses a custom index
1090                   { index => 'not_the_default_index' },
1091                   { query => { match_all => {} }}
1092               ]
1093           );
1094
1095       Query string parameters:
1096           "error_trace",
1097           "human",
1098           "max_concurrent_searches",
1099           "max__concurrent_shard_requests",
1100           "pre_filter_shard_size",
1101           "rest_total_hits_as_int",
1102           "search_type",
1103           "typed_keys"
1104
1105       See the msearch docs
1106       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
1107       multi-search.html> for more information.
1108
1109   "msearch_template()"
1110           $results = $e->msearch_template(
1111               index   => 'default_index' | \@indices,     # optional
1112               type    => 'default_type'  | \@types,       # optional
1113
1114               body    => [ search_templates ]             # required
1115           );
1116
1117       The "msearch_template()" method allows you to perform multiple searches
1118       in a single request using search templates.  Similar to the "bulk()"
1119       request, each search request in the "body" consists of two hashes: the
1120       metadata hash then the search request hash (the same data that you'd
1121       specify in the "body" of a "search()" request).  For instance:
1122
1123           $results = $e->msearch(
1124               index   => 'default_index',
1125               type    => ['default_type_1', 'default_type_2'],
1126               body => [
1127                   # uses defaults
1128                   {},
1129                   { source => { query => { match => { user => "{{user}}" }}} params => { user => 'joe' }},
1130
1131                   # uses a custom index
1132                   { index => 'not_the_default_index' },
1133                   { source => { query => { match => { user => "{{user}}" }}} params => { user => 'joe' }},
1134               ]
1135           );
1136
1137       Query string parameters:
1138           "error_trace",
1139           "human",
1140           "max_concurrent_searches",
1141           "rest_total_hits_as_int",
1142           "search_type",
1143           "typed_keys"
1144
1145       See the msearch-template docs
1146       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
1147       multi-search.html> for more information.
1148
1149   "explain()"
1150           $response = $e->explain(
1151               index   => 'my_index',  # required
1152               type    => 'my_type',   # required
1153               id      => 123,         # required
1154
1155               body    => { search }   # required
1156           );
1157
1158       The "explain()" method explains why the specified document did or did
1159       not match a query, and how the relevance score was calculated.  For
1160       instance:
1161
1162           $response = $e->explain(
1163               index   => 'my_index',
1164               type    => 'my_type',
1165               id      => 123,
1166               body    => {
1167                   query => {
1168                       match => { title => 'Elasticsearch clients' }
1169                   }
1170               }
1171           );
1172
1173       Query string parameters:
1174           "_source",
1175           "_source_excludes",
1176           "_source_includes",
1177           "analyze_wildcard",
1178           "analyzer",
1179           "default_operator",
1180           "df",
1181           "error_trace",
1182           "human",
1183           "lenient",
1184           "parent",
1185           "preference",
1186           "q",
1187           "routing",
1188           "stored_fields"
1189
1190       See the explain docs
1191       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
1192       explain.html> for more information.
1193
1194   "field_caps()"
1195           $response = $e->field_caps(
1196               index   => 'index'   | \@indices,   # optional
1197               body    => { filters }              # optional
1198           );
1199
1200       The "field-caps" API returns field types and abilities, merged across
1201       indices.
1202
1203       Query string parameters:
1204           "allow_no_indices",
1205           "error_trace",
1206           "expand_wildcards",
1207           "fields",
1208           "human",
1209           "ignore_unavailable"
1210
1211       See the field-caps docs
1212       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
1213       field-caps.html> for more information.
1214
1215   "search_shards()"
1216           $response = $e->search_shards(
1217               index   => 'index' | \@indices,     # optional
1218           )
1219
1220       The "search_shards()" method returns information about which shards on
1221       which nodes will execute a search request.
1222
1223       Query string parameters:
1224           "allow_no_indices",
1225           "error_trace",
1226           "expand_wildcards",
1227           "human",
1228           "ignore_unavailable",
1229           "local",
1230           "preference",
1231           "routing"
1232
1233       See the search-shards docs
1234       <http://www.elastic.co/guide/en/elasticsearch/reference/current/search-
1235       shards.html> for more information.
1236
1237   "rank_eval()"
1238           $result = $e->rank_eval(
1239               index   => 'index' | \@indices,     # optional
1240               body    => {...}                    # required
1241           );
1242
1243       The ranking evaluation API provides a way to execute test cases to
1244       determine whether search results are improving or worsening.
1245
1246       Query string parameters:
1247           "allow_no_indices",
1248           "error_trace",
1249           "expand_wildcards",
1250           "filter_path",
1251           "human",
1252           "ignore_unavailable"
1253
1254       See the rank-eval docs
1255       <https://www.elastic.co/guide/en/elasticsearch/reference/current/search-
1256       rank-eval.html> for more information.
1257

CRUD-BY-QUERY METHODS

1259   "delete_by_query()"
1260           $response = $e->delete_by_query(
1261               index   => 'index' | \@indices,     # optional
1262               type    => 'type'  | \@types,       # optional,
1263               body    => { delete-by-query }      # required
1264           );
1265
1266       The "delete_by_query()" method deletes all documents which match the
1267       specified query.
1268
1269       Query string parameters:
1270           "_source",
1271           "_source_excludes",
1272           "_source_includes",
1273           "allow_no_indices",
1274           "analyze_wildcard",
1275           "analyzer",
1276           "conflicts",
1277           "default_operator",
1278           "df",
1279           "error_trace",
1280           "expand_wildcards",
1281           "from",
1282           "human",
1283           "ignore_unavailable",
1284           "lenient",
1285           "preference",
1286           "q",
1287           "refresh",
1288           "request_cache",
1289           "requests_per_second",
1290           "routing",
1291           "scroll",
1292           "scroll_size",
1293           "search_timeout",
1294           "search_type",
1295           "size",
1296           "slices",
1297           "sort",
1298           "stats",
1299           "terminate_after",
1300           "version",
1301           "timeout",
1302           "wait_for_active_shards",
1303           "wait_for_completion"
1304
1305       See the delete-by-query docs
1306       <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
1307       delete-by-query.html> for more information.
1308
1309   "delete_by_query_rethrottle()"
1310           $response = $e->delete_by_query_rethrottle(
1311               task_id             => 'id'         # required
1312               requests_per_second => num
1313           );
1314
1315       The "delete_by_query_rethrottle()" API is used to dynamically update
1316       the throtting of an existing delete-by-query request, identified by
1317       "task_id".
1318
1319       Query string parameters:
1320           "error_trace",
1321           "filter_path",
1322           "human",
1323           "requests_per_second"
1324
1325       See the delete-by-query-rethrottle docs
1326       <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
1327       delete-by-query.html> for more information.
1328
1329   "reindex()"
1330           $response = $e->reindex(
1331               body => { reindex }     # required
1332           );
1333
1334       The "reindex()" API is used to index documents from one index or
1335       multiple indices to a new index.
1336
1337       Query string parameters:
1338           "error_trace",
1339           "human",
1340           "refresh",
1341           "requests_per_second",
1342           "slices",
1343           "timeout",
1344           "wait_for_active_shards",
1345           "wait_for_completion"
1346
1347       See the reindex docs
1348       <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
1349       reindex.html> for more information.
1350
1351   "reindex_rethrottle()"
1352           $response = $e->delete_by_query_rethrottle(
1353               task_id => 'id',            # required
1354               requests_per_second => num
1355           );
1356
1357       The "reindex_rethrottle()" API is used to dynamically update the
1358       throtting of an existing reindex request, identified by "task_id".
1359
1360       Query string parameters:
1361           "error_trace",
1362           "filter_path",
1363           "human",
1364           "requests_per_second"
1365
1366       See the reindex-rethrottle docs
1367       <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
1368       reindex.html> for more information.
1369
1370   "update_by_query()"
1371           $response = $e->update_by_query(
1372               index   => 'index' | \@indices,     # optional
1373               type    => 'type'  | \@types,       # optional,
1374               body    => { update-by-query }      # optional
1375           );
1376
1377       The "update_by_query()" API is used to bulk update documents from one
1378       index or multiple indices using a script.
1379
1380       Query string parameters:
1381           "_source",
1382           "_source_excludes",
1383           "_source_includes",
1384           "allow_no_indices",
1385           "analyze_wildcard",
1386           "analyzer",
1387           "conflicts",
1388           "default_operator",
1389           "df",
1390           "error_trace",
1391           "expand_wildcards",
1392           "from",
1393           "human",
1394           "ignore_unavailable",
1395           "lenient",
1396           "pipeline",
1397           "preference",
1398           "q",
1399           "refresh",
1400           "request_cache",
1401           "requests_per_second",
1402           "routing",
1403           "scroll",
1404           "scroll_size",
1405           "search_timeout",
1406           "search_type",
1407           "size",
1408           "slices",
1409           "sort",
1410           "stats",
1411           "terminate_after",
1412           "timeout",
1413           "version",
1414           "version_type",
1415           "wait_for_active_shards",
1416           "wait_for_completion"
1417
1418       See the update_by_query docs
1419       <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
1420       update-by-query.html> for more information.
1421
1422   "update_by_query_rethrottle()"
1423           $response = $e->update_by_query_rethrottle(
1424               task_id             => 'id'         # required
1425               requests_per_second => num
1426           );
1427
1428       The "update_by_query_rethrottle()" API is used to dynamically update
1429       the throtting of an existing update-by-query request, identified by
1430       "task_id".
1431
1432       Query string parameters:
1433           "error_trace",
1434           "filter_path",
1435           "human",
1436           "requests_per_second"
1437
1438       See the update-by-query-rethrottle docs
1439       <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
1440       update-by-query.html> for more information.
1441

INDEXED SCRIPT METHODS

1443       Elasticsearch allows you to store scripts in the cluster state and
1444       reference them by id. The methods to manage indexed scripts are as
1445       follows:
1446
1447   "put_script()"
1448           $result  = $e->put_script(
1449               id      => 'id',       # required
1450               context => $context,   # optional
1451               body    => { script }  # required
1452           );
1453
1454       The "put_script()" method is used to store a script in the cluster
1455       state. For instance:
1456
1457           $result  = $e->put_scripts(
1458               id   => 'hello_world',
1459               body => {
1460                 script => {
1461                   lang   => 'painless',
1462                   source => q(return "hello world")
1463                 }
1464               }
1465           );
1466
1467       Query string parameters:
1468           "error_trace",
1469           "human"
1470
1471       See the indexed scripts docs
1472       <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-
1473       scripting.html#_indexed_scripts> for more.
1474
1475   "get_script()"
1476           $script = $e->get_script(
1477               id   => 'id',       # required
1478           );
1479
1480       Retrieve the indexed script from the cluster state.
1481
1482       Query string parameters:
1483           "error_trace",
1484           "human",
1485           "master_timeout"
1486
1487       See the indexed scripts docs
1488       <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-
1489       scripting.html#_indexed_scripts> for more.
1490
1491   "delete_script()"
1492           $script = $e->delete_script(
1493               id   => 'id',       # required
1494           );
1495
1496       Delete the indexed script from the cluster state.
1497
1498       Query string parameters:
1499           "error_trace",
1500           "human",
1501           "master_timeout",
1502           "timeout"
1503
1504       See the indexed scripts docs
1505       <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-
1506       scripting.html#_indexed_scripts> for more.
1507
1508   "scripts_painless_execute()"
1509           $result = $e->scripts_painless_execute(
1510               body => {...}   # required
1511           );
1512
1513       The Painless execute API allows an arbitrary script to be executed and
1514       a result to be returned.
1515
1516       Query string parameters:
1517           "error_trace",
1518           "filter_path",
1519           "human"
1520
1521       See the painless execution docs
1522       <https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-
1523       execute-api.html> for more.
1524

AUTHOR

1526       Enrico Zimuel <enrico.zimuel@elastic.co>
1527
1529       This software is Copyright (c) 2020 by Elasticsearch BV.
1530
1531       This is free software, licensed under:
1532
1533         The Apache License, Version 2.0, January 2004
1534
1535
1536
1537perl v5.32.1                     S2e0a2r1c-h0:1:-E2l7asticsearch::Client::7_0::Direct(3)
Impressum