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.00
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

DESCRIPTION

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

PREVIOUS VERSIONS OF ELASTICSEARCH

114       This version of the client supports the Elasticsearch 6.0 branch, which
115       is not backwards compatible with earlier branches.
116
117       If you need to talk to a version of Elasticsearch before 6.0.0, please
118       install one of the following modules:
119
120       ·   Search::Elasticsearch::Client::5_0
121
122       ·   Search::Elasticsearch::Client::2_0
123
124       ·   Search::Elasticsearch::Client::1_0
125
126       ·   Search::Elasticsearch::Client::0_90
127

CONVENTIONS

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

CONFIGURATION

219   "bulk_helper_class"
220       The class to use for the "bulk_helper()" method. Defaults to
221       Search::Elasticsearch::Client::6_0::Bulk.
222
223   "scroll_helper_class"
224       The class to use for the "scroll_helper()" method. Defaults to
225       Search::Elasticsearch::Client::6_0::Scroll.
226

GENERAL METHODS

228   "info()"
229           $info = $e->info
230
231       Returns information about the version of Elasticsearch that the
232       responding node is running.
233
234   "ping()"
235           $e->ping
236
237       Pings a node in the cluster and returns 1 if it receives a 200
238       response, otherwise it throws an error.
239
240   "indices()"
241           $indices_client = $e->indices;
242
243       Returns a Search::Elasticsearch::Client::6_0::Direct::Indices object
244       which can be used for managing indices, eg creating, deleting indices,
245       managing mapping, index settings etc.
246
247   "ingest()"
248           $ingest_client = $e->ingest;
249
250       Returns a Search::Elasticsearch::Client::6_0::Direct::Ingest object
251       which can be used for managing ingest pipelines.
252
253   "cluster()"
254           $cluster_client = $e->cluster;
255
256       Returns a Search::Elasticsearch::Client::6_0::Direct::Cluster object
257       which can be used for managing the cluster, eg cluster-wide settings
258       and cluster health.
259
260   "nodes()"
261           $node_client = $e->nodes;
262
263       Returns a Search::Elasticsearch::Client::6_0::Direct::Nodes object
264       which can be used to retrieve node info and stats.
265
266   "snapshot()"
267           $snapshot_client = $e->snapshot;
268
269       Returns a Search::Elasticsearch::Client::6_0::Direct::Snapshot object
270       which is used for managing backup repositories and creating and
271       restoring snapshots.
272
273   "tasks()"
274           $tasks_client = $e->tasks;
275
276       Returns a Search::Elasticsearch::Client::6_0::Direct::Tasks object
277       which is used for accessing the task management API.
278
279   "cat()"
280           $cat_client = $e->cat;
281
282       Returns a Search::Elasticsearch::Client::6_0::Direct::Cat object which
283       can be used to retrieve simple to read text info for debugging and
284       monitoring an Elasticsearch cluster.
285

DOCUMENT CRUD METHODS

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

BULK DOCUMENT CRUD METHODS

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

SEARCH METHODS

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

CRUD-BY-QUERY METHODS

1205   "delete_by_query()"
1206           $response = $e->delete_by_query(
1207               index   => 'index' | \@indices,     # optional
1208               type    => 'type'  | \@types,       # optional,
1209               body    => { delete-by-query }      # required
1210           );
1211
1212       The "delete_by_query()" method deletes all documents which match the
1213       specified query.
1214
1215       Query string parameters:
1216           "_source",
1217           "_source_exclude",
1218           "_source_include",
1219           "allow_no_indices",
1220           "analyze_wildcard",
1221           "analyzer",
1222           "conflicts",
1223           "default_operator",
1224           "df",
1225           "error_trace",
1226           "expand_wildcards",
1227           "from",
1228           "human",
1229           "ignore_unavailable",
1230           "lenient",
1231           "preference",
1232           "q",
1233           "refresh",
1234           "request_cache",
1235           "requests_per_second",
1236           "routing",
1237           "scroll",
1238           "scroll_size",
1239           "search_timeout",
1240           "search_type",
1241           "size",
1242           "slices",
1243           "sort",
1244           "stats",
1245           "terminate_after",
1246           "version",
1247           "timeout",
1248           "wait_for_active_shards",
1249           "wait_for_completion"
1250
1251       See the delete-by-query docs
1252       <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
1253       delete-by-query.html> for more information.
1254
1255   "reindex()"
1256           $response = $e->reindex(
1257               body => { reindex }     # required
1258           );
1259
1260       The "reindex()" API is used to index documents from one index or
1261       multiple indices to a new index.
1262
1263       Query string parameters:
1264           "error_trace",
1265           "human",
1266           "refresh",
1267           "requests_per_second",
1268           "slices",
1269           "timeout",
1270           "wait_for_active_shards",
1271           "wait_for_completion"
1272
1273       See the reindex docs
1274       <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
1275       reindex.html> for more information.
1276
1277   "update_by_query()"
1278           $response = $e->update_by_query(
1279               index   => 'index' | \@indices,     # optional
1280               type    => 'type'  | \@types,       # optional,
1281               body    => { update-by-query }      # optional
1282           );
1283
1284       The "update_by_query()" API is used to bulk update documents from one
1285       index or multiple indices using a script.
1286
1287       Query string parameters:
1288           "_source",
1289           "_source_exclude",
1290           "_source_include",
1291           "allow_no_indices",
1292           "analyze_wildcard",
1293           "analyzer",
1294           "conflicts",
1295           "default_operator",
1296           "df",
1297           "error_trace",
1298           "expand_wildcards",
1299           "from",
1300           "human",
1301           "ignore_unavailable",
1302           "lenient",
1303           "pipeline",
1304           "preference",
1305           "q",
1306           "refresh",
1307           "request_cache",
1308           "requests_per_second",
1309           "routing",
1310           "scroll",
1311           "scroll_size",
1312           "search_timeout",
1313           "search_type",
1314           "size",
1315           "slices",
1316           "sort",
1317           "stats",
1318           "terminate_after",
1319           "timeout",
1320           "version",
1321           "version_type",
1322           "wait_for_active_shards",
1323           "wait_for_completion"
1324
1325       See the update_by_query docs
1326       <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
1327       update-by-query.html> for more information.
1328
1329   "reindex_rethrottle"
1330           $response = $e->reindex_rethrottle(
1331               task_id             => 'task_id',       # required
1332               requests_per_second => $req_per_second
1333           );
1334
1335       The "reindex_rethrottle()" API is used to dynamically update the
1336       throtting of an existing reindex request, identified by "task_id".
1337
1338       Query string parameters:
1339           "error_trace",
1340           "human",
1341           "requests_per_second"
1342
1343       See the reindex docs
1344       <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-
1345       reindex.html> for more information.
1346

INDEXED SCRIPT METHODS

1348       Elasticsearch allows you to store scripts in the cluster state and
1349       reference them by id. The methods to manage indexed scripts are as
1350       follows:
1351
1352   "put_script()"
1353           $result  = $e->put_script(
1354               id      => 'id',       # required
1355               context => $context,   # optional
1356               body    => { script }  # required
1357           );
1358
1359       The "put_script()" method is used to store a script in the cluster
1360       state. For instance:
1361
1362           $result  = $e->put_scripts(
1363               id   => 'hello_world',
1364               body => {
1365                 lang   => 'painless',
1366                 source => q(return "hello world");
1367               }
1368           );
1369
1370       Query string parameters:
1371           "error_trace",
1372           "human"
1373
1374       See the indexed scripts docs
1375       <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-
1376       scripting.html#_indexed_scripts> for more.
1377
1378   "get_script()"
1379           $script = $e->get_script(
1380               id   => 'id',       # required
1381           );
1382
1383       Retrieve the indexed script from the cluster state.
1384
1385       Query string parameters:
1386           "error_trace",
1387           "human"
1388
1389       See the indexed scripts docs
1390       <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-
1391       scripting.html#_indexed_scripts> for more.
1392
1393   "delete_script()"
1394           $script = $e->delete_script(
1395               id   => 'id',       # required
1396           );
1397
1398       Delete the indexed script from the cluster state.
1399
1400       Query string parameters:
1401           "error_trace",
1402           "human",
1403           "master_timeout",
1404           "timeout"
1405
1406       See the indexed scripts docs
1407       <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-
1408       scripting.html#_indexed_scripts> for more.
1409

AUTHOR

1411       Clinton Gormley <drtech@cpan.org>
1412
1414       This software is Copyright (c) 2017 by Elasticsearch BV.
1415
1416       This is free software, licensed under:
1417
1418         The Apache License, Version 2.0, January 2004
1419
1420
1421
1422perl v5.28.1                     S2e0a1r7c-h1:1:-E1l4asticsearch::Client::6_0::Direct(3)
Impressum