1Search::Elasticsearch::UTsrearnsCpoonrttr(i3b)uted PerlSDeoacrucmhe:n:tEaltaisotnicsearch::Transport(3)
2
3
4
6 Search::Elasticsearch::Transport - Provides interface between the
7 client class and the Elasticsearch cluster
8
10 version 7.30
11
13 The Transport class manages the request cycle. It receives parsed
14 requests from the (user-facing) client class, and tries to execute the
15 request on a node in the cluster, retrying a request if necessary.
16
17 This class does Search::Elasticsearch::Role::Transport and
18 Search::Elasticsearch::Role::Is_Sync.
19
21 "send_get_body_as"
22 $e = Search::Elasticsearch->new(
23 send_get_body_as => 'POST'
24 );
25
26 Certain endpoints like "search()" in
27 Search::Elasticsearch::Client::6_0::Direct default to using a "GET"
28 method, even when they include a request body. Some proxy servers do
29 not support "GET" requests with a body. To work around this, the
30 "send_get_body_as" parameter accepts the following:
31
32 • "GET"
33
34 The default. Request bodies are sent as "GET" requests.
35
36 • "POST"
37
38 The method is changed to "POST" when a body is present.
39
40 • "source"
41
42 The body is encoded as JSON and added to the query string as the
43 "source" parameter. This has the advantage of still being a "GET"
44 request (for those filtering on request method) but has the
45 disadvantage of being restricted in size. The limit depends on the
46 proxies between the client and Elasticsearch, but usually is around
47 4kB.
48
50 "perform_request()"
51 Raw requests can be executed using the transport class as follows:
52
53 $result = $e->transport->perform_request(
54 method => 'POST',
55 path => '/_search',
56 qs => { from => 0, size => 10 },
57 body => {
58 query => {
59 match => {
60 title => "Elasticsearch clients"
61 }
62 }
63 }
64 );
65
66 Other than the "method", "path", "qs" and "body" parameters, which
67 should be self-explanatory, it also accepts:
68
69 "ignore"
70 The HTTP error codes which should be ignored instead of throwing an
71 error, eg "404 NOT FOUND":
72
73 $result = $e->transport->perform_request(
74 method => 'GET',
75 path => '/index/type/id'
76 ignore => [404],
77 );
78
79 "serialize"
80 Whether the "body" should be serialized in the standard way (as
81 plain JSON) or using the special bulk format: "std" or "bulk".
82
84 Enrico Zimuel <enrico.zimuel@elastic.co>
85
87 This software is Copyright (c) 2020 by Elasticsearch BV.
88
89 This is free software, licensed under:
90
91 The Apache License, Version 2.0, January 2004
92
93
94
95perl v5.34.0 2021-07-22Search::Elasticsearch::Transport(3)