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

NAME

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

VERSION

10       version 6.81
11

SYNOPSIS

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

CONVENTIONS

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

CONFIGURATION

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

GENERAL METHODS

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

DOCUMENT CRUD METHODS

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

BULK DOCUMENT CRUD METHODS

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

SEARCH METHODS

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

CRUD-BY-QUERY METHODS

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

INDEXED SCRIPT METHODS

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

AUTHOR

1524       Enrico Zimuel <enrico.zimuel@elastic.co>
1525
1527       This software is Copyright (c) 2020 by Elasticsearch BV.
1528
1529       This is free software, licensed under:
1530
1531         The Apache License, Version 2.0, January 2004
1532
1533
1534
1535perl v5.32.0                     S2e0a2r0c-h0:7:-E2l8asticsearch::Client::6_0::Direct(3)
Impressum