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

NAME

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

VERSION

10       version 8.00
11

SYNOPSIS

13       Create a client:
14
15           use Search::Elasticsearch;
16           my $e = Search::Elasticsearch->new(
17               client => '8_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::8_0::Direct class provides the
106       Elasticsearch 8.x compatible client returned by:
107
108           $e = Search::Elasticsearch->new(
109               client => "8_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 8.0 branch, which
123       is not backwards compatible with earlier branches.
124
125       If you need to talk to a version of Elasticsearch before 8.0.0, please
126       install one of the following modules:
127
128       •   Search::Elasticsearch::Client::7_0
129
130       •   Search::Elasticsearch::Client::6_0
131
132       •   Search::Elasticsearch::Client::5_0
133
134       •   Search::Elasticsearch::Client::2_0
135
136       •   Search::Elasticsearch::Client::1_0
137
138       •   Search::Elasticsearch::Client::0_90
139

CONVENTIONS

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

CONFIGURATION

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

GENERAL METHODS

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

DOCUMENT CRUD METHODS

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

BULK DOCUMENT CRUD METHODS

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

SEARCH METHODS

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

CRUD-BY-QUERY METHODS

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

INDEXED SCRIPT METHODS

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

AUTHOR

1527       Enrico Zimuel <enrico.zimuel@elastic.co>
1528
1530       This software is Copyright (c) 2022 by Elasticsearch BV.
1531
1532       This is free software, licensed under:
1533
1534         The Apache License, Version 2.0, January 2004
1535
1536
1537
1538perl v5.38.0                     S2e0a2r3c-h0:7:-E2l1asticsearch::Client::8_0::Direct(3)
Impressum