@@ -19,25 +19,25 @@ |
||
19 | 19 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Client\ClientInterface; |
20 | 20 | class Guzzle implements AdapterInterface |
21 | 21 | { |
22 | - public function setConfig(ClientInterface $client, array $config, array $clientOptions) : ClientInterface |
|
23 | - { |
|
24 | - $guzzleConfig = []; |
|
25 | - foreach ($config as $key => $value) { |
|
26 | - switch ($key) { |
|
27 | - case RequestOptions::SSL_CERT: |
|
28 | - $guzzleConfig[GuzzleOptions::CERT] = $value; |
|
29 | - break; |
|
30 | - case RequestOptions::SSL_KEY: |
|
31 | - $guzzleConfig[GuzzleOptions::SSL_KEY] = $value; |
|
32 | - break; |
|
33 | - case RequestOptions::SSL_VERIFY: |
|
34 | - $guzzleConfig[GuzzleOptions::VERIFY] = $value; |
|
35 | - break; |
|
36 | - case RequestOptions::SSL_CA: |
|
37 | - $guzzleConfig[GuzzleOptions::VERIFY] = $value; |
|
38 | - } |
|
39 | - } |
|
40 | - $class = \get_class($client); |
|
41 | - return new $class(\array_merge($clientOptions, $guzzleConfig)); |
|
42 | - } |
|
22 | + public function setConfig(ClientInterface $client, array $config, array $clientOptions) : ClientInterface |
|
23 | + { |
|
24 | + $guzzleConfig = []; |
|
25 | + foreach ($config as $key => $value) { |
|
26 | + switch ($key) { |
|
27 | + case RequestOptions::SSL_CERT: |
|
28 | + $guzzleConfig[GuzzleOptions::CERT] = $value; |
|
29 | + break; |
|
30 | + case RequestOptions::SSL_KEY: |
|
31 | + $guzzleConfig[GuzzleOptions::SSL_KEY] = $value; |
|
32 | + break; |
|
33 | + case RequestOptions::SSL_VERIFY: |
|
34 | + $guzzleConfig[GuzzleOptions::VERIFY] = $value; |
|
35 | + break; |
|
36 | + case RequestOptions::SSL_CA: |
|
37 | + $guzzleConfig[GuzzleOptions::VERIFY] = $value; |
|
38 | + } |
|
39 | + } |
|
40 | + $class = \get_class($client); |
|
41 | + return new $class(\array_merge($clientOptions, $guzzleConfig)); |
|
42 | + } |
|
43 | 43 | } |
@@ -17,8 +17,7 @@ |
||
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Transport\RequestOptions; |
18 | 18 | use OCA\FullTextSearch_Elasticsearch\Vendor\GuzzleHttp\RequestOptions as GuzzleOptions; |
19 | 19 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Client\ClientInterface; |
20 | -class Guzzle implements AdapterInterface |
|
21 | -{ |
|
20 | +class Guzzle implements AdapterInterface { |
|
22 | 21 | public function setConfig(ClientInterface $client, array $config, array $clientOptions) : ClientInterface |
23 | 22 | { |
24 | 23 | $guzzleConfig = []; |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Transport\Adapter; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Transport\RequestOptions; |
@@ -17,5 +17,5 @@ |
||
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Client\ClientInterface; |
18 | 18 | interface AdapterInterface |
19 | 19 | { |
20 | - public function setConfig(ClientInterface $client, array $config, array $clientOptions) : ClientInterface; |
|
20 | + public function setConfig(ClientInterface $client, array $config, array $clientOptions) : ClientInterface; |
|
21 | 21 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Transport\Adapter; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Client\ClientInterface; |
@@ -15,7 +15,6 @@ |
||
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Transport\Adapter; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Client\ClientInterface; |
18 | -interface AdapterInterface |
|
19 | -{ |
|
18 | +interface AdapterInterface { |
|
20 | 19 | public function setConfig(ClientInterface $client, array $config, array $clientOptions) : ClientInterface; |
21 | 20 | } |
@@ -19,10 +19,10 @@ |
||
19 | 19 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\ResponseInterface; |
20 | 20 | class AsyncOnSuccess implements OnSuccessInterface |
21 | 21 | { |
22 | - public function success(ResponseInterface $response, int $count) : Elasticsearch |
|
23 | - { |
|
24 | - $result = new Elasticsearch(); |
|
25 | - $result->setResponse($response, \true); |
|
26 | - return $result; |
|
27 | - } |
|
22 | + public function success(ResponseInterface $response, int $count) : Elasticsearch |
|
23 | + { |
|
24 | + $result = new Elasticsearch(); |
|
25 | + $result->setResponse($response, \true); |
|
26 | + return $result; |
|
27 | + } |
|
28 | 28 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Transport; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Response\Elasticsearch; |
@@ -17,8 +17,7 @@ |
||
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Response\Elasticsearch; |
18 | 18 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Async\OnSuccessInterface; |
19 | 19 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\ResponseInterface; |
20 | -class AsyncOnSuccess implements OnSuccessInterface |
|
21 | -{ |
|
20 | +class AsyncOnSuccess implements OnSuccessInterface { |
|
22 | 21 | public function success(ResponseInterface $response, int $count) : Elasticsearch |
23 | 22 | { |
24 | 23 | $result = new Elasticsearch(); |
@@ -19,10 +19,10 @@ |
||
19 | 19 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\ResponseInterface; |
20 | 20 | class AsyncOnSuccessNoException implements OnSuccessInterface |
21 | 21 | { |
22 | - public function success(ResponseInterface $response, int $count) : Elasticsearch |
|
23 | - { |
|
24 | - $result = new Elasticsearch(); |
|
25 | - $result->setResponse($response, \false); |
|
26 | - return $result; |
|
27 | - } |
|
22 | + public function success(ResponseInterface $response, int $count) : Elasticsearch |
|
23 | + { |
|
24 | + $result = new Elasticsearch(); |
|
25 | + $result->setResponse($response, \false); |
|
26 | + return $result; |
|
27 | + } |
|
28 | 28 | } |
@@ -17,8 +17,7 @@ |
||
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Response\Elasticsearch; |
18 | 18 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Async\OnSuccessInterface; |
19 | 19 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\ResponseInterface; |
20 | -class AsyncOnSuccessNoException implements OnSuccessInterface |
|
21 | -{ |
|
20 | +class AsyncOnSuccessNoException implements OnSuccessInterface { |
|
22 | 21 | public function success(ResponseInterface $response, int $count) : Elasticsearch |
23 | 22 | { |
24 | 23 | $result = new Elasticsearch(); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Transport; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Response\Elasticsearch; |
@@ -16,20 +16,20 @@ |
||
16 | 16 | |
17 | 17 | final class RequestOptions |
18 | 18 | { |
19 | - /** |
|
20 | - * Enable or sidable the SSL verification |
|
21 | - */ |
|
22 | - public const SSL_VERIFY = 'ssl_verify'; |
|
23 | - /** |
|
24 | - * SSL certificate |
|
25 | - */ |
|
26 | - public const SSL_CERT = 'ssl_cert'; |
|
27 | - /** |
|
28 | - * SSL key |
|
29 | - */ |
|
30 | - public const SSL_KEY = 'ssl_key'; |
|
31 | - /** |
|
32 | - * SSL Certificate Authority (CA) bundle |
|
33 | - */ |
|
34 | - public const SSL_CA = 'ssl_ca'; |
|
19 | + /** |
|
20 | + * Enable or sidable the SSL verification |
|
21 | + */ |
|
22 | + public const SSL_VERIFY = 'ssl_verify'; |
|
23 | + /** |
|
24 | + * SSL certificate |
|
25 | + */ |
|
26 | + public const SSL_CERT = 'ssl_cert'; |
|
27 | + /** |
|
28 | + * SSL key |
|
29 | + */ |
|
30 | + public const SSL_KEY = 'ssl_key'; |
|
31 | + /** |
|
32 | + * SSL Certificate Authority (CA) bundle |
|
33 | + */ |
|
34 | + public const SSL_CA = 'ssl_ca'; |
|
35 | 35 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Transport; |
16 | 16 | |
17 | 17 | final class RequestOptions |
@@ -14,8 +14,7 @@ |
||
14 | 14 | declare (strict_types=1); |
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Transport; |
16 | 16 | |
17 | -final class RequestOptions |
|
18 | -{ |
|
17 | +final class RequestOptions { |
|
19 | 18 | /** |
20 | 19 | * Enable or sidable the SSL verification |
21 | 20 | */ |
@@ -23,60 +23,60 @@ |
||
23 | 23 | */ |
24 | 24 | trait MessageResponseTrait |
25 | 25 | { |
26 | - public function getProtocolVersion() : string |
|
27 | - { |
|
28 | - return $this->response->getProtocolVersion(); |
|
29 | - } |
|
30 | - public function withProtocolVersion($version) : MessageInterface |
|
31 | - { |
|
32 | - return $this->response->withProtocolVersion($version); |
|
33 | - } |
|
34 | - public function getHeaders() : array |
|
35 | - { |
|
36 | - return $this->response->getHeaders(); |
|
37 | - } |
|
38 | - public function hasHeader(string $name) : bool |
|
39 | - { |
|
40 | - return $this->response->hasHeader($name); |
|
41 | - } |
|
42 | - public function getHeader(string $name) : array |
|
43 | - { |
|
44 | - return $this->response->getHeader($name); |
|
45 | - } |
|
46 | - public function getHeaderLine(string $name) : string |
|
47 | - { |
|
48 | - return $this->response->getHeaderLine($name); |
|
49 | - } |
|
50 | - public function withHeader(string $name, $value) : MessageInterface |
|
51 | - { |
|
52 | - return $this->response->withHeader($name, $value); |
|
53 | - } |
|
54 | - public function withAddedHeader(string $name, $value) : MessageInterface |
|
55 | - { |
|
56 | - return $this->response->withAddedHeader($name, $value); |
|
57 | - } |
|
58 | - public function withoutHeader(string $name) : MessageInterface |
|
59 | - { |
|
60 | - return $this->response->withoutHeader($name); |
|
61 | - } |
|
62 | - public function getBody() : StreamInterface |
|
63 | - { |
|
64 | - return $this->response->getBody(); |
|
65 | - } |
|
66 | - public function withBody(StreamInterface $body) : MessageInterface |
|
67 | - { |
|
68 | - return $this->response->withBody($body); |
|
69 | - } |
|
70 | - public function getStatusCode() : int |
|
71 | - { |
|
72 | - return $this->response->getStatusCode(); |
|
73 | - } |
|
74 | - public function withStatus(int $code, string $reasonPhrase = '') : ResponseInterface |
|
75 | - { |
|
76 | - return $this->response->withStatus($code, $reasonPhrase); |
|
77 | - } |
|
78 | - public function getReasonPhrase() : string |
|
79 | - { |
|
80 | - return $this->response->getReasonPhrase(); |
|
81 | - } |
|
26 | + public function getProtocolVersion() : string |
|
27 | + { |
|
28 | + return $this->response->getProtocolVersion(); |
|
29 | + } |
|
30 | + public function withProtocolVersion($version) : MessageInterface |
|
31 | + { |
|
32 | + return $this->response->withProtocolVersion($version); |
|
33 | + } |
|
34 | + public function getHeaders() : array |
|
35 | + { |
|
36 | + return $this->response->getHeaders(); |
|
37 | + } |
|
38 | + public function hasHeader(string $name) : bool |
|
39 | + { |
|
40 | + return $this->response->hasHeader($name); |
|
41 | + } |
|
42 | + public function getHeader(string $name) : array |
|
43 | + { |
|
44 | + return $this->response->getHeader($name); |
|
45 | + } |
|
46 | + public function getHeaderLine(string $name) : string |
|
47 | + { |
|
48 | + return $this->response->getHeaderLine($name); |
|
49 | + } |
|
50 | + public function withHeader(string $name, $value) : MessageInterface |
|
51 | + { |
|
52 | + return $this->response->withHeader($name, $value); |
|
53 | + } |
|
54 | + public function withAddedHeader(string $name, $value) : MessageInterface |
|
55 | + { |
|
56 | + return $this->response->withAddedHeader($name, $value); |
|
57 | + } |
|
58 | + public function withoutHeader(string $name) : MessageInterface |
|
59 | + { |
|
60 | + return $this->response->withoutHeader($name); |
|
61 | + } |
|
62 | + public function getBody() : StreamInterface |
|
63 | + { |
|
64 | + return $this->response->getBody(); |
|
65 | + } |
|
66 | + public function withBody(StreamInterface $body) : MessageInterface |
|
67 | + { |
|
68 | + return $this->response->withBody($body); |
|
69 | + } |
|
70 | + public function getStatusCode() : int |
|
71 | + { |
|
72 | + return $this->response->getStatusCode(); |
|
73 | + } |
|
74 | + public function withStatus(int $code, string $reasonPhrase = '') : ResponseInterface |
|
75 | + { |
|
76 | + return $this->response->withStatus($code, $reasonPhrase); |
|
77 | + } |
|
78 | + public function getReasonPhrase() : string |
|
79 | + { |
|
80 | + return $this->response->getReasonPhrase(); |
|
81 | + } |
|
82 | 82 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Traits; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\MessageInterface; |
@@ -21,8 +21,7 @@ |
||
21 | 21 | * Proxy class for Psr\Http\Message\ResponseInterface using |
22 | 22 | * $this->response as source object |
23 | 23 | */ |
24 | -trait MessageResponseTrait |
|
25 | -{ |
|
24 | +trait MessageResponseTrait { |
|
26 | 25 | public function getProtocolVersion() : string |
27 | 26 | { |
28 | 27 | return $this->response->getProtocolVersion(); |
@@ -61,300 +61,300 @@ |
||
61 | 61 | */ |
62 | 62 | trait NamespaceTrait |
63 | 63 | { |
64 | - /** The endpoint namespace storage */ |
|
65 | - protected array $namespace; |
|
66 | - public function asyncSearch() : AsyncSearch |
|
67 | - { |
|
68 | - if (!isset($this->namespace['AsyncSearch'])) { |
|
69 | - $this->namespace['AsyncSearch'] = new AsyncSearch($this); |
|
70 | - } |
|
71 | - return $this->namespace['AsyncSearch']; |
|
72 | - } |
|
73 | - public function autoscaling() : Autoscaling |
|
74 | - { |
|
75 | - if (!isset($this->namespace['Autoscaling'])) { |
|
76 | - $this->namespace['Autoscaling'] = new Autoscaling($this); |
|
77 | - } |
|
78 | - return $this->namespace['Autoscaling']; |
|
79 | - } |
|
80 | - public function cat() : Cat |
|
81 | - { |
|
82 | - if (!isset($this->namespace['Cat'])) { |
|
83 | - $this->namespace['Cat'] = new Cat($this); |
|
84 | - } |
|
85 | - return $this->namespace['Cat']; |
|
86 | - } |
|
87 | - public function ccr() : Ccr |
|
88 | - { |
|
89 | - if (!isset($this->namespace['Ccr'])) { |
|
90 | - $this->namespace['Ccr'] = new Ccr($this); |
|
91 | - } |
|
92 | - return $this->namespace['Ccr']; |
|
93 | - } |
|
94 | - public function cluster() : Cluster |
|
95 | - { |
|
96 | - if (!isset($this->namespace['Cluster'])) { |
|
97 | - $this->namespace['Cluster'] = new Cluster($this); |
|
98 | - } |
|
99 | - return $this->namespace['Cluster']; |
|
100 | - } |
|
101 | - public function connector() : Connector |
|
102 | - { |
|
103 | - if (!isset($this->namespace['Connector'])) { |
|
104 | - $this->namespace['Connector'] = new Connector($this); |
|
105 | - } |
|
106 | - return $this->namespace['Connector']; |
|
107 | - } |
|
108 | - public function connectorSyncJob() : ConnectorSyncJob |
|
109 | - { |
|
110 | - if (!isset($this->namespace['ConnectorSyncJob'])) { |
|
111 | - $this->namespace['ConnectorSyncJob'] = new ConnectorSyncJob($this); |
|
112 | - } |
|
113 | - return $this->namespace['ConnectorSyncJob']; |
|
114 | - } |
|
115 | - public function danglingIndices() : DanglingIndices |
|
116 | - { |
|
117 | - if (!isset($this->namespace['DanglingIndices'])) { |
|
118 | - $this->namespace['DanglingIndices'] = new DanglingIndices($this); |
|
119 | - } |
|
120 | - return $this->namespace['DanglingIndices']; |
|
121 | - } |
|
122 | - public function enrich() : Enrich |
|
123 | - { |
|
124 | - if (!isset($this->namespace['Enrich'])) { |
|
125 | - $this->namespace['Enrich'] = new Enrich($this); |
|
126 | - } |
|
127 | - return $this->namespace['Enrich']; |
|
128 | - } |
|
129 | - public function eql() : Eql |
|
130 | - { |
|
131 | - if (!isset($this->namespace['Eql'])) { |
|
132 | - $this->namespace['Eql'] = new Eql($this); |
|
133 | - } |
|
134 | - return $this->namespace['Eql']; |
|
135 | - } |
|
136 | - public function esql() : Esql |
|
137 | - { |
|
138 | - if (!isset($this->namespace['Esql'])) { |
|
139 | - $this->namespace['Esql'] = new Esql($this); |
|
140 | - } |
|
141 | - return $this->namespace['Esql']; |
|
142 | - } |
|
143 | - public function features() : Features |
|
144 | - { |
|
145 | - if (!isset($this->namespace['Features'])) { |
|
146 | - $this->namespace['Features'] = new Features($this); |
|
147 | - } |
|
148 | - return $this->namespace['Features']; |
|
149 | - } |
|
150 | - public function fleet() : Fleet |
|
151 | - { |
|
152 | - if (!isset($this->namespace['Fleet'])) { |
|
153 | - $this->namespace['Fleet'] = new Fleet($this); |
|
154 | - } |
|
155 | - return $this->namespace['Fleet']; |
|
156 | - } |
|
157 | - public function graph() : Graph |
|
158 | - { |
|
159 | - if (!isset($this->namespace['Graph'])) { |
|
160 | - $this->namespace['Graph'] = new Graph($this); |
|
161 | - } |
|
162 | - return $this->namespace['Graph']; |
|
163 | - } |
|
164 | - public function ilm() : Ilm |
|
165 | - { |
|
166 | - if (!isset($this->namespace['Ilm'])) { |
|
167 | - $this->namespace['Ilm'] = new Ilm($this); |
|
168 | - } |
|
169 | - return $this->namespace['Ilm']; |
|
170 | - } |
|
171 | - public function indices() : Indices |
|
172 | - { |
|
173 | - if (!isset($this->namespace['Indices'])) { |
|
174 | - $this->namespace['Indices'] = new Indices($this); |
|
175 | - } |
|
176 | - return $this->namespace['Indices']; |
|
177 | - } |
|
178 | - public function inference() : Inference |
|
179 | - { |
|
180 | - if (!isset($this->namespace['Inference'])) { |
|
181 | - $this->namespace['Inference'] = new Inference($this); |
|
182 | - } |
|
183 | - return $this->namespace['Inference']; |
|
184 | - } |
|
185 | - public function ingest() : Ingest |
|
186 | - { |
|
187 | - if (!isset($this->namespace['Ingest'])) { |
|
188 | - $this->namespace['Ingest'] = new Ingest($this); |
|
189 | - } |
|
190 | - return $this->namespace['Ingest']; |
|
191 | - } |
|
192 | - public function license() : License |
|
193 | - { |
|
194 | - if (!isset($this->namespace['License'])) { |
|
195 | - $this->namespace['License'] = new License($this); |
|
196 | - } |
|
197 | - return $this->namespace['License']; |
|
198 | - } |
|
199 | - public function logstash() : Logstash |
|
200 | - { |
|
201 | - if (!isset($this->namespace['Logstash'])) { |
|
202 | - $this->namespace['Logstash'] = new Logstash($this); |
|
203 | - } |
|
204 | - return $this->namespace['Logstash']; |
|
205 | - } |
|
206 | - public function migration() : Migration |
|
207 | - { |
|
208 | - if (!isset($this->namespace['Migration'])) { |
|
209 | - $this->namespace['Migration'] = new Migration($this); |
|
210 | - } |
|
211 | - return $this->namespace['Migration']; |
|
212 | - } |
|
213 | - public function ml() : Ml |
|
214 | - { |
|
215 | - if (!isset($this->namespace['Ml'])) { |
|
216 | - $this->namespace['Ml'] = new Ml($this); |
|
217 | - } |
|
218 | - return $this->namespace['Ml']; |
|
219 | - } |
|
220 | - public function monitoring() : Monitoring |
|
221 | - { |
|
222 | - if (!isset($this->namespace['Monitoring'])) { |
|
223 | - $this->namespace['Monitoring'] = new Monitoring($this); |
|
224 | - } |
|
225 | - return $this->namespace['Monitoring']; |
|
226 | - } |
|
227 | - public function nodes() : Nodes |
|
228 | - { |
|
229 | - if (!isset($this->namespace['Nodes'])) { |
|
230 | - $this->namespace['Nodes'] = new Nodes($this); |
|
231 | - } |
|
232 | - return $this->namespace['Nodes']; |
|
233 | - } |
|
234 | - public function profiling() : Profiling |
|
235 | - { |
|
236 | - if (!isset($this->namespace['Profiling'])) { |
|
237 | - $this->namespace['Profiling'] = new Profiling($this); |
|
238 | - } |
|
239 | - return $this->namespace['Profiling']; |
|
240 | - } |
|
241 | - public function queryRuleset() : QueryRuleset |
|
242 | - { |
|
243 | - if (!isset($this->namespace['QueryRuleset'])) { |
|
244 | - $this->namespace['QueryRuleset'] = new QueryRuleset($this); |
|
245 | - } |
|
246 | - return $this->namespace['QueryRuleset']; |
|
247 | - } |
|
248 | - public function rollup() : Rollup |
|
249 | - { |
|
250 | - if (!isset($this->namespace['Rollup'])) { |
|
251 | - $this->namespace['Rollup'] = new Rollup($this); |
|
252 | - } |
|
253 | - return $this->namespace['Rollup']; |
|
254 | - } |
|
255 | - public function searchApplication() : SearchApplication |
|
256 | - { |
|
257 | - if (!isset($this->namespace['SearchApplication'])) { |
|
258 | - $this->namespace['SearchApplication'] = new SearchApplication($this); |
|
259 | - } |
|
260 | - return $this->namespace['SearchApplication']; |
|
261 | - } |
|
262 | - public function searchableSnapshots() : SearchableSnapshots |
|
263 | - { |
|
264 | - if (!isset($this->namespace['SearchableSnapshots'])) { |
|
265 | - $this->namespace['SearchableSnapshots'] = new SearchableSnapshots($this); |
|
266 | - } |
|
267 | - return $this->namespace['SearchableSnapshots']; |
|
268 | - } |
|
269 | - public function security() : Security |
|
270 | - { |
|
271 | - if (!isset($this->namespace['Security'])) { |
|
272 | - $this->namespace['Security'] = new Security($this); |
|
273 | - } |
|
274 | - return $this->namespace['Security']; |
|
275 | - } |
|
276 | - public function shutdown() : Shutdown |
|
277 | - { |
|
278 | - if (!isset($this->namespace['Shutdown'])) { |
|
279 | - $this->namespace['Shutdown'] = new Shutdown($this); |
|
280 | - } |
|
281 | - return $this->namespace['Shutdown']; |
|
282 | - } |
|
283 | - public function simulate() : Simulate |
|
284 | - { |
|
285 | - if (!isset($this->namespace['Simulate'])) { |
|
286 | - $this->namespace['Simulate'] = new Simulate($this); |
|
287 | - } |
|
288 | - return $this->namespace['Simulate']; |
|
289 | - } |
|
290 | - public function slm() : Slm |
|
291 | - { |
|
292 | - if (!isset($this->namespace['Slm'])) { |
|
293 | - $this->namespace['Slm'] = new Slm($this); |
|
294 | - } |
|
295 | - return $this->namespace['Slm']; |
|
296 | - } |
|
297 | - public function snapshot() : Snapshot |
|
298 | - { |
|
299 | - if (!isset($this->namespace['Snapshot'])) { |
|
300 | - $this->namespace['Snapshot'] = new Snapshot($this); |
|
301 | - } |
|
302 | - return $this->namespace['Snapshot']; |
|
303 | - } |
|
304 | - public function sql() : Sql |
|
305 | - { |
|
306 | - if (!isset($this->namespace['Sql'])) { |
|
307 | - $this->namespace['Sql'] = new Sql($this); |
|
308 | - } |
|
309 | - return $this->namespace['Sql']; |
|
310 | - } |
|
311 | - public function ssl() : Ssl |
|
312 | - { |
|
313 | - if (!isset($this->namespace['Ssl'])) { |
|
314 | - $this->namespace['Ssl'] = new Ssl($this); |
|
315 | - } |
|
316 | - return $this->namespace['Ssl']; |
|
317 | - } |
|
318 | - public function synonyms() : Synonyms |
|
319 | - { |
|
320 | - if (!isset($this->namespace['Synonyms'])) { |
|
321 | - $this->namespace['Synonyms'] = new Synonyms($this); |
|
322 | - } |
|
323 | - return $this->namespace['Synonyms']; |
|
324 | - } |
|
325 | - public function tasks() : Tasks |
|
326 | - { |
|
327 | - if (!isset($this->namespace['Tasks'])) { |
|
328 | - $this->namespace['Tasks'] = new Tasks($this); |
|
329 | - } |
|
330 | - return $this->namespace['Tasks']; |
|
331 | - } |
|
332 | - public function textStructure() : TextStructure |
|
333 | - { |
|
334 | - if (!isset($this->namespace['TextStructure'])) { |
|
335 | - $this->namespace['TextStructure'] = new TextStructure($this); |
|
336 | - } |
|
337 | - return $this->namespace['TextStructure']; |
|
338 | - } |
|
339 | - public function transform() : Transform |
|
340 | - { |
|
341 | - if (!isset($this->namespace['Transform'])) { |
|
342 | - $this->namespace['Transform'] = new Transform($this); |
|
343 | - } |
|
344 | - return $this->namespace['Transform']; |
|
345 | - } |
|
346 | - public function watcher() : Watcher |
|
347 | - { |
|
348 | - if (!isset($this->namespace['Watcher'])) { |
|
349 | - $this->namespace['Watcher'] = new Watcher($this); |
|
350 | - } |
|
351 | - return $this->namespace['Watcher']; |
|
352 | - } |
|
353 | - public function xpack() : Xpack |
|
354 | - { |
|
355 | - if (!isset($this->namespace['Xpack'])) { |
|
356 | - $this->namespace['Xpack'] = new Xpack($this); |
|
357 | - } |
|
358 | - return $this->namespace['Xpack']; |
|
359 | - } |
|
64 | + /** The endpoint namespace storage */ |
|
65 | + protected array $namespace; |
|
66 | + public function asyncSearch() : AsyncSearch |
|
67 | + { |
|
68 | + if (!isset($this->namespace['AsyncSearch'])) { |
|
69 | + $this->namespace['AsyncSearch'] = new AsyncSearch($this); |
|
70 | + } |
|
71 | + return $this->namespace['AsyncSearch']; |
|
72 | + } |
|
73 | + public function autoscaling() : Autoscaling |
|
74 | + { |
|
75 | + if (!isset($this->namespace['Autoscaling'])) { |
|
76 | + $this->namespace['Autoscaling'] = new Autoscaling($this); |
|
77 | + } |
|
78 | + return $this->namespace['Autoscaling']; |
|
79 | + } |
|
80 | + public function cat() : Cat |
|
81 | + { |
|
82 | + if (!isset($this->namespace['Cat'])) { |
|
83 | + $this->namespace['Cat'] = new Cat($this); |
|
84 | + } |
|
85 | + return $this->namespace['Cat']; |
|
86 | + } |
|
87 | + public function ccr() : Ccr |
|
88 | + { |
|
89 | + if (!isset($this->namespace['Ccr'])) { |
|
90 | + $this->namespace['Ccr'] = new Ccr($this); |
|
91 | + } |
|
92 | + return $this->namespace['Ccr']; |
|
93 | + } |
|
94 | + public function cluster() : Cluster |
|
95 | + { |
|
96 | + if (!isset($this->namespace['Cluster'])) { |
|
97 | + $this->namespace['Cluster'] = new Cluster($this); |
|
98 | + } |
|
99 | + return $this->namespace['Cluster']; |
|
100 | + } |
|
101 | + public function connector() : Connector |
|
102 | + { |
|
103 | + if (!isset($this->namespace['Connector'])) { |
|
104 | + $this->namespace['Connector'] = new Connector($this); |
|
105 | + } |
|
106 | + return $this->namespace['Connector']; |
|
107 | + } |
|
108 | + public function connectorSyncJob() : ConnectorSyncJob |
|
109 | + { |
|
110 | + if (!isset($this->namespace['ConnectorSyncJob'])) { |
|
111 | + $this->namespace['ConnectorSyncJob'] = new ConnectorSyncJob($this); |
|
112 | + } |
|
113 | + return $this->namespace['ConnectorSyncJob']; |
|
114 | + } |
|
115 | + public function danglingIndices() : DanglingIndices |
|
116 | + { |
|
117 | + if (!isset($this->namespace['DanglingIndices'])) { |
|
118 | + $this->namespace['DanglingIndices'] = new DanglingIndices($this); |
|
119 | + } |
|
120 | + return $this->namespace['DanglingIndices']; |
|
121 | + } |
|
122 | + public function enrich() : Enrich |
|
123 | + { |
|
124 | + if (!isset($this->namespace['Enrich'])) { |
|
125 | + $this->namespace['Enrich'] = new Enrich($this); |
|
126 | + } |
|
127 | + return $this->namespace['Enrich']; |
|
128 | + } |
|
129 | + public function eql() : Eql |
|
130 | + { |
|
131 | + if (!isset($this->namespace['Eql'])) { |
|
132 | + $this->namespace['Eql'] = new Eql($this); |
|
133 | + } |
|
134 | + return $this->namespace['Eql']; |
|
135 | + } |
|
136 | + public function esql() : Esql |
|
137 | + { |
|
138 | + if (!isset($this->namespace['Esql'])) { |
|
139 | + $this->namespace['Esql'] = new Esql($this); |
|
140 | + } |
|
141 | + return $this->namespace['Esql']; |
|
142 | + } |
|
143 | + public function features() : Features |
|
144 | + { |
|
145 | + if (!isset($this->namespace['Features'])) { |
|
146 | + $this->namespace['Features'] = new Features($this); |
|
147 | + } |
|
148 | + return $this->namespace['Features']; |
|
149 | + } |
|
150 | + public function fleet() : Fleet |
|
151 | + { |
|
152 | + if (!isset($this->namespace['Fleet'])) { |
|
153 | + $this->namespace['Fleet'] = new Fleet($this); |
|
154 | + } |
|
155 | + return $this->namespace['Fleet']; |
|
156 | + } |
|
157 | + public function graph() : Graph |
|
158 | + { |
|
159 | + if (!isset($this->namespace['Graph'])) { |
|
160 | + $this->namespace['Graph'] = new Graph($this); |
|
161 | + } |
|
162 | + return $this->namespace['Graph']; |
|
163 | + } |
|
164 | + public function ilm() : Ilm |
|
165 | + { |
|
166 | + if (!isset($this->namespace['Ilm'])) { |
|
167 | + $this->namespace['Ilm'] = new Ilm($this); |
|
168 | + } |
|
169 | + return $this->namespace['Ilm']; |
|
170 | + } |
|
171 | + public function indices() : Indices |
|
172 | + { |
|
173 | + if (!isset($this->namespace['Indices'])) { |
|
174 | + $this->namespace['Indices'] = new Indices($this); |
|
175 | + } |
|
176 | + return $this->namespace['Indices']; |
|
177 | + } |
|
178 | + public function inference() : Inference |
|
179 | + { |
|
180 | + if (!isset($this->namespace['Inference'])) { |
|
181 | + $this->namespace['Inference'] = new Inference($this); |
|
182 | + } |
|
183 | + return $this->namespace['Inference']; |
|
184 | + } |
|
185 | + public function ingest() : Ingest |
|
186 | + { |
|
187 | + if (!isset($this->namespace['Ingest'])) { |
|
188 | + $this->namespace['Ingest'] = new Ingest($this); |
|
189 | + } |
|
190 | + return $this->namespace['Ingest']; |
|
191 | + } |
|
192 | + public function license() : License |
|
193 | + { |
|
194 | + if (!isset($this->namespace['License'])) { |
|
195 | + $this->namespace['License'] = new License($this); |
|
196 | + } |
|
197 | + return $this->namespace['License']; |
|
198 | + } |
|
199 | + public function logstash() : Logstash |
|
200 | + { |
|
201 | + if (!isset($this->namespace['Logstash'])) { |
|
202 | + $this->namespace['Logstash'] = new Logstash($this); |
|
203 | + } |
|
204 | + return $this->namespace['Logstash']; |
|
205 | + } |
|
206 | + public function migration() : Migration |
|
207 | + { |
|
208 | + if (!isset($this->namespace['Migration'])) { |
|
209 | + $this->namespace['Migration'] = new Migration($this); |
|
210 | + } |
|
211 | + return $this->namespace['Migration']; |
|
212 | + } |
|
213 | + public function ml() : Ml |
|
214 | + { |
|
215 | + if (!isset($this->namespace['Ml'])) { |
|
216 | + $this->namespace['Ml'] = new Ml($this); |
|
217 | + } |
|
218 | + return $this->namespace['Ml']; |
|
219 | + } |
|
220 | + public function monitoring() : Monitoring |
|
221 | + { |
|
222 | + if (!isset($this->namespace['Monitoring'])) { |
|
223 | + $this->namespace['Monitoring'] = new Monitoring($this); |
|
224 | + } |
|
225 | + return $this->namespace['Monitoring']; |
|
226 | + } |
|
227 | + public function nodes() : Nodes |
|
228 | + { |
|
229 | + if (!isset($this->namespace['Nodes'])) { |
|
230 | + $this->namespace['Nodes'] = new Nodes($this); |
|
231 | + } |
|
232 | + return $this->namespace['Nodes']; |
|
233 | + } |
|
234 | + public function profiling() : Profiling |
|
235 | + { |
|
236 | + if (!isset($this->namespace['Profiling'])) { |
|
237 | + $this->namespace['Profiling'] = new Profiling($this); |
|
238 | + } |
|
239 | + return $this->namespace['Profiling']; |
|
240 | + } |
|
241 | + public function queryRuleset() : QueryRuleset |
|
242 | + { |
|
243 | + if (!isset($this->namespace['QueryRuleset'])) { |
|
244 | + $this->namespace['QueryRuleset'] = new QueryRuleset($this); |
|
245 | + } |
|
246 | + return $this->namespace['QueryRuleset']; |
|
247 | + } |
|
248 | + public function rollup() : Rollup |
|
249 | + { |
|
250 | + if (!isset($this->namespace['Rollup'])) { |
|
251 | + $this->namespace['Rollup'] = new Rollup($this); |
|
252 | + } |
|
253 | + return $this->namespace['Rollup']; |
|
254 | + } |
|
255 | + public function searchApplication() : SearchApplication |
|
256 | + { |
|
257 | + if (!isset($this->namespace['SearchApplication'])) { |
|
258 | + $this->namespace['SearchApplication'] = new SearchApplication($this); |
|
259 | + } |
|
260 | + return $this->namespace['SearchApplication']; |
|
261 | + } |
|
262 | + public function searchableSnapshots() : SearchableSnapshots |
|
263 | + { |
|
264 | + if (!isset($this->namespace['SearchableSnapshots'])) { |
|
265 | + $this->namespace['SearchableSnapshots'] = new SearchableSnapshots($this); |
|
266 | + } |
|
267 | + return $this->namespace['SearchableSnapshots']; |
|
268 | + } |
|
269 | + public function security() : Security |
|
270 | + { |
|
271 | + if (!isset($this->namespace['Security'])) { |
|
272 | + $this->namespace['Security'] = new Security($this); |
|
273 | + } |
|
274 | + return $this->namespace['Security']; |
|
275 | + } |
|
276 | + public function shutdown() : Shutdown |
|
277 | + { |
|
278 | + if (!isset($this->namespace['Shutdown'])) { |
|
279 | + $this->namespace['Shutdown'] = new Shutdown($this); |
|
280 | + } |
|
281 | + return $this->namespace['Shutdown']; |
|
282 | + } |
|
283 | + public function simulate() : Simulate |
|
284 | + { |
|
285 | + if (!isset($this->namespace['Simulate'])) { |
|
286 | + $this->namespace['Simulate'] = new Simulate($this); |
|
287 | + } |
|
288 | + return $this->namespace['Simulate']; |
|
289 | + } |
|
290 | + public function slm() : Slm |
|
291 | + { |
|
292 | + if (!isset($this->namespace['Slm'])) { |
|
293 | + $this->namespace['Slm'] = new Slm($this); |
|
294 | + } |
|
295 | + return $this->namespace['Slm']; |
|
296 | + } |
|
297 | + public function snapshot() : Snapshot |
|
298 | + { |
|
299 | + if (!isset($this->namespace['Snapshot'])) { |
|
300 | + $this->namespace['Snapshot'] = new Snapshot($this); |
|
301 | + } |
|
302 | + return $this->namespace['Snapshot']; |
|
303 | + } |
|
304 | + public function sql() : Sql |
|
305 | + { |
|
306 | + if (!isset($this->namespace['Sql'])) { |
|
307 | + $this->namespace['Sql'] = new Sql($this); |
|
308 | + } |
|
309 | + return $this->namespace['Sql']; |
|
310 | + } |
|
311 | + public function ssl() : Ssl |
|
312 | + { |
|
313 | + if (!isset($this->namespace['Ssl'])) { |
|
314 | + $this->namespace['Ssl'] = new Ssl($this); |
|
315 | + } |
|
316 | + return $this->namespace['Ssl']; |
|
317 | + } |
|
318 | + public function synonyms() : Synonyms |
|
319 | + { |
|
320 | + if (!isset($this->namespace['Synonyms'])) { |
|
321 | + $this->namespace['Synonyms'] = new Synonyms($this); |
|
322 | + } |
|
323 | + return $this->namespace['Synonyms']; |
|
324 | + } |
|
325 | + public function tasks() : Tasks |
|
326 | + { |
|
327 | + if (!isset($this->namespace['Tasks'])) { |
|
328 | + $this->namespace['Tasks'] = new Tasks($this); |
|
329 | + } |
|
330 | + return $this->namespace['Tasks']; |
|
331 | + } |
|
332 | + public function textStructure() : TextStructure |
|
333 | + { |
|
334 | + if (!isset($this->namespace['TextStructure'])) { |
|
335 | + $this->namespace['TextStructure'] = new TextStructure($this); |
|
336 | + } |
|
337 | + return $this->namespace['TextStructure']; |
|
338 | + } |
|
339 | + public function transform() : Transform |
|
340 | + { |
|
341 | + if (!isset($this->namespace['Transform'])) { |
|
342 | + $this->namespace['Transform'] = new Transform($this); |
|
343 | + } |
|
344 | + return $this->namespace['Transform']; |
|
345 | + } |
|
346 | + public function watcher() : Watcher |
|
347 | + { |
|
348 | + if (!isset($this->namespace['Watcher'])) { |
|
349 | + $this->namespace['Watcher'] = new Watcher($this); |
|
350 | + } |
|
351 | + return $this->namespace['Watcher']; |
|
352 | + } |
|
353 | + public function xpack() : Xpack |
|
354 | + { |
|
355 | + if (!isset($this->namespace['Xpack'])) { |
|
356 | + $this->namespace['Xpack'] = new Xpack($this); |
|
357 | + } |
|
358 | + return $this->namespace['Xpack']; |
|
359 | + } |
|
360 | 360 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Traits; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Endpoints\AsyncSearch; |
@@ -59,8 +59,7 @@ |
||
59 | 59 | /** |
60 | 60 | * @generated This file is generated, please do not edit |
61 | 61 | */ |
62 | -trait NamespaceTrait |
|
63 | -{ |
|
62 | +trait NamespaceTrait { |
|
64 | 63 | /** The endpoint namespace storage */ |
65 | 64 | protected array $namespace; |
66 | 65 | public function asyncSearch() : AsyncSearch |
@@ -25,1751 +25,1751 @@ |
||
25 | 25 | */ |
26 | 26 | trait ClientEndpointsTrait |
27 | 27 | { |
28 | - /** |
|
29 | - * Allows to perform multiple index/update/delete operations in a single request. |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html |
|
32 | - * |
|
33 | - * @param array{ |
|
34 | - * index: string, // Default index for items which don't provide one |
|
35 | - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
36 | - * refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. |
|
37 | - * routing: string, // Specific routing value |
|
38 | - * timeout: time, // Explicit operation timeout |
|
39 | - * type: string, // Default document type for items which don't provide one |
|
40 | - * _source: list, // True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request |
|
41 | - * _source_excludes: list, // Default list of fields to exclude from the returned _source field, can be overridden on each sub-request |
|
42 | - * _source_includes: list, // Default list of fields to extract and return from the _source field, can be overridden on each sub-request |
|
43 | - * pipeline: string, // The pipeline id to preprocess incoming documents with |
|
44 | - * require_alias: boolean, // Sets require_alias for all incoming documents. Defaults to unset (false) |
|
45 | - * require_data_stream: boolean, // When true, requires the destination to be a data stream (existing or to-be-created). Default is false |
|
46 | - * list_executed_pipelines: boolean, // Sets list_executed_pipelines for all incoming documents. Defaults to unset (false) |
|
47 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
48 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
49 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
50 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
51 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
52 | - * body: array, // (REQUIRED) The operation definition and data (action-data pairs), separated by newlines |
|
53 | - * } $params |
|
54 | - * |
|
55 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
56 | - * @throws ClientResponseException if the status code of response is 4xx |
|
57 | - * @throws ServerResponseException if the status code of response is 5xx |
|
58 | - * |
|
59 | - * @return Elasticsearch|Promise |
|
60 | - */ |
|
61 | - public function bulk(array $params = []) |
|
62 | - { |
|
63 | - $this->checkRequiredParameters(['body'], $params); |
|
64 | - if (isset($params['index'])) { |
|
65 | - $url = '/' . $this->encode($params['index']) . '/_bulk'; |
|
66 | - $method = 'POST'; |
|
67 | - } else { |
|
68 | - $url = '/_bulk'; |
|
69 | - $method = 'POST'; |
|
70 | - } |
|
71 | - $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'type', '_source', '_source_excludes', '_source_includes', 'pipeline', 'require_alias', 'require_data_stream', 'list_executed_pipelines', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
72 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson']; |
|
73 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
74 | - } |
|
75 | - /** |
|
76 | - * Explicitly clears the search context for a scroll. |
|
77 | - * |
|
78 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/clear-scroll-api.html |
|
79 | - * |
|
80 | - * @param array{ |
|
81 | - * scroll_id: list, // A comma-separated list of scroll IDs to clear |
|
82 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
83 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
84 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
85 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
86 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
87 | - * body: array, // A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter |
|
88 | - * } $params |
|
89 | - * |
|
90 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
91 | - * @throws ClientResponseException if the status code of response is 4xx |
|
92 | - * @throws ServerResponseException if the status code of response is 5xx |
|
93 | - * |
|
94 | - * @return Elasticsearch|Promise |
|
95 | - */ |
|
96 | - public function clearScroll(array $params = []) |
|
97 | - { |
|
98 | - if (isset($params['scroll_id'])) { |
|
99 | - $url = '/_search/scroll/' . $this->encode($params['scroll_id']); |
|
100 | - $method = 'DELETE'; |
|
101 | - } else { |
|
102 | - $url = '/_search/scroll'; |
|
103 | - $method = 'DELETE'; |
|
104 | - } |
|
105 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
106 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
107 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
108 | - } |
|
109 | - /** |
|
110 | - * Close a point in time |
|
111 | - * |
|
112 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html |
|
113 | - * |
|
114 | - * @param array{ |
|
115 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
116 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
117 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
118 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
119 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
120 | - * body: array, // a point-in-time id to close |
|
121 | - * } $params |
|
122 | - * |
|
123 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
124 | - * @throws ClientResponseException if the status code of response is 4xx |
|
125 | - * @throws ServerResponseException if the status code of response is 5xx |
|
126 | - * |
|
127 | - * @return Elasticsearch|Promise |
|
128 | - */ |
|
129 | - public function closePointInTime(array $params = []) |
|
130 | - { |
|
131 | - $url = '/_pit'; |
|
132 | - $method = 'DELETE'; |
|
133 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
134 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
135 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
136 | - } |
|
137 | - /** |
|
138 | - * Returns number of documents matching a query. |
|
139 | - * |
|
140 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html |
|
141 | - * |
|
142 | - * @param array{ |
|
143 | - * index: list, // A comma-separated list of indices to restrict the results |
|
144 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
145 | - * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled |
|
146 | - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
147 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
148 | - * min_score: number, // Include only documents with a specific `_score` value in the result |
|
149 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
150 | - * routing: list, // A comma-separated list of specific routing values |
|
151 | - * q: string, // Query in the Lucene query string syntax |
|
152 | - * analyzer: string, // The analyzer to use for the query string |
|
153 | - * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) |
|
154 | - * default_operator: enum, // The default operator for query string query (AND or OR) |
|
155 | - * df: string, // The field to use as default where no field prefix is given in the query string |
|
156 | - * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
157 | - * terminate_after: number, // The maximum count for each shard, upon reaching which the query execution will terminate early |
|
158 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
159 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
160 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
161 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
162 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
163 | - * body: array, // A query to restrict the results specified with the Query DSL (optional) |
|
164 | - * } $params |
|
165 | - * |
|
166 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
167 | - * @throws ClientResponseException if the status code of response is 4xx |
|
168 | - * @throws ServerResponseException if the status code of response is 5xx |
|
169 | - * |
|
170 | - * @return Elasticsearch|Promise |
|
171 | - */ |
|
172 | - public function count(array $params = []) |
|
173 | - { |
|
174 | - if (isset($params['index'])) { |
|
175 | - $url = '/' . $this->encode($params['index']) . '/_count'; |
|
176 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
177 | - } else { |
|
178 | - $url = '/_count'; |
|
179 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
180 | - } |
|
181 | - $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'min_score', 'preference', 'routing', 'q', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'terminate_after', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
182 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
183 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
184 | - } |
|
185 | - /** |
|
186 | - * Creates a new document in the index. |
|
187 | - * |
|
188 | - * Returns a 409 response when a document with a same ID already exists in the index. |
|
189 | - * |
|
190 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html |
|
191 | - * |
|
192 | - * @param array{ |
|
193 | - * id: string, // (REQUIRED) Document ID |
|
194 | - * index: string, // (REQUIRED) The name of the index |
|
195 | - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
196 | - * refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. |
|
197 | - * routing: string, // Specific routing value |
|
198 | - * timeout: time, // Explicit operation timeout |
|
199 | - * version: number, // Explicit version number for concurrency control |
|
200 | - * version_type: enum, // Specific version type |
|
201 | - * pipeline: string, // The pipeline id to preprocess incoming documents with |
|
202 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
203 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
204 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
205 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
206 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
207 | - * body: array, // (REQUIRED) The document |
|
208 | - * } $params |
|
209 | - * |
|
210 | - * @throws MissingParameterException if a required parameter is missing |
|
211 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
212 | - * @throws ClientResponseException if the status code of response is 4xx |
|
213 | - * @throws ServerResponseException if the status code of response is 5xx |
|
214 | - * |
|
215 | - * @return Elasticsearch|Promise |
|
216 | - */ |
|
217 | - public function create(array $params = []) |
|
218 | - { |
|
219 | - $this->checkRequiredParameters(['id', 'index', 'body'], $params); |
|
220 | - $url = '/' . $this->encode($params['index']) . '/_create/' . $this->encode($params['id']); |
|
221 | - $method = 'PUT'; |
|
222 | - $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'pipeline', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
223 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
224 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
225 | - } |
|
226 | - /** |
|
227 | - * Removes a document from the index. |
|
228 | - * |
|
229 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html |
|
230 | - * |
|
231 | - * @param array{ |
|
232 | - * id: string, // (REQUIRED) The document ID |
|
233 | - * index: string, // (REQUIRED) The name of the index |
|
234 | - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
235 | - * refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. |
|
236 | - * routing: string, // Specific routing value |
|
237 | - * timeout: time, // Explicit operation timeout |
|
238 | - * if_seq_no: number, // only perform the delete operation if the last operation that has changed the document has the specified sequence number |
|
239 | - * if_primary_term: number, // only perform the delete operation if the last operation that has changed the document has the specified primary term |
|
240 | - * version: number, // Explicit version number for concurrency control |
|
241 | - * version_type: enum, // Specific version type |
|
242 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
243 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
244 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
245 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
246 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
247 | - * } $params |
|
248 | - * |
|
249 | - * @throws MissingParameterException if a required parameter is missing |
|
250 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
251 | - * @throws ClientResponseException if the status code of response is 4xx |
|
252 | - * @throws ServerResponseException if the status code of response is 5xx |
|
253 | - * |
|
254 | - * @return Elasticsearch|Promise |
|
255 | - */ |
|
256 | - public function delete(array $params = []) |
|
257 | - { |
|
258 | - $this->checkRequiredParameters(['id', 'index'], $params); |
|
259 | - $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); |
|
260 | - $method = 'DELETE'; |
|
261 | - $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
262 | - $headers = ['Accept' => 'application/json']; |
|
263 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
264 | - } |
|
265 | - /** |
|
266 | - * Deletes documents matching the provided query. |
|
267 | - * |
|
268 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html |
|
269 | - * |
|
270 | - * @param array{ |
|
271 | - * index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
272 | - * analyzer: string, // The analyzer to use for the query string |
|
273 | - * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) |
|
274 | - * default_operator: enum, // The default operator for query string query (AND or OR) |
|
275 | - * df: string, // The field to use as default where no field prefix is given in the query string |
|
276 | - * from: number, // Starting offset (default: 0) |
|
277 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
278 | - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
279 | - * conflicts: enum, // What to do when the delete by query hits version conflicts? |
|
280 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
281 | - * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
282 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
283 | - * q: string, // Query in the Lucene query string syntax |
|
284 | - * routing: list, // A comma-separated list of specific routing values |
|
285 | - * scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search |
|
286 | - * search_type: enum, // Search operation type |
|
287 | - * search_timeout: time, // Explicit timeout for each search request. Defaults to no timeout. |
|
288 | - * max_docs: number, // Maximum number of documents to process (default: all documents) |
|
289 | - * sort: list, // A comma-separated list of <field>:<direction> pairs |
|
290 | - * terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. |
|
291 | - * stats: list, // Specific 'tag' of the request for logging and statistical purposes |
|
292 | - * version: boolean, // Specify whether to return document version as part of a hit |
|
293 | - * request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to index level setting |
|
294 | - * refresh: boolean, // Should the affected indexes be refreshed? |
|
295 | - * timeout: time, // Time each individual bulk request should wait for shards that are unavailable. |
|
296 | - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
297 | - * scroll_size: number, // Size on the scroll request powering the delete by query |
|
298 | - * wait_for_completion: boolean, // Should the request should block until the delete by query is complete. |
|
299 | - * requests_per_second: number, // The throttle for this request in sub-requests per second. -1 means no throttle. |
|
300 | - * slices: number|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. |
|
301 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
302 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
303 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
304 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
305 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
306 | - * body: array, // (REQUIRED) The search definition using the Query DSL |
|
307 | - * } $params |
|
308 | - * |
|
309 | - * @throws MissingParameterException if a required parameter is missing |
|
310 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
311 | - * @throws ClientResponseException if the status code of response is 4xx |
|
312 | - * @throws ServerResponseException if the status code of response is 5xx |
|
313 | - * |
|
314 | - * @return Elasticsearch|Promise |
|
315 | - */ |
|
316 | - public function deleteByQuery(array $params = []) |
|
317 | - { |
|
318 | - $this->checkRequiredParameters(['index', 'body'], $params); |
|
319 | - $url = '/' . $this->encode($params['index']) . '/_delete_by_query'; |
|
320 | - $method = 'POST'; |
|
321 | - $url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'max_docs', 'sort', 'terminate_after', 'stats', 'version', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
322 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
323 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
324 | - } |
|
325 | - /** |
|
326 | - * Changes the number of requests per second for a particular Delete By Query operation. |
|
327 | - * |
|
328 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html |
|
329 | - * |
|
330 | - * @param array{ |
|
331 | - * task_id: string, // (REQUIRED) The task id to rethrottle |
|
332 | - * requests_per_second: number, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. |
|
333 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
334 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
335 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
336 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
337 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
338 | - * } $params |
|
339 | - * |
|
340 | - * @throws MissingParameterException if a required parameter is missing |
|
341 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
342 | - * @throws ClientResponseException if the status code of response is 4xx |
|
343 | - * @throws ServerResponseException if the status code of response is 5xx |
|
344 | - * |
|
345 | - * @return Elasticsearch|Promise |
|
346 | - */ |
|
347 | - public function deleteByQueryRethrottle(array $params = []) |
|
348 | - { |
|
349 | - $this->checkRequiredParameters(['task_id', 'requests_per_second'], $params); |
|
350 | - $url = '/_delete_by_query/' . $this->encode($params['task_id']) . '/_rethrottle'; |
|
351 | - $method = 'POST'; |
|
352 | - $url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
353 | - $headers = ['Accept' => 'application/json']; |
|
354 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
355 | - } |
|
356 | - /** |
|
357 | - * Deletes a script. |
|
358 | - * |
|
359 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html |
|
360 | - * |
|
361 | - * @param array{ |
|
362 | - * id: string, // (REQUIRED) Script ID |
|
363 | - * timeout: time, // Explicit operation timeout |
|
364 | - * master_timeout: time, // Specify timeout for connection to master |
|
365 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
366 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
367 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
368 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
369 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
370 | - * } $params |
|
371 | - * |
|
372 | - * @throws MissingParameterException if a required parameter is missing |
|
373 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
374 | - * @throws ClientResponseException if the status code of response is 4xx |
|
375 | - * @throws ServerResponseException if the status code of response is 5xx |
|
376 | - * |
|
377 | - * @return Elasticsearch|Promise |
|
378 | - */ |
|
379 | - public function deleteScript(array $params = []) |
|
380 | - { |
|
381 | - $this->checkRequiredParameters(['id'], $params); |
|
382 | - $url = '/_scripts/' . $this->encode($params['id']); |
|
383 | - $method = 'DELETE'; |
|
384 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
385 | - $headers = ['Accept' => 'application/json']; |
|
386 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
387 | - } |
|
388 | - /** |
|
389 | - * Returns information about whether a document exists in an index. |
|
390 | - * |
|
391 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html |
|
392 | - * |
|
393 | - * @param array{ |
|
394 | - * id: string, // (REQUIRED) The document ID |
|
395 | - * index: string, // (REQUIRED) The name of the index |
|
396 | - * stored_fields: list, // A comma-separated list of stored fields to return in the response |
|
397 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
398 | - * realtime: boolean, // Specify whether to perform the operation in realtime or search mode |
|
399 | - * refresh: boolean, // Refresh the shard containing the document before performing the operation |
|
400 | - * routing: string, // Specific routing value |
|
401 | - * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
402 | - * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
403 | - * _source_includes: list, // A list of fields to extract and return from the _source field |
|
404 | - * version: number, // Explicit version number for concurrency control |
|
405 | - * version_type: enum, // Specific version type |
|
406 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
407 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
408 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
409 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
410 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
411 | - * } $params |
|
412 | - * |
|
413 | - * @throws MissingParameterException if a required parameter is missing |
|
414 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
415 | - * @throws ClientResponseException if the status code of response is 4xx |
|
416 | - * @throws ServerResponseException if the status code of response is 5xx |
|
417 | - * |
|
418 | - * @return Elasticsearch|Promise |
|
419 | - */ |
|
420 | - public function exists(array $params = []) |
|
421 | - { |
|
422 | - $this->checkRequiredParameters(['id', 'index'], $params); |
|
423 | - $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); |
|
424 | - $method = 'HEAD'; |
|
425 | - $url = $this->addQueryString($url, $params, ['stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
426 | - $headers = ['Accept' => 'application/json']; |
|
427 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
428 | - } |
|
429 | - /** |
|
430 | - * Returns information about whether a document source exists in an index. |
|
431 | - * |
|
432 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html |
|
433 | - * |
|
434 | - * @param array{ |
|
435 | - * id: string, // (REQUIRED) The document ID |
|
436 | - * index: string, // (REQUIRED) The name of the index |
|
437 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
438 | - * realtime: boolean, // Specify whether to perform the operation in realtime or search mode |
|
439 | - * refresh: boolean, // Refresh the shard containing the document before performing the operation |
|
440 | - * routing: string, // Specific routing value |
|
441 | - * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
442 | - * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
443 | - * _source_includes: list, // A list of fields to extract and return from the _source field |
|
444 | - * version: number, // Explicit version number for concurrency control |
|
445 | - * version_type: enum, // Specific version type |
|
446 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
447 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
448 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
449 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
450 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
451 | - * } $params |
|
452 | - * |
|
453 | - * @throws MissingParameterException if a required parameter is missing |
|
454 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
455 | - * @throws ClientResponseException if the status code of response is 4xx |
|
456 | - * @throws ServerResponseException if the status code of response is 5xx |
|
457 | - * |
|
458 | - * @return Elasticsearch|Promise |
|
459 | - */ |
|
460 | - public function existsSource(array $params = []) |
|
461 | - { |
|
462 | - $this->checkRequiredParameters(['id', 'index'], $params); |
|
463 | - $url = '/' . $this->encode($params['index']) . '/_source/' . $this->encode($params['id']); |
|
464 | - $method = 'HEAD'; |
|
465 | - $url = $this->addQueryString($url, $params, ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
466 | - $headers = ['Accept' => 'application/json']; |
|
467 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
468 | - } |
|
469 | - /** |
|
470 | - * Returns information about why a specific matches (or doesn't match) a query. |
|
471 | - * |
|
472 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html |
|
473 | - * |
|
474 | - * @param array{ |
|
475 | - * id: string, // (REQUIRED) The document ID |
|
476 | - * index: string, // (REQUIRED) The name of the index |
|
477 | - * analyze_wildcard: boolean, // Specify whether wildcards and prefix queries in the query string query should be analyzed (default: false) |
|
478 | - * analyzer: string, // The analyzer for the query string query |
|
479 | - * default_operator: enum, // The default operator for query string query (AND or OR) |
|
480 | - * df: string, // The default field for query string query (default: _all) |
|
481 | - * stored_fields: list, // A comma-separated list of stored fields to return in the response |
|
482 | - * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
483 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
484 | - * q: string, // Query in the Lucene query string syntax |
|
485 | - * routing: string, // Specific routing value |
|
486 | - * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
487 | - * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
488 | - * _source_includes: list, // A list of fields to extract and return from the _source field |
|
489 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
490 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
491 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
492 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
493 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
494 | - * body: array, // The query definition using the Query DSL |
|
495 | - * } $params |
|
496 | - * |
|
497 | - * @throws MissingParameterException if a required parameter is missing |
|
498 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
499 | - * @throws ClientResponseException if the status code of response is 4xx |
|
500 | - * @throws ServerResponseException if the status code of response is 5xx |
|
501 | - * |
|
502 | - * @return Elasticsearch|Promise |
|
503 | - */ |
|
504 | - public function explain(array $params = []) |
|
505 | - { |
|
506 | - $this->checkRequiredParameters(['id', 'index'], $params); |
|
507 | - $url = '/' . $this->encode($params['index']) . '/_explain/' . $this->encode($params['id']); |
|
508 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
509 | - $url = $this->addQueryString($url, $params, ['analyze_wildcard', 'analyzer', 'default_operator', 'df', 'stored_fields', 'lenient', 'preference', 'q', 'routing', '_source', '_source_excludes', '_source_includes', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
510 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
511 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
512 | - } |
|
513 | - /** |
|
514 | - * Returns the information about the capabilities of fields among multiple indices. |
|
515 | - * |
|
516 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html |
|
517 | - * |
|
518 | - * @param array{ |
|
519 | - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
520 | - * fields: list, // A comma-separated list of field names |
|
521 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
522 | - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
523 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
524 | - * include_unmapped: boolean, // Indicates whether unmapped fields should be included in the response. |
|
525 | - * filters: list, // An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent |
|
526 | - * types: list, // Only return results for fields that have one of the types in the list |
|
527 | - * include_empty_fields: boolean, // Include empty fields in result |
|
528 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
529 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
530 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
531 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
532 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
533 | - * body: array, // An index filter specified with the Query DSL |
|
534 | - * } $params |
|
535 | - * |
|
536 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
537 | - * @throws ClientResponseException if the status code of response is 4xx |
|
538 | - * @throws ServerResponseException if the status code of response is 5xx |
|
539 | - * |
|
540 | - * @return Elasticsearch|Promise |
|
541 | - */ |
|
542 | - public function fieldCaps(array $params = []) |
|
543 | - { |
|
544 | - if (isset($params['index'])) { |
|
545 | - $url = '/' . $this->encode($params['index']) . '/_field_caps'; |
|
546 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
547 | - } else { |
|
548 | - $url = '/_field_caps'; |
|
549 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
550 | - } |
|
551 | - $url = $this->addQueryString($url, $params, ['fields', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'include_unmapped', 'filters', 'types', 'include_empty_fields', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
552 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
553 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
554 | - } |
|
555 | - /** |
|
556 | - * Returns a document. |
|
557 | - * |
|
558 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html |
|
559 | - * |
|
560 | - * @param array{ |
|
561 | - * id: string, // (REQUIRED) The document ID |
|
562 | - * index: string, // (REQUIRED) The name of the index |
|
563 | - * force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. |
|
564 | - * stored_fields: list, // A comma-separated list of stored fields to return in the response |
|
565 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
566 | - * realtime: boolean, // Specify whether to perform the operation in realtime or search mode |
|
567 | - * refresh: boolean, // Refresh the shard containing the document before performing the operation |
|
568 | - * routing: string, // Specific routing value |
|
569 | - * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
570 | - * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
571 | - * _source_includes: list, // A list of fields to extract and return from the _source field |
|
572 | - * version: number, // Explicit version number for concurrency control |
|
573 | - * version_type: enum, // Specific version type |
|
574 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
575 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
576 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
577 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
578 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
579 | - * } $params |
|
580 | - * |
|
581 | - * @throws MissingParameterException if a required parameter is missing |
|
582 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
583 | - * @throws ClientResponseException if the status code of response is 4xx |
|
584 | - * @throws ServerResponseException if the status code of response is 5xx |
|
585 | - * |
|
586 | - * @return Elasticsearch|Promise |
|
587 | - */ |
|
588 | - public function get(array $params = []) |
|
589 | - { |
|
590 | - $this->checkRequiredParameters(['id', 'index'], $params); |
|
591 | - $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); |
|
592 | - $method = 'GET'; |
|
593 | - $url = $this->addQueryString($url, $params, ['force_synthetic_source', 'stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
594 | - $headers = ['Accept' => 'application/json']; |
|
595 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
596 | - } |
|
597 | - /** |
|
598 | - * Returns a script. |
|
599 | - * |
|
600 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html |
|
601 | - * |
|
602 | - * @param array{ |
|
603 | - * id: string, // (REQUIRED) Script ID |
|
604 | - * master_timeout: time, // Specify timeout for connection to master |
|
605 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
606 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
607 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
608 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
609 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
610 | - * } $params |
|
611 | - * |
|
612 | - * @throws MissingParameterException if a required parameter is missing |
|
613 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
614 | - * @throws ClientResponseException if the status code of response is 4xx |
|
615 | - * @throws ServerResponseException if the status code of response is 5xx |
|
616 | - * |
|
617 | - * @return Elasticsearch|Promise |
|
618 | - */ |
|
619 | - public function getScript(array $params = []) |
|
620 | - { |
|
621 | - $this->checkRequiredParameters(['id'], $params); |
|
622 | - $url = '/_scripts/' . $this->encode($params['id']); |
|
623 | - $method = 'GET'; |
|
624 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
625 | - $headers = ['Accept' => 'application/json']; |
|
626 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
627 | - } |
|
628 | - /** |
|
629 | - * Returns all script contexts. |
|
630 | - * |
|
631 | - * @see https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-contexts.html |
|
632 | - * |
|
633 | - * @param array{ |
|
634 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
635 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
636 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
637 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
638 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
639 | - * } $params |
|
640 | - * |
|
641 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
642 | - * @throws ClientResponseException if the status code of response is 4xx |
|
643 | - * @throws ServerResponseException if the status code of response is 5xx |
|
644 | - * |
|
645 | - * @return Elasticsearch|Promise |
|
646 | - */ |
|
647 | - public function getScriptContext(array $params = []) |
|
648 | - { |
|
649 | - $url = '/_script_context'; |
|
650 | - $method = 'GET'; |
|
651 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
652 | - $headers = ['Accept' => 'application/json']; |
|
653 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
654 | - } |
|
655 | - /** |
|
656 | - * Returns available script types, languages and contexts |
|
657 | - * |
|
658 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html |
|
659 | - * |
|
660 | - * @param array{ |
|
661 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
662 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
663 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
664 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
665 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
666 | - * } $params |
|
667 | - * |
|
668 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
669 | - * @throws ClientResponseException if the status code of response is 4xx |
|
670 | - * @throws ServerResponseException if the status code of response is 5xx |
|
671 | - * |
|
672 | - * @return Elasticsearch|Promise |
|
673 | - */ |
|
674 | - public function getScriptLanguages(array $params = []) |
|
675 | - { |
|
676 | - $url = '/_script_language'; |
|
677 | - $method = 'GET'; |
|
678 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
679 | - $headers = ['Accept' => 'application/json']; |
|
680 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
681 | - } |
|
682 | - /** |
|
683 | - * Returns the source of a document. |
|
684 | - * |
|
685 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html |
|
686 | - * |
|
687 | - * @param array{ |
|
688 | - * id: string, // (REQUIRED) The document ID |
|
689 | - * index: string, // (REQUIRED) The name of the index |
|
690 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
691 | - * realtime: boolean, // Specify whether to perform the operation in realtime or search mode |
|
692 | - * refresh: boolean, // Refresh the shard containing the document before performing the operation |
|
693 | - * routing: string, // Specific routing value |
|
694 | - * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
695 | - * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
696 | - * _source_includes: list, // A list of fields to extract and return from the _source field |
|
697 | - * version: number, // Explicit version number for concurrency control |
|
698 | - * version_type: enum, // Specific version type |
|
699 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
700 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
701 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
702 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
703 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
704 | - * } $params |
|
705 | - * |
|
706 | - * @throws MissingParameterException if a required parameter is missing |
|
707 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
708 | - * @throws ClientResponseException if the status code of response is 4xx |
|
709 | - * @throws ServerResponseException if the status code of response is 5xx |
|
710 | - * |
|
711 | - * @return Elasticsearch|Promise |
|
712 | - */ |
|
713 | - public function getSource(array $params = []) |
|
714 | - { |
|
715 | - $this->checkRequiredParameters(['id', 'index'], $params); |
|
716 | - $url = '/' . $this->encode($params['index']) . '/_source/' . $this->encode($params['id']); |
|
717 | - $method = 'GET'; |
|
718 | - $url = $this->addQueryString($url, $params, ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
719 | - $headers = ['Accept' => 'application/json']; |
|
720 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
721 | - } |
|
722 | - /** |
|
723 | - * Returns the health of the cluster. |
|
724 | - * |
|
725 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/health-api.html |
|
726 | - * |
|
727 | - * @param array{ |
|
728 | - * feature: string, // A feature of the cluster, as returned by the top-level health API |
|
729 | - * timeout: time, // Explicit operation timeout |
|
730 | - * verbose: boolean, // Opt in for more information about the health of the system |
|
731 | - * size: int, // Limit the number of affected resources the health API returns |
|
732 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
733 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
734 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
735 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
736 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
737 | - * } $params |
|
738 | - * |
|
739 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
740 | - * @throws ClientResponseException if the status code of response is 4xx |
|
741 | - * @throws ServerResponseException if the status code of response is 5xx |
|
742 | - * |
|
743 | - * @return Elasticsearch|Promise |
|
744 | - */ |
|
745 | - public function healthReport(array $params = []) |
|
746 | - { |
|
747 | - if (isset($params['feature'])) { |
|
748 | - $url = '/_health_report/' . $this->encode($params['feature']); |
|
749 | - $method = 'GET'; |
|
750 | - } else { |
|
751 | - $url = '/_health_report'; |
|
752 | - $method = 'GET'; |
|
753 | - } |
|
754 | - $url = $this->addQueryString($url, $params, ['timeout', 'verbose', 'size', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
755 | - $headers = ['Accept' => 'application/json']; |
|
756 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
757 | - } |
|
758 | - /** |
|
759 | - * Creates or updates a document in an index. |
|
760 | - * |
|
761 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html |
|
762 | - * |
|
763 | - * @param array{ |
|
764 | - * id: string, // Document ID |
|
765 | - * index: string, // (REQUIRED) The name of the index |
|
766 | - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
767 | - * op_type: enum, // Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID |
|
768 | - * refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. |
|
769 | - * routing: string, // Specific routing value |
|
770 | - * timeout: time, // Explicit operation timeout |
|
771 | - * version: number, // Explicit version number for concurrency control |
|
772 | - * version_type: enum, // Specific version type |
|
773 | - * if_seq_no: number, // only perform the index operation if the last operation that has changed the document has the specified sequence number |
|
774 | - * if_primary_term: number, // only perform the index operation if the last operation that has changed the document has the specified primary term |
|
775 | - * pipeline: string, // The pipeline id to preprocess incoming documents with |
|
776 | - * require_alias: boolean, // When true, requires destination to be an alias. Default is false |
|
777 | - * require_data_stream: boolean, // When true, requires the destination to be a data stream (existing or to-be-created). Default is false |
|
778 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
779 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
780 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
781 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
782 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
783 | - * body: array, // (REQUIRED) The document |
|
784 | - * } $params |
|
785 | - * |
|
786 | - * @throws MissingParameterException if a required parameter is missing |
|
787 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
788 | - * @throws ClientResponseException if the status code of response is 4xx |
|
789 | - * @throws ServerResponseException if the status code of response is 5xx |
|
790 | - * |
|
791 | - * @return Elasticsearch|Promise |
|
792 | - */ |
|
793 | - public function index(array $params = []) |
|
794 | - { |
|
795 | - $this->checkRequiredParameters(['index', 'body'], $params); |
|
796 | - if (isset($params['id'])) { |
|
797 | - $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); |
|
798 | - $method = 'PUT'; |
|
799 | - } else { |
|
800 | - $url = '/' . $this->encode($params['index']) . '/_doc'; |
|
801 | - $method = 'POST'; |
|
802 | - } |
|
803 | - $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'op_type', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'if_seq_no', 'if_primary_term', 'pipeline', 'require_alias', 'require_data_stream', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
804 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
805 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
806 | - } |
|
807 | - /** |
|
808 | - * Returns basic information about the cluster. |
|
809 | - * |
|
810 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html |
|
811 | - * |
|
812 | - * @param array{ |
|
813 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
814 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
815 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
816 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
817 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
818 | - * } $params |
|
819 | - * |
|
820 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
821 | - * @throws ClientResponseException if the status code of response is 4xx |
|
822 | - * @throws ServerResponseException if the status code of response is 5xx |
|
823 | - * |
|
824 | - * @return Elasticsearch|Promise |
|
825 | - */ |
|
826 | - public function info(array $params = []) |
|
827 | - { |
|
828 | - $url = '/'; |
|
829 | - $method = 'GET'; |
|
830 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
831 | - $headers = ['Accept' => 'application/json']; |
|
832 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
833 | - } |
|
834 | - /** |
|
835 | - * Performs a kNN search. |
|
836 | - * |
|
837 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html |
|
838 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
839 | - * |
|
840 | - * @param array{ |
|
841 | - * index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` to perform the operation on all indices |
|
842 | - * routing: list, // A comma-separated list of specific routing values |
|
843 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
844 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
845 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
846 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
847 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
848 | - * body: array, // The search definition |
|
849 | - * } $params |
|
850 | - * |
|
851 | - * @throws MissingParameterException if a required parameter is missing |
|
852 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
853 | - * @throws ClientResponseException if the status code of response is 4xx |
|
854 | - * @throws ServerResponseException if the status code of response is 5xx |
|
855 | - * |
|
856 | - * @return Elasticsearch|Promise |
|
857 | - */ |
|
858 | - public function knnSearch(array $params = []) |
|
859 | - { |
|
860 | - $this->checkRequiredParameters(['index'], $params); |
|
861 | - $url = '/' . $this->encode($params['index']) . '/_knn_search'; |
|
862 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
863 | - $url = $this->addQueryString($url, $params, ['routing', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
864 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
865 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
866 | - } |
|
867 | - /** |
|
868 | - * Allows to get multiple documents in one request. |
|
869 | - * |
|
870 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html |
|
871 | - * |
|
872 | - * @param array{ |
|
873 | - * index: string, // The name of the index |
|
874 | - * force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. |
|
875 | - * stored_fields: list, // A comma-separated list of stored fields to return in the response |
|
876 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
877 | - * realtime: boolean, // Specify whether to perform the operation in realtime or search mode |
|
878 | - * refresh: boolean, // Refresh the shard containing the document before performing the operation |
|
879 | - * routing: string, // Specific routing value |
|
880 | - * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
881 | - * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
882 | - * _source_includes: list, // A list of fields to extract and return from the _source field |
|
883 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
884 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
885 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
886 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
887 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
888 | - * body: array, // (REQUIRED) Document identifiers; can be either `docs` (containing full document information) or `ids` (when index is provided in the URL. |
|
889 | - * } $params |
|
890 | - * |
|
891 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
892 | - * @throws ClientResponseException if the status code of response is 4xx |
|
893 | - * @throws ServerResponseException if the status code of response is 5xx |
|
894 | - * |
|
895 | - * @return Elasticsearch|Promise |
|
896 | - */ |
|
897 | - public function mget(array $params = []) |
|
898 | - { |
|
899 | - $this->checkRequiredParameters(['body'], $params); |
|
900 | - if (isset($params['index'])) { |
|
901 | - $url = '/' . $this->encode($params['index']) . '/_mget'; |
|
902 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
903 | - } else { |
|
904 | - $url = '/_mget'; |
|
905 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
906 | - } |
|
907 | - $url = $this->addQueryString($url, $params, ['force_synthetic_source', 'stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
908 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
909 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
910 | - } |
|
911 | - /** |
|
912 | - * Allows to execute several search operations in one request. |
|
913 | - * |
|
914 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html |
|
915 | - * |
|
916 | - * @param array{ |
|
917 | - * index: list, // A comma-separated list of index names to use as default |
|
918 | - * search_type: enum, // Search operation type |
|
919 | - * max_concurrent_searches: number, // Controls the maximum number of concurrent searches the multi search api will execute |
|
920 | - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
921 | - * pre_filter_shard_size: number, // A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. |
|
922 | - * max_concurrent_shard_requests: number, // The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests |
|
923 | - * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response |
|
924 | - * ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution |
|
925 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
926 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
927 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
928 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
929 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
930 | - * body: array, // (REQUIRED) The request definitions (metadata-search request definition pairs), separated by newlines |
|
931 | - * } $params |
|
932 | - * |
|
933 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
934 | - * @throws ClientResponseException if the status code of response is 4xx |
|
935 | - * @throws ServerResponseException if the status code of response is 5xx |
|
936 | - * |
|
937 | - * @return Elasticsearch|Promise |
|
938 | - */ |
|
939 | - public function msearch(array $params = []) |
|
940 | - { |
|
941 | - $this->checkRequiredParameters(['body'], $params); |
|
942 | - if (isset($params['index'])) { |
|
943 | - $url = '/' . $this->encode($params['index']) . '/_msearch'; |
|
944 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
945 | - } else { |
|
946 | - $url = '/_msearch'; |
|
947 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
948 | - } |
|
949 | - $url = $this->addQueryString($url, $params, ['search_type', 'max_concurrent_searches', 'typed_keys', 'pre_filter_shard_size', 'max_concurrent_shard_requests', 'rest_total_hits_as_int', 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
950 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson']; |
|
951 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
952 | - } |
|
953 | - /** |
|
954 | - * Allows to execute several search template operations in one request. |
|
955 | - * |
|
956 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html |
|
957 | - * |
|
958 | - * @param array{ |
|
959 | - * index: list, // A comma-separated list of index names to use as default |
|
960 | - * search_type: enum, // Search operation type |
|
961 | - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
962 | - * max_concurrent_searches: number, // Controls the maximum number of concurrent searches the multi search api will execute |
|
963 | - * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response |
|
964 | - * ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution |
|
965 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
966 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
967 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
968 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
969 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
970 | - * body: array, // (REQUIRED) The request definitions (metadata-search request definition pairs), separated by newlines |
|
971 | - * } $params |
|
972 | - * |
|
973 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
974 | - * @throws ClientResponseException if the status code of response is 4xx |
|
975 | - * @throws ServerResponseException if the status code of response is 5xx |
|
976 | - * |
|
977 | - * @return Elasticsearch|Promise |
|
978 | - */ |
|
979 | - public function msearchTemplate(array $params = []) |
|
980 | - { |
|
981 | - $this->checkRequiredParameters(['body'], $params); |
|
982 | - if (isset($params['index'])) { |
|
983 | - $url = '/' . $this->encode($params['index']) . '/_msearch/template'; |
|
984 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
985 | - } else { |
|
986 | - $url = '/_msearch/template'; |
|
987 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
988 | - } |
|
989 | - $url = $this->addQueryString($url, $params, ['search_type', 'typed_keys', 'max_concurrent_searches', 'rest_total_hits_as_int', 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
990 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson']; |
|
991 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
992 | - } |
|
993 | - /** |
|
994 | - * Returns multiple termvectors in one request. |
|
995 | - * |
|
996 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html |
|
997 | - * |
|
998 | - * @param array{ |
|
999 | - * index: string, // The index in which the document resides. |
|
1000 | - * ids: list, // A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body |
|
1001 | - * term_statistics: boolean, // Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1002 | - * field_statistics: boolean, // Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1003 | - * fields: list, // A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1004 | - * offsets: boolean, // Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1005 | - * positions: boolean, // Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1006 | - * payloads: boolean, // Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1007 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1008 | - * routing: string, // Specific routing value. Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1009 | - * realtime: boolean, // Specifies if requests are real-time as opposed to near-real-time (default: true). |
|
1010 | - * version: number, // Explicit version number for concurrency control |
|
1011 | - * version_type: enum, // Specific version type |
|
1012 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1013 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1014 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1015 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1016 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1017 | - * body: array, // Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation. |
|
1018 | - * } $params |
|
1019 | - * |
|
1020 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1021 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1022 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1023 | - * |
|
1024 | - * @return Elasticsearch|Promise |
|
1025 | - */ |
|
1026 | - public function mtermvectors(array $params = []) |
|
1027 | - { |
|
1028 | - if (isset($params['index'])) { |
|
1029 | - $url = '/' . $this->encode($params['index']) . '/_mtermvectors'; |
|
1030 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1031 | - } else { |
|
1032 | - $url = '/_mtermvectors'; |
|
1033 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1034 | - } |
|
1035 | - $url = $this->addQueryString($url, $params, ['ids', 'term_statistics', 'field_statistics', 'fields', 'offsets', 'positions', 'payloads', 'preference', 'routing', 'realtime', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1036 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1037 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1038 | - } |
|
1039 | - /** |
|
1040 | - * Open a point in time that can be used in subsequent searches |
|
1041 | - * |
|
1042 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html |
|
1043 | - * |
|
1044 | - * @param array{ |
|
1045 | - * index: list, // (REQUIRED) A comma-separated list of index names to open point in time; use `_all` or empty string to perform the operation on all indices |
|
1046 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
1047 | - * routing: string, // Specific routing value |
|
1048 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1049 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1050 | - * keep_alive: string, // Specific the time to live for the point in time |
|
1051 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1052 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1053 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1054 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1055 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1056 | - * body: array, // An index_filter specified with the Query DSL |
|
1057 | - * } $params |
|
1058 | - * |
|
1059 | - * @throws MissingParameterException if a required parameter is missing |
|
1060 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1061 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1062 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1063 | - * |
|
1064 | - * @return Elasticsearch|Promise |
|
1065 | - */ |
|
1066 | - public function openPointInTime(array $params = []) |
|
1067 | - { |
|
1068 | - $this->checkRequiredParameters(['index', 'keep_alive'], $params); |
|
1069 | - $url = '/' . $this->encode($params['index']) . '/_pit'; |
|
1070 | - $method = 'POST'; |
|
1071 | - $url = $this->addQueryString($url, $params, ['preference', 'routing', 'ignore_unavailable', 'expand_wildcards', 'keep_alive', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1072 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1073 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1074 | - } |
|
1075 | - /** |
|
1076 | - * Returns whether the cluster is running. |
|
1077 | - * |
|
1078 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html |
|
1079 | - * |
|
1080 | - * @param array{ |
|
1081 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1082 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1083 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1084 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1085 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1086 | - * } $params |
|
1087 | - * |
|
1088 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1089 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1090 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1091 | - * |
|
1092 | - * @return Elasticsearch|Promise |
|
1093 | - */ |
|
1094 | - public function ping(array $params = []) |
|
1095 | - { |
|
1096 | - $url = '/'; |
|
1097 | - $method = 'HEAD'; |
|
1098 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1099 | - $headers = ['Accept' => 'application/json']; |
|
1100 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1101 | - } |
|
1102 | - /** |
|
1103 | - * Creates or updates a script. |
|
1104 | - * |
|
1105 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html |
|
1106 | - * |
|
1107 | - * @param array{ |
|
1108 | - * id: string, // (REQUIRED) Script ID |
|
1109 | - * context: string, // Script context |
|
1110 | - * timeout: time, // Explicit operation timeout |
|
1111 | - * master_timeout: time, // Specify timeout for connection to master |
|
1112 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1113 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1114 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1115 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1116 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1117 | - * body: array, // (REQUIRED) The document |
|
1118 | - * } $params |
|
1119 | - * |
|
1120 | - * @throws MissingParameterException if a required parameter is missing |
|
1121 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1122 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1123 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1124 | - * |
|
1125 | - * @return Elasticsearch|Promise |
|
1126 | - */ |
|
1127 | - public function putScript(array $params = []) |
|
1128 | - { |
|
1129 | - $this->checkRequiredParameters(['id', 'body'], $params); |
|
1130 | - if (isset($params['context'])) { |
|
1131 | - $url = '/_scripts/' . $this->encode($params['id']) . '/' . $this->encode($params['context']); |
|
1132 | - $method = 'PUT'; |
|
1133 | - } else { |
|
1134 | - $url = '/_scripts/' . $this->encode($params['id']); |
|
1135 | - $method = 'PUT'; |
|
1136 | - } |
|
1137 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1138 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1139 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1140 | - } |
|
1141 | - /** |
|
1142 | - * Allows to evaluate the quality of ranked search results over a set of typical search queries |
|
1143 | - * |
|
1144 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html |
|
1145 | - * |
|
1146 | - * @param array{ |
|
1147 | - * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
1148 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1149 | - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
1150 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1151 | - * search_type: enum, // Search operation type |
|
1152 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1153 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1154 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1155 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1156 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1157 | - * body: array, // (REQUIRED) The ranking evaluation search definition, including search requests, document ratings and ranking metric definition. |
|
1158 | - * } $params |
|
1159 | - * |
|
1160 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1161 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1162 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1163 | - * |
|
1164 | - * @return Elasticsearch|Promise |
|
1165 | - */ |
|
1166 | - public function rankEval(array $params = []) |
|
1167 | - { |
|
1168 | - $this->checkRequiredParameters(['body'], $params); |
|
1169 | - if (isset($params['index'])) { |
|
1170 | - $url = '/' . $this->encode($params['index']) . '/_rank_eval'; |
|
1171 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1172 | - } else { |
|
1173 | - $url = '/_rank_eval'; |
|
1174 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1175 | - } |
|
1176 | - $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'search_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1177 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1178 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1179 | - } |
|
1180 | - /** |
|
1181 | - * Allows to copy documents from one index to another, optionally filtering the source |
|
1182 | - * documents by a query, changing the destination index settings, or fetching the |
|
1183 | - * documents from a remote cluster. |
|
1184 | - * |
|
1185 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html |
|
1186 | - * |
|
1187 | - * @param array{ |
|
1188 | - * refresh: boolean, // Should the affected indexes be refreshed? |
|
1189 | - * timeout: time, // Time each individual bulk request should wait for shards that are unavailable. |
|
1190 | - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
1191 | - * wait_for_completion: boolean, // Should the request should block until the reindex is complete. |
|
1192 | - * requests_per_second: number, // The throttle to set on this request in sub-requests per second. -1 means no throttle. |
|
1193 | - * scroll: time, // Control how long to keep the search context alive |
|
1194 | - * slices: number|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. |
|
1195 | - * max_docs: number, // Maximum number of documents to process (default: all documents) |
|
1196 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1197 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1198 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1199 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1200 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1201 | - * body: array, // (REQUIRED) The search definition using the Query DSL and the prototype for the index request. |
|
1202 | - * } $params |
|
1203 | - * |
|
1204 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1205 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1206 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1207 | - * |
|
1208 | - * @return Elasticsearch|Promise |
|
1209 | - */ |
|
1210 | - public function reindex(array $params = []) |
|
1211 | - { |
|
1212 | - $this->checkRequiredParameters(['body'], $params); |
|
1213 | - $url = '/_reindex'; |
|
1214 | - $method = 'POST'; |
|
1215 | - $url = $this->addQueryString($url, $params, ['refresh', 'timeout', 'wait_for_active_shards', 'wait_for_completion', 'requests_per_second', 'scroll', 'slices', 'max_docs', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1216 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1217 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1218 | - } |
|
1219 | - /** |
|
1220 | - * Changes the number of requests per second for a particular Reindex operation. |
|
1221 | - * |
|
1222 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html |
|
1223 | - * |
|
1224 | - * @param array{ |
|
1225 | - * task_id: string, // (REQUIRED) The task id to rethrottle |
|
1226 | - * requests_per_second: number, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. |
|
1227 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1228 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1229 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1230 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1231 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1232 | - * } $params |
|
1233 | - * |
|
1234 | - * @throws MissingParameterException if a required parameter is missing |
|
1235 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1236 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1237 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1238 | - * |
|
1239 | - * @return Elasticsearch|Promise |
|
1240 | - */ |
|
1241 | - public function reindexRethrottle(array $params = []) |
|
1242 | - { |
|
1243 | - $this->checkRequiredParameters(['task_id', 'requests_per_second'], $params); |
|
1244 | - $url = '/_reindex/' . $this->encode($params['task_id']) . '/_rethrottle'; |
|
1245 | - $method = 'POST'; |
|
1246 | - $url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1247 | - $headers = ['Accept' => 'application/json']; |
|
1248 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1249 | - } |
|
1250 | - /** |
|
1251 | - * Allows to use the Mustache language to pre-render a search definition. |
|
1252 | - * |
|
1253 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/render-search-template-api.html |
|
1254 | - * |
|
1255 | - * @param array{ |
|
1256 | - * id: string, // The id of the stored search template |
|
1257 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1258 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1259 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1260 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1261 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1262 | - * body: array, // The search definition template and its params |
|
1263 | - * } $params |
|
1264 | - * |
|
1265 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1266 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1267 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1268 | - * |
|
1269 | - * @return Elasticsearch|Promise |
|
1270 | - */ |
|
1271 | - public function renderSearchTemplate(array $params = []) |
|
1272 | - { |
|
1273 | - if (isset($params['id'])) { |
|
1274 | - $url = '/_render/template/' . $this->encode($params['id']); |
|
1275 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1276 | - } else { |
|
1277 | - $url = '/_render/template'; |
|
1278 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1279 | - } |
|
1280 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1281 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1282 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1283 | - } |
|
1284 | - /** |
|
1285 | - * Allows an arbitrary script to be executed and a result to be returned |
|
1286 | - * |
|
1287 | - * @see https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html |
|
1288 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
1289 | - * |
|
1290 | - * @param array{ |
|
1291 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1292 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1293 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1294 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1295 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1296 | - * body: array, // The script to execute |
|
1297 | - * } $params |
|
1298 | - * |
|
1299 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1300 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1301 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1302 | - * |
|
1303 | - * @return Elasticsearch|Promise |
|
1304 | - */ |
|
1305 | - public function scriptsPainlessExecute(array $params = []) |
|
1306 | - { |
|
1307 | - $url = '/_scripts/painless/_execute'; |
|
1308 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1309 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1310 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1311 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1312 | - } |
|
1313 | - /** |
|
1314 | - * Allows to retrieve a large numbers of results from a single search request. |
|
1315 | - * |
|
1316 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll |
|
1317 | - * |
|
1318 | - * @param array{ |
|
1319 | - * scroll_id: string, // The scroll ID |
|
1320 | - * scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search |
|
1321 | - * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response |
|
1322 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1323 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1324 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1325 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1326 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1327 | - * body: array, // The scroll ID if not passed by URL or query parameter. |
|
1328 | - * } $params |
|
1329 | - * |
|
1330 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1331 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1332 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1333 | - * |
|
1334 | - * @return Elasticsearch|Promise |
|
1335 | - */ |
|
1336 | - public function scroll(array $params = []) |
|
1337 | - { |
|
1338 | - if (isset($params['scroll_id'])) { |
|
1339 | - $url = '/_search/scroll/' . $this->encode($params['scroll_id']); |
|
1340 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1341 | - } else { |
|
1342 | - $url = '/_search/scroll'; |
|
1343 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1344 | - } |
|
1345 | - $url = $this->addQueryString($url, $params, ['scroll', 'rest_total_hits_as_int', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1346 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1347 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1348 | - } |
|
1349 | - /** |
|
1350 | - * Returns results matching a query. |
|
1351 | - * |
|
1352 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html |
|
1353 | - * |
|
1354 | - * @param array{ |
|
1355 | - * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
1356 | - * analyzer: string, // The analyzer to use for the query string |
|
1357 | - * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) |
|
1358 | - * ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution |
|
1359 | - * default_operator: enum, // The default operator for query string query (AND or OR) |
|
1360 | - * df: string, // The field to use as default where no field prefix is given in the query string |
|
1361 | - * explain: boolean, // Specify whether to return detailed information about score computation as part of a hit |
|
1362 | - * stored_fields: list, // A comma-separated list of stored fields to return as part of a hit |
|
1363 | - * docvalue_fields: list, // A comma-separated list of fields to return as the docvalue representation of a field for each hit |
|
1364 | - * from: number, // Starting offset (default: 0) |
|
1365 | - * force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. |
|
1366 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1367 | - * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled |
|
1368 | - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
1369 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1370 | - * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
1371 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
1372 | - * q: string, // Query in the Lucene query string syntax |
|
1373 | - * routing: list, // A comma-separated list of specific routing values |
|
1374 | - * scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search |
|
1375 | - * search_type: enum, // Search operation type |
|
1376 | - * size: number, // Number of hits to return (default: 10) |
|
1377 | - * sort: list, // A comma-separated list of <field>:<direction> pairs |
|
1378 | - * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
1379 | - * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
1380 | - * _source_includes: list, // A list of fields to extract and return from the _source field |
|
1381 | - * terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. |
|
1382 | - * stats: list, // Specific 'tag' of the request for logging and statistical purposes |
|
1383 | - * suggest_field: string, // Specify which field to use for suggestions |
|
1384 | - * suggest_mode: enum, // Specify suggest mode |
|
1385 | - * suggest_size: number, // How many suggestions to return in response |
|
1386 | - * suggest_text: string, // The source text for which the suggestions should be returned |
|
1387 | - * timeout: time, // Explicit operation timeout |
|
1388 | - * track_scores: boolean, // Whether to calculate and return scores even if they are not used for sorting |
|
1389 | - * track_total_hits: boolean|long, // Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number. |
|
1390 | - * allow_partial_search_results: boolean, // Indicate if an error should be returned if there is a partial search failure or timeout |
|
1391 | - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
1392 | - * version: boolean, // Specify whether to return document version as part of a hit |
|
1393 | - * seq_no_primary_term: boolean, // Specify whether to return sequence number and primary term of the last modification of each hit |
|
1394 | - * request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to index level setting |
|
1395 | - * batched_reduce_size: number, // The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. |
|
1396 | - * max_concurrent_shard_requests: number, // The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests |
|
1397 | - * pre_filter_shard_size: number, // A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. |
|
1398 | - * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response |
|
1399 | - * min_compatible_shard_node: string, // The minimum compatible version that all shards involved in search should have for this request to be successful |
|
1400 | - * include_named_queries_score: boolean, // Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false) |
|
1401 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1402 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1403 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1404 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1405 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1406 | - * body: array, // The search definition using the Query DSL |
|
1407 | - * } $params |
|
1408 | - * |
|
1409 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1410 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1411 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1412 | - * |
|
1413 | - * @return Elasticsearch|Promise |
|
1414 | - */ |
|
1415 | - public function search(array $params = []) |
|
1416 | - { |
|
1417 | - if (isset($params['index'])) { |
|
1418 | - $url = '/' . $this->encode($params['index']) . '/_search'; |
|
1419 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1420 | - } else { |
|
1421 | - $url = '/_search'; |
|
1422 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1423 | - } |
|
1424 | - $url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'ccs_minimize_roundtrips', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'force_synthetic_source', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'size', 'sort', '_source', '_source_excludes', '_source_includes', 'terminate_after', 'stats', 'suggest_field', 'suggest_mode', 'suggest_size', 'suggest_text', 'timeout', 'track_scores', 'track_total_hits', 'allow_partial_search_results', 'typed_keys', 'version', 'seq_no_primary_term', 'request_cache', 'batched_reduce_size', 'max_concurrent_shard_requests', 'pre_filter_shard_size', 'rest_total_hits_as_int', 'min_compatible_shard_node', 'include_named_queries_score', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1425 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1426 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1427 | - } |
|
1428 | - /** |
|
1429 | - * Searches a vector tile for geospatial values. Returns results as a binary Mapbox vector tile. |
|
1430 | - * |
|
1431 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-vector-tile-api.html |
|
1432 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
1433 | - * |
|
1434 | - * @param array{ |
|
1435 | - * index: list, // (REQUIRED) Comma-separated list of data streams, indices, or aliases to search |
|
1436 | - * field: string, // (REQUIRED) Field containing geospatial data to return |
|
1437 | - * zoom: int, // (REQUIRED) Zoom level for the vector tile to search |
|
1438 | - * x: int, // (REQUIRED) X coordinate for the vector tile to search |
|
1439 | - * y: int, // (REQUIRED) Y coordinate for the vector tile to search |
|
1440 | - * exact_bounds: boolean, // If false, the meta layer's feature is the bounding box of the tile. If true, the meta layer's feature is a bounding box resulting from a `geo_bounds` aggregation. |
|
1441 | - * extent: int, // Size, in pixels, of a side of the vector tile. |
|
1442 | - * grid_precision: int, // Additional zoom levels available through the aggs layer. Accepts 0-8. |
|
1443 | - * grid_type: enum, // Determines the geometry type for features in the aggs layer. |
|
1444 | - * size: int, // Maximum number of features to return in the hits layer. Accepts 0-10000. |
|
1445 | - * track_total_hits: boolean|long, // Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number. |
|
1446 | - * with_labels: boolean, // If true, the hits and aggs layers will contain additional point features with suggested label positions for the original features. |
|
1447 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1448 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1449 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1450 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1451 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1452 | - * body: array, // Search request body. |
|
1453 | - * } $params |
|
1454 | - * |
|
1455 | - * @throws MissingParameterException if a required parameter is missing |
|
1456 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1457 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1458 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1459 | - * |
|
1460 | - * @return Elasticsearch|Promise |
|
1461 | - */ |
|
1462 | - public function searchMvt(array $params = []) |
|
1463 | - { |
|
1464 | - $this->checkRequiredParameters(['index', 'field', 'zoom', 'x', 'y'], $params); |
|
1465 | - $url = '/' . $this->encode($params['index']) . '/_mvt/' . $this->encode($params['field']) . '/' . $this->encode($params['zoom']) . '/' . $this->encode($params['x']) . '/' . $this->encode($params['y']); |
|
1466 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1467 | - $url = $this->addQueryString($url, $params, ['exact_bounds', 'extent', 'grid_precision', 'grid_type', 'size', 'track_total_hits', 'with_labels', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1468 | - $headers = ['Accept' => 'application/vnd.mapbox-vector-tile', 'Content-Type' => 'application/json']; |
|
1469 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1470 | - } |
|
1471 | - /** |
|
1472 | - * Returns information about the indices and shards that a search request would be executed against. |
|
1473 | - * |
|
1474 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html |
|
1475 | - * |
|
1476 | - * @param array{ |
|
1477 | - * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
1478 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
1479 | - * routing: string, // Specific routing value |
|
1480 | - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
1481 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1482 | - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
1483 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1484 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1485 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1486 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1487 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1488 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1489 | - * } $params |
|
1490 | - * |
|
1491 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1492 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1493 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1494 | - * |
|
1495 | - * @return Elasticsearch|Promise |
|
1496 | - */ |
|
1497 | - public function searchShards(array $params = []) |
|
1498 | - { |
|
1499 | - if (isset($params['index'])) { |
|
1500 | - $url = '/' . $this->encode($params['index']) . '/_search_shards'; |
|
1501 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1502 | - } else { |
|
1503 | - $url = '/_search_shards'; |
|
1504 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1505 | - } |
|
1506 | - $url = $this->addQueryString($url, $params, ['preference', 'routing', 'local', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1507 | - $headers = ['Accept' => 'application/json']; |
|
1508 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1509 | - } |
|
1510 | - /** |
|
1511 | - * Allows to use the Mustache language to pre-render a search definition. |
|
1512 | - * |
|
1513 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html |
|
1514 | - * |
|
1515 | - * @param array{ |
|
1516 | - * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
1517 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1518 | - * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled |
|
1519 | - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
1520 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1521 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
1522 | - * routing: list, // A comma-separated list of specific routing values |
|
1523 | - * scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search |
|
1524 | - * search_type: enum, // Search operation type |
|
1525 | - * explain: boolean, // Specify whether to return detailed information about score computation as part of a hit |
|
1526 | - * profile: boolean, // Specify whether to profile the query execution |
|
1527 | - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
1528 | - * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response |
|
1529 | - * ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution |
|
1530 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1531 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1532 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1533 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1534 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1535 | - * body: array, // (REQUIRED) The search definition template and its params |
|
1536 | - * } $params |
|
1537 | - * |
|
1538 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1539 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1540 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1541 | - * |
|
1542 | - * @return Elasticsearch|Promise |
|
1543 | - */ |
|
1544 | - public function searchTemplate(array $params = []) |
|
1545 | - { |
|
1546 | - $this->checkRequiredParameters(['body'], $params); |
|
1547 | - if (isset($params['index'])) { |
|
1548 | - $url = '/' . $this->encode($params['index']) . '/_search/template'; |
|
1549 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1550 | - } else { |
|
1551 | - $url = '/_search/template'; |
|
1552 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1553 | - } |
|
1554 | - $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'preference', 'routing', 'scroll', 'search_type', 'explain', 'profile', 'typed_keys', 'rest_total_hits_as_int', 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1555 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1556 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1557 | - } |
|
1558 | - /** |
|
1559 | - * The terms enum API can be used to discover terms in the index that begin with the provided string. It is designed for low-latency look-ups used in auto-complete scenarios. |
|
1560 | - * |
|
1561 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-terms-enum.html |
|
1562 | - * |
|
1563 | - * @param array{ |
|
1564 | - * index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
1565 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1566 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1567 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1568 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1569 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1570 | - * body: array, // field name, string which is the prefix expected in matching terms, timeout and size for max number of results |
|
1571 | - * } $params |
|
1572 | - * |
|
1573 | - * @throws MissingParameterException if a required parameter is missing |
|
1574 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1575 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1576 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1577 | - * |
|
1578 | - * @return Elasticsearch|Promise |
|
1579 | - */ |
|
1580 | - public function termsEnum(array $params = []) |
|
1581 | - { |
|
1582 | - $this->checkRequiredParameters(['index'], $params); |
|
1583 | - $url = '/' . $this->encode($params['index']) . '/_terms_enum'; |
|
1584 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1585 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1586 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1587 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1588 | - } |
|
1589 | - /** |
|
1590 | - * Returns information and statistics about terms in the fields of a particular document. |
|
1591 | - * |
|
1592 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html |
|
1593 | - * |
|
1594 | - * @param array{ |
|
1595 | - * index: string, // (REQUIRED) The index in which the document resides. |
|
1596 | - * id: string, // The id of the document, when not specified a doc param should be supplied. |
|
1597 | - * term_statistics: boolean, // Specifies if total term frequency and document frequency should be returned. |
|
1598 | - * field_statistics: boolean, // Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. |
|
1599 | - * fields: list, // A comma-separated list of fields to return. |
|
1600 | - * offsets: boolean, // Specifies if term offsets should be returned. |
|
1601 | - * positions: boolean, // Specifies if term positions should be returned. |
|
1602 | - * payloads: boolean, // Specifies if term payloads should be returned. |
|
1603 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random). |
|
1604 | - * routing: string, // Specific routing value. |
|
1605 | - * realtime: boolean, // Specifies if request is real-time as opposed to near-real-time (default: true). |
|
1606 | - * version: number, // Explicit version number for concurrency control |
|
1607 | - * version_type: enum, // Specific version type |
|
1608 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1609 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1610 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1611 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1612 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1613 | - * body: array, // Define parameters and or supply a document to get termvectors for. See documentation. |
|
1614 | - * } $params |
|
1615 | - * |
|
1616 | - * @throws MissingParameterException if a required parameter is missing |
|
1617 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1618 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1619 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1620 | - * |
|
1621 | - * @return Elasticsearch|Promise |
|
1622 | - */ |
|
1623 | - public function termvectors(array $params = []) |
|
1624 | - { |
|
1625 | - $this->checkRequiredParameters(['index'], $params); |
|
1626 | - if (isset($params['id'])) { |
|
1627 | - $url = '/' . $this->encode($params['index']) . '/_termvectors/' . $this->encode($params['id']); |
|
1628 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1629 | - } else { |
|
1630 | - $url = '/' . $this->encode($params['index']) . '/_termvectors'; |
|
1631 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1632 | - } |
|
1633 | - $url = $this->addQueryString($url, $params, ['term_statistics', 'field_statistics', 'fields', 'offsets', 'positions', 'payloads', 'preference', 'routing', 'realtime', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1634 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1635 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1636 | - } |
|
1637 | - /** |
|
1638 | - * Updates a document with a script or partial document. |
|
1639 | - * |
|
1640 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html |
|
1641 | - * |
|
1642 | - * @param array{ |
|
1643 | - * id: string, // (REQUIRED) Document ID |
|
1644 | - * index: string, // (REQUIRED) The name of the index |
|
1645 | - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
1646 | - * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
1647 | - * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
1648 | - * _source_includes: list, // A list of fields to extract and return from the _source field |
|
1649 | - * lang: string, // The script language (default: painless) |
|
1650 | - * refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. |
|
1651 | - * retry_on_conflict: number, // Specify how many times should the operation be retried when a conflict occurs (default: 0) |
|
1652 | - * routing: string, // Specific routing value |
|
1653 | - * timeout: time, // Explicit operation timeout |
|
1654 | - * if_seq_no: number, // only perform the update operation if the last operation that has changed the document has the specified sequence number |
|
1655 | - * if_primary_term: number, // only perform the update operation if the last operation that has changed the document has the specified primary term |
|
1656 | - * require_alias: boolean, // When true, requires destination is an alias. Default is false |
|
1657 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1658 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1659 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1660 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1661 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1662 | - * body: array, // (REQUIRED) The request definition requires either `script` or partial `doc` |
|
1663 | - * } $params |
|
1664 | - * |
|
1665 | - * @throws MissingParameterException if a required parameter is missing |
|
1666 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1667 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1668 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1669 | - * |
|
1670 | - * @return Elasticsearch|Promise |
|
1671 | - */ |
|
1672 | - public function update(array $params = []) |
|
1673 | - { |
|
1674 | - $this->checkRequiredParameters(['id', 'index', 'body'], $params); |
|
1675 | - $url = '/' . $this->encode($params['index']) . '/_update/' . $this->encode($params['id']); |
|
1676 | - $method = 'POST'; |
|
1677 | - $url = $this->addQueryString($url, $params, ['wait_for_active_shards', '_source', '_source_excludes', '_source_includes', 'lang', 'refresh', 'retry_on_conflict', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1678 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1679 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1680 | - } |
|
1681 | - /** |
|
1682 | - * Performs an update on every document in the index without changing the source, |
|
1683 | - * for example to pick up a mapping change. |
|
1684 | - * |
|
1685 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html |
|
1686 | - * |
|
1687 | - * @param array{ |
|
1688 | - * index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
1689 | - * analyzer: string, // The analyzer to use for the query string |
|
1690 | - * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) |
|
1691 | - * default_operator: enum, // The default operator for query string query (AND or OR) |
|
1692 | - * df: string, // The field to use as default where no field prefix is given in the query string |
|
1693 | - * from: number, // Starting offset (default: 0) |
|
1694 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1695 | - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
1696 | - * conflicts: enum, // What to do when the update by query hits version conflicts? |
|
1697 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1698 | - * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
1699 | - * pipeline: string, // Ingest pipeline to set on index requests made by this action. (default: none) |
|
1700 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
1701 | - * q: string, // Query in the Lucene query string syntax |
|
1702 | - * routing: list, // A comma-separated list of specific routing values |
|
1703 | - * scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search |
|
1704 | - * search_type: enum, // Search operation type |
|
1705 | - * search_timeout: time, // Explicit timeout for each search request. Defaults to no timeout. |
|
1706 | - * max_docs: number, // Maximum number of documents to process (default: all documents) |
|
1707 | - * sort: list, // A comma-separated list of <field>:<direction> pairs |
|
1708 | - * terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. |
|
1709 | - * stats: list, // Specific 'tag' of the request for logging and statistical purposes |
|
1710 | - * version: boolean, // Specify whether to return document version as part of a hit |
|
1711 | - * version_type: boolean, // Should the document increment the version number (internal) on hit or not (reindex) |
|
1712 | - * request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to index level setting |
|
1713 | - * refresh: boolean, // Should the affected indexes be refreshed? |
|
1714 | - * timeout: time, // Time each individual bulk request should wait for shards that are unavailable. |
|
1715 | - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the update by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
1716 | - * scroll_size: number, // Size on the scroll request powering the update by query |
|
1717 | - * wait_for_completion: boolean, // Should the request should block until the update by query operation is complete. |
|
1718 | - * requests_per_second: number, // The throttle to set on this request in sub-requests per second. -1 means no throttle. |
|
1719 | - * slices: number|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. |
|
1720 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1721 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1722 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1723 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1724 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1725 | - * body: array, // The search definition using the Query DSL |
|
1726 | - * } $params |
|
1727 | - * |
|
1728 | - * @throws MissingParameterException if a required parameter is missing |
|
1729 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1730 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1731 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1732 | - * |
|
1733 | - * @return Elasticsearch|Promise |
|
1734 | - */ |
|
1735 | - public function updateByQuery(array $params = []) |
|
1736 | - { |
|
1737 | - $this->checkRequiredParameters(['index'], $params); |
|
1738 | - $url = '/' . $this->encode($params['index']) . '/_update_by_query'; |
|
1739 | - $method = 'POST'; |
|
1740 | - $url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'pipeline', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'max_docs', 'sort', 'terminate_after', 'stats', 'version', 'version_type', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1741 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1742 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1743 | - } |
|
1744 | - /** |
|
1745 | - * Changes the number of requests per second for a particular Update By Query operation. |
|
1746 | - * |
|
1747 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html |
|
1748 | - * |
|
1749 | - * @param array{ |
|
1750 | - * task_id: string, // (REQUIRED) The task id to rethrottle |
|
1751 | - * requests_per_second: number, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. |
|
1752 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1753 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1754 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1755 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1756 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1757 | - * } $params |
|
1758 | - * |
|
1759 | - * @throws MissingParameterException if a required parameter is missing |
|
1760 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1761 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1762 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1763 | - * |
|
1764 | - * @return Elasticsearch|Promise |
|
1765 | - */ |
|
1766 | - public function updateByQueryRethrottle(array $params = []) |
|
1767 | - { |
|
1768 | - $this->checkRequiredParameters(['task_id', 'requests_per_second'], $params); |
|
1769 | - $url = '/_update_by_query/' . $this->encode($params['task_id']) . '/_rethrottle'; |
|
1770 | - $method = 'POST'; |
|
1771 | - $url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1772 | - $headers = ['Accept' => 'application/json']; |
|
1773 | - return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1774 | - } |
|
28 | + /** |
|
29 | + * Allows to perform multiple index/update/delete operations in a single request. |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html |
|
32 | + * |
|
33 | + * @param array{ |
|
34 | + * index: string, // Default index for items which don't provide one |
|
35 | + * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
36 | + * refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. |
|
37 | + * routing: string, // Specific routing value |
|
38 | + * timeout: time, // Explicit operation timeout |
|
39 | + * type: string, // Default document type for items which don't provide one |
|
40 | + * _source: list, // True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request |
|
41 | + * _source_excludes: list, // Default list of fields to exclude from the returned _source field, can be overridden on each sub-request |
|
42 | + * _source_includes: list, // Default list of fields to extract and return from the _source field, can be overridden on each sub-request |
|
43 | + * pipeline: string, // The pipeline id to preprocess incoming documents with |
|
44 | + * require_alias: boolean, // Sets require_alias for all incoming documents. Defaults to unset (false) |
|
45 | + * require_data_stream: boolean, // When true, requires the destination to be a data stream (existing or to-be-created). Default is false |
|
46 | + * list_executed_pipelines: boolean, // Sets list_executed_pipelines for all incoming documents. Defaults to unset (false) |
|
47 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
48 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
49 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
50 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
51 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
52 | + * body: array, // (REQUIRED) The operation definition and data (action-data pairs), separated by newlines |
|
53 | + * } $params |
|
54 | + * |
|
55 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
56 | + * @throws ClientResponseException if the status code of response is 4xx |
|
57 | + * @throws ServerResponseException if the status code of response is 5xx |
|
58 | + * |
|
59 | + * @return Elasticsearch|Promise |
|
60 | + */ |
|
61 | + public function bulk(array $params = []) |
|
62 | + { |
|
63 | + $this->checkRequiredParameters(['body'], $params); |
|
64 | + if (isset($params['index'])) { |
|
65 | + $url = '/' . $this->encode($params['index']) . '/_bulk'; |
|
66 | + $method = 'POST'; |
|
67 | + } else { |
|
68 | + $url = '/_bulk'; |
|
69 | + $method = 'POST'; |
|
70 | + } |
|
71 | + $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'type', '_source', '_source_excludes', '_source_includes', 'pipeline', 'require_alias', 'require_data_stream', 'list_executed_pipelines', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
72 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson']; |
|
73 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
74 | + } |
|
75 | + /** |
|
76 | + * Explicitly clears the search context for a scroll. |
|
77 | + * |
|
78 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/clear-scroll-api.html |
|
79 | + * |
|
80 | + * @param array{ |
|
81 | + * scroll_id: list, // A comma-separated list of scroll IDs to clear |
|
82 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
83 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
84 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
85 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
86 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
87 | + * body: array, // A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter |
|
88 | + * } $params |
|
89 | + * |
|
90 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
91 | + * @throws ClientResponseException if the status code of response is 4xx |
|
92 | + * @throws ServerResponseException if the status code of response is 5xx |
|
93 | + * |
|
94 | + * @return Elasticsearch|Promise |
|
95 | + */ |
|
96 | + public function clearScroll(array $params = []) |
|
97 | + { |
|
98 | + if (isset($params['scroll_id'])) { |
|
99 | + $url = '/_search/scroll/' . $this->encode($params['scroll_id']); |
|
100 | + $method = 'DELETE'; |
|
101 | + } else { |
|
102 | + $url = '/_search/scroll'; |
|
103 | + $method = 'DELETE'; |
|
104 | + } |
|
105 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
106 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
107 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
108 | + } |
|
109 | + /** |
|
110 | + * Close a point in time |
|
111 | + * |
|
112 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html |
|
113 | + * |
|
114 | + * @param array{ |
|
115 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
116 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
117 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
118 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
119 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
120 | + * body: array, // a point-in-time id to close |
|
121 | + * } $params |
|
122 | + * |
|
123 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
124 | + * @throws ClientResponseException if the status code of response is 4xx |
|
125 | + * @throws ServerResponseException if the status code of response is 5xx |
|
126 | + * |
|
127 | + * @return Elasticsearch|Promise |
|
128 | + */ |
|
129 | + public function closePointInTime(array $params = []) |
|
130 | + { |
|
131 | + $url = '/_pit'; |
|
132 | + $method = 'DELETE'; |
|
133 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
134 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
135 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
136 | + } |
|
137 | + /** |
|
138 | + * Returns number of documents matching a query. |
|
139 | + * |
|
140 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html |
|
141 | + * |
|
142 | + * @param array{ |
|
143 | + * index: list, // A comma-separated list of indices to restrict the results |
|
144 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
145 | + * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled |
|
146 | + * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
147 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
148 | + * min_score: number, // Include only documents with a specific `_score` value in the result |
|
149 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
150 | + * routing: list, // A comma-separated list of specific routing values |
|
151 | + * q: string, // Query in the Lucene query string syntax |
|
152 | + * analyzer: string, // The analyzer to use for the query string |
|
153 | + * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) |
|
154 | + * default_operator: enum, // The default operator for query string query (AND or OR) |
|
155 | + * df: string, // The field to use as default where no field prefix is given in the query string |
|
156 | + * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
157 | + * terminate_after: number, // The maximum count for each shard, upon reaching which the query execution will terminate early |
|
158 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
159 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
160 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
161 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
162 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
163 | + * body: array, // A query to restrict the results specified with the Query DSL (optional) |
|
164 | + * } $params |
|
165 | + * |
|
166 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
167 | + * @throws ClientResponseException if the status code of response is 4xx |
|
168 | + * @throws ServerResponseException if the status code of response is 5xx |
|
169 | + * |
|
170 | + * @return Elasticsearch|Promise |
|
171 | + */ |
|
172 | + public function count(array $params = []) |
|
173 | + { |
|
174 | + if (isset($params['index'])) { |
|
175 | + $url = '/' . $this->encode($params['index']) . '/_count'; |
|
176 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
177 | + } else { |
|
178 | + $url = '/_count'; |
|
179 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
180 | + } |
|
181 | + $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'min_score', 'preference', 'routing', 'q', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'terminate_after', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
182 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
183 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
184 | + } |
|
185 | + /** |
|
186 | + * Creates a new document in the index. |
|
187 | + * |
|
188 | + * Returns a 409 response when a document with a same ID already exists in the index. |
|
189 | + * |
|
190 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html |
|
191 | + * |
|
192 | + * @param array{ |
|
193 | + * id: string, // (REQUIRED) Document ID |
|
194 | + * index: string, // (REQUIRED) The name of the index |
|
195 | + * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
196 | + * refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. |
|
197 | + * routing: string, // Specific routing value |
|
198 | + * timeout: time, // Explicit operation timeout |
|
199 | + * version: number, // Explicit version number for concurrency control |
|
200 | + * version_type: enum, // Specific version type |
|
201 | + * pipeline: string, // The pipeline id to preprocess incoming documents with |
|
202 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
203 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
204 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
205 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
206 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
207 | + * body: array, // (REQUIRED) The document |
|
208 | + * } $params |
|
209 | + * |
|
210 | + * @throws MissingParameterException if a required parameter is missing |
|
211 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
212 | + * @throws ClientResponseException if the status code of response is 4xx |
|
213 | + * @throws ServerResponseException if the status code of response is 5xx |
|
214 | + * |
|
215 | + * @return Elasticsearch|Promise |
|
216 | + */ |
|
217 | + public function create(array $params = []) |
|
218 | + { |
|
219 | + $this->checkRequiredParameters(['id', 'index', 'body'], $params); |
|
220 | + $url = '/' . $this->encode($params['index']) . '/_create/' . $this->encode($params['id']); |
|
221 | + $method = 'PUT'; |
|
222 | + $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'pipeline', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
223 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
224 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
225 | + } |
|
226 | + /** |
|
227 | + * Removes a document from the index. |
|
228 | + * |
|
229 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html |
|
230 | + * |
|
231 | + * @param array{ |
|
232 | + * id: string, // (REQUIRED) The document ID |
|
233 | + * index: string, // (REQUIRED) The name of the index |
|
234 | + * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
235 | + * refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. |
|
236 | + * routing: string, // Specific routing value |
|
237 | + * timeout: time, // Explicit operation timeout |
|
238 | + * if_seq_no: number, // only perform the delete operation if the last operation that has changed the document has the specified sequence number |
|
239 | + * if_primary_term: number, // only perform the delete operation if the last operation that has changed the document has the specified primary term |
|
240 | + * version: number, // Explicit version number for concurrency control |
|
241 | + * version_type: enum, // Specific version type |
|
242 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
243 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
244 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
245 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
246 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
247 | + * } $params |
|
248 | + * |
|
249 | + * @throws MissingParameterException if a required parameter is missing |
|
250 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
251 | + * @throws ClientResponseException if the status code of response is 4xx |
|
252 | + * @throws ServerResponseException if the status code of response is 5xx |
|
253 | + * |
|
254 | + * @return Elasticsearch|Promise |
|
255 | + */ |
|
256 | + public function delete(array $params = []) |
|
257 | + { |
|
258 | + $this->checkRequiredParameters(['id', 'index'], $params); |
|
259 | + $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); |
|
260 | + $method = 'DELETE'; |
|
261 | + $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
262 | + $headers = ['Accept' => 'application/json']; |
|
263 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
264 | + } |
|
265 | + /** |
|
266 | + * Deletes documents matching the provided query. |
|
267 | + * |
|
268 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html |
|
269 | + * |
|
270 | + * @param array{ |
|
271 | + * index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
272 | + * analyzer: string, // The analyzer to use for the query string |
|
273 | + * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) |
|
274 | + * default_operator: enum, // The default operator for query string query (AND or OR) |
|
275 | + * df: string, // The field to use as default where no field prefix is given in the query string |
|
276 | + * from: number, // Starting offset (default: 0) |
|
277 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
278 | + * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
279 | + * conflicts: enum, // What to do when the delete by query hits version conflicts? |
|
280 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
281 | + * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
282 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
283 | + * q: string, // Query in the Lucene query string syntax |
|
284 | + * routing: list, // A comma-separated list of specific routing values |
|
285 | + * scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search |
|
286 | + * search_type: enum, // Search operation type |
|
287 | + * search_timeout: time, // Explicit timeout for each search request. Defaults to no timeout. |
|
288 | + * max_docs: number, // Maximum number of documents to process (default: all documents) |
|
289 | + * sort: list, // A comma-separated list of <field>:<direction> pairs |
|
290 | + * terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. |
|
291 | + * stats: list, // Specific 'tag' of the request for logging and statistical purposes |
|
292 | + * version: boolean, // Specify whether to return document version as part of a hit |
|
293 | + * request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to index level setting |
|
294 | + * refresh: boolean, // Should the affected indexes be refreshed? |
|
295 | + * timeout: time, // Time each individual bulk request should wait for shards that are unavailable. |
|
296 | + * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
297 | + * scroll_size: number, // Size on the scroll request powering the delete by query |
|
298 | + * wait_for_completion: boolean, // Should the request should block until the delete by query is complete. |
|
299 | + * requests_per_second: number, // The throttle for this request in sub-requests per second. -1 means no throttle. |
|
300 | + * slices: number|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. |
|
301 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
302 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
303 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
304 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
305 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
306 | + * body: array, // (REQUIRED) The search definition using the Query DSL |
|
307 | + * } $params |
|
308 | + * |
|
309 | + * @throws MissingParameterException if a required parameter is missing |
|
310 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
311 | + * @throws ClientResponseException if the status code of response is 4xx |
|
312 | + * @throws ServerResponseException if the status code of response is 5xx |
|
313 | + * |
|
314 | + * @return Elasticsearch|Promise |
|
315 | + */ |
|
316 | + public function deleteByQuery(array $params = []) |
|
317 | + { |
|
318 | + $this->checkRequiredParameters(['index', 'body'], $params); |
|
319 | + $url = '/' . $this->encode($params['index']) . '/_delete_by_query'; |
|
320 | + $method = 'POST'; |
|
321 | + $url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'max_docs', 'sort', 'terminate_after', 'stats', 'version', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
322 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
323 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
324 | + } |
|
325 | + /** |
|
326 | + * Changes the number of requests per second for a particular Delete By Query operation. |
|
327 | + * |
|
328 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html |
|
329 | + * |
|
330 | + * @param array{ |
|
331 | + * task_id: string, // (REQUIRED) The task id to rethrottle |
|
332 | + * requests_per_second: number, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. |
|
333 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
334 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
335 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
336 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
337 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
338 | + * } $params |
|
339 | + * |
|
340 | + * @throws MissingParameterException if a required parameter is missing |
|
341 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
342 | + * @throws ClientResponseException if the status code of response is 4xx |
|
343 | + * @throws ServerResponseException if the status code of response is 5xx |
|
344 | + * |
|
345 | + * @return Elasticsearch|Promise |
|
346 | + */ |
|
347 | + public function deleteByQueryRethrottle(array $params = []) |
|
348 | + { |
|
349 | + $this->checkRequiredParameters(['task_id', 'requests_per_second'], $params); |
|
350 | + $url = '/_delete_by_query/' . $this->encode($params['task_id']) . '/_rethrottle'; |
|
351 | + $method = 'POST'; |
|
352 | + $url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
353 | + $headers = ['Accept' => 'application/json']; |
|
354 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
355 | + } |
|
356 | + /** |
|
357 | + * Deletes a script. |
|
358 | + * |
|
359 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html |
|
360 | + * |
|
361 | + * @param array{ |
|
362 | + * id: string, // (REQUIRED) Script ID |
|
363 | + * timeout: time, // Explicit operation timeout |
|
364 | + * master_timeout: time, // Specify timeout for connection to master |
|
365 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
366 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
367 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
368 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
369 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
370 | + * } $params |
|
371 | + * |
|
372 | + * @throws MissingParameterException if a required parameter is missing |
|
373 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
374 | + * @throws ClientResponseException if the status code of response is 4xx |
|
375 | + * @throws ServerResponseException if the status code of response is 5xx |
|
376 | + * |
|
377 | + * @return Elasticsearch|Promise |
|
378 | + */ |
|
379 | + public function deleteScript(array $params = []) |
|
380 | + { |
|
381 | + $this->checkRequiredParameters(['id'], $params); |
|
382 | + $url = '/_scripts/' . $this->encode($params['id']); |
|
383 | + $method = 'DELETE'; |
|
384 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
385 | + $headers = ['Accept' => 'application/json']; |
|
386 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
387 | + } |
|
388 | + /** |
|
389 | + * Returns information about whether a document exists in an index. |
|
390 | + * |
|
391 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html |
|
392 | + * |
|
393 | + * @param array{ |
|
394 | + * id: string, // (REQUIRED) The document ID |
|
395 | + * index: string, // (REQUIRED) The name of the index |
|
396 | + * stored_fields: list, // A comma-separated list of stored fields to return in the response |
|
397 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
398 | + * realtime: boolean, // Specify whether to perform the operation in realtime or search mode |
|
399 | + * refresh: boolean, // Refresh the shard containing the document before performing the operation |
|
400 | + * routing: string, // Specific routing value |
|
401 | + * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
402 | + * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
403 | + * _source_includes: list, // A list of fields to extract and return from the _source field |
|
404 | + * version: number, // Explicit version number for concurrency control |
|
405 | + * version_type: enum, // Specific version type |
|
406 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
407 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
408 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
409 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
410 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
411 | + * } $params |
|
412 | + * |
|
413 | + * @throws MissingParameterException if a required parameter is missing |
|
414 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
415 | + * @throws ClientResponseException if the status code of response is 4xx |
|
416 | + * @throws ServerResponseException if the status code of response is 5xx |
|
417 | + * |
|
418 | + * @return Elasticsearch|Promise |
|
419 | + */ |
|
420 | + public function exists(array $params = []) |
|
421 | + { |
|
422 | + $this->checkRequiredParameters(['id', 'index'], $params); |
|
423 | + $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); |
|
424 | + $method = 'HEAD'; |
|
425 | + $url = $this->addQueryString($url, $params, ['stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
426 | + $headers = ['Accept' => 'application/json']; |
|
427 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
428 | + } |
|
429 | + /** |
|
430 | + * Returns information about whether a document source exists in an index. |
|
431 | + * |
|
432 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html |
|
433 | + * |
|
434 | + * @param array{ |
|
435 | + * id: string, // (REQUIRED) The document ID |
|
436 | + * index: string, // (REQUIRED) The name of the index |
|
437 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
438 | + * realtime: boolean, // Specify whether to perform the operation in realtime or search mode |
|
439 | + * refresh: boolean, // Refresh the shard containing the document before performing the operation |
|
440 | + * routing: string, // Specific routing value |
|
441 | + * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
442 | + * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
443 | + * _source_includes: list, // A list of fields to extract and return from the _source field |
|
444 | + * version: number, // Explicit version number for concurrency control |
|
445 | + * version_type: enum, // Specific version type |
|
446 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
447 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
448 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
449 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
450 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
451 | + * } $params |
|
452 | + * |
|
453 | + * @throws MissingParameterException if a required parameter is missing |
|
454 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
455 | + * @throws ClientResponseException if the status code of response is 4xx |
|
456 | + * @throws ServerResponseException if the status code of response is 5xx |
|
457 | + * |
|
458 | + * @return Elasticsearch|Promise |
|
459 | + */ |
|
460 | + public function existsSource(array $params = []) |
|
461 | + { |
|
462 | + $this->checkRequiredParameters(['id', 'index'], $params); |
|
463 | + $url = '/' . $this->encode($params['index']) . '/_source/' . $this->encode($params['id']); |
|
464 | + $method = 'HEAD'; |
|
465 | + $url = $this->addQueryString($url, $params, ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
466 | + $headers = ['Accept' => 'application/json']; |
|
467 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
468 | + } |
|
469 | + /** |
|
470 | + * Returns information about why a specific matches (or doesn't match) a query. |
|
471 | + * |
|
472 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html |
|
473 | + * |
|
474 | + * @param array{ |
|
475 | + * id: string, // (REQUIRED) The document ID |
|
476 | + * index: string, // (REQUIRED) The name of the index |
|
477 | + * analyze_wildcard: boolean, // Specify whether wildcards and prefix queries in the query string query should be analyzed (default: false) |
|
478 | + * analyzer: string, // The analyzer for the query string query |
|
479 | + * default_operator: enum, // The default operator for query string query (AND or OR) |
|
480 | + * df: string, // The default field for query string query (default: _all) |
|
481 | + * stored_fields: list, // A comma-separated list of stored fields to return in the response |
|
482 | + * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
483 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
484 | + * q: string, // Query in the Lucene query string syntax |
|
485 | + * routing: string, // Specific routing value |
|
486 | + * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
487 | + * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
488 | + * _source_includes: list, // A list of fields to extract and return from the _source field |
|
489 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
490 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
491 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
492 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
493 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
494 | + * body: array, // The query definition using the Query DSL |
|
495 | + * } $params |
|
496 | + * |
|
497 | + * @throws MissingParameterException if a required parameter is missing |
|
498 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
499 | + * @throws ClientResponseException if the status code of response is 4xx |
|
500 | + * @throws ServerResponseException if the status code of response is 5xx |
|
501 | + * |
|
502 | + * @return Elasticsearch|Promise |
|
503 | + */ |
|
504 | + public function explain(array $params = []) |
|
505 | + { |
|
506 | + $this->checkRequiredParameters(['id', 'index'], $params); |
|
507 | + $url = '/' . $this->encode($params['index']) . '/_explain/' . $this->encode($params['id']); |
|
508 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
509 | + $url = $this->addQueryString($url, $params, ['analyze_wildcard', 'analyzer', 'default_operator', 'df', 'stored_fields', 'lenient', 'preference', 'q', 'routing', '_source', '_source_excludes', '_source_includes', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
510 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
511 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
512 | + } |
|
513 | + /** |
|
514 | + * Returns the information about the capabilities of fields among multiple indices. |
|
515 | + * |
|
516 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html |
|
517 | + * |
|
518 | + * @param array{ |
|
519 | + * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
520 | + * fields: list, // A comma-separated list of field names |
|
521 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
522 | + * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
523 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
524 | + * include_unmapped: boolean, // Indicates whether unmapped fields should be included in the response. |
|
525 | + * filters: list, // An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent |
|
526 | + * types: list, // Only return results for fields that have one of the types in the list |
|
527 | + * include_empty_fields: boolean, // Include empty fields in result |
|
528 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
529 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
530 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
531 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
532 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
533 | + * body: array, // An index filter specified with the Query DSL |
|
534 | + * } $params |
|
535 | + * |
|
536 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
537 | + * @throws ClientResponseException if the status code of response is 4xx |
|
538 | + * @throws ServerResponseException if the status code of response is 5xx |
|
539 | + * |
|
540 | + * @return Elasticsearch|Promise |
|
541 | + */ |
|
542 | + public function fieldCaps(array $params = []) |
|
543 | + { |
|
544 | + if (isset($params['index'])) { |
|
545 | + $url = '/' . $this->encode($params['index']) . '/_field_caps'; |
|
546 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
547 | + } else { |
|
548 | + $url = '/_field_caps'; |
|
549 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
550 | + } |
|
551 | + $url = $this->addQueryString($url, $params, ['fields', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'include_unmapped', 'filters', 'types', 'include_empty_fields', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
552 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
553 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
554 | + } |
|
555 | + /** |
|
556 | + * Returns a document. |
|
557 | + * |
|
558 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html |
|
559 | + * |
|
560 | + * @param array{ |
|
561 | + * id: string, // (REQUIRED) The document ID |
|
562 | + * index: string, // (REQUIRED) The name of the index |
|
563 | + * force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. |
|
564 | + * stored_fields: list, // A comma-separated list of stored fields to return in the response |
|
565 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
566 | + * realtime: boolean, // Specify whether to perform the operation in realtime or search mode |
|
567 | + * refresh: boolean, // Refresh the shard containing the document before performing the operation |
|
568 | + * routing: string, // Specific routing value |
|
569 | + * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
570 | + * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
571 | + * _source_includes: list, // A list of fields to extract and return from the _source field |
|
572 | + * version: number, // Explicit version number for concurrency control |
|
573 | + * version_type: enum, // Specific version type |
|
574 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
575 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
576 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
577 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
578 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
579 | + * } $params |
|
580 | + * |
|
581 | + * @throws MissingParameterException if a required parameter is missing |
|
582 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
583 | + * @throws ClientResponseException if the status code of response is 4xx |
|
584 | + * @throws ServerResponseException if the status code of response is 5xx |
|
585 | + * |
|
586 | + * @return Elasticsearch|Promise |
|
587 | + */ |
|
588 | + public function get(array $params = []) |
|
589 | + { |
|
590 | + $this->checkRequiredParameters(['id', 'index'], $params); |
|
591 | + $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); |
|
592 | + $method = 'GET'; |
|
593 | + $url = $this->addQueryString($url, $params, ['force_synthetic_source', 'stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
594 | + $headers = ['Accept' => 'application/json']; |
|
595 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
596 | + } |
|
597 | + /** |
|
598 | + * Returns a script. |
|
599 | + * |
|
600 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html |
|
601 | + * |
|
602 | + * @param array{ |
|
603 | + * id: string, // (REQUIRED) Script ID |
|
604 | + * master_timeout: time, // Specify timeout for connection to master |
|
605 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
606 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
607 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
608 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
609 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
610 | + * } $params |
|
611 | + * |
|
612 | + * @throws MissingParameterException if a required parameter is missing |
|
613 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
614 | + * @throws ClientResponseException if the status code of response is 4xx |
|
615 | + * @throws ServerResponseException if the status code of response is 5xx |
|
616 | + * |
|
617 | + * @return Elasticsearch|Promise |
|
618 | + */ |
|
619 | + public function getScript(array $params = []) |
|
620 | + { |
|
621 | + $this->checkRequiredParameters(['id'], $params); |
|
622 | + $url = '/_scripts/' . $this->encode($params['id']); |
|
623 | + $method = 'GET'; |
|
624 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
625 | + $headers = ['Accept' => 'application/json']; |
|
626 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
627 | + } |
|
628 | + /** |
|
629 | + * Returns all script contexts. |
|
630 | + * |
|
631 | + * @see https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-contexts.html |
|
632 | + * |
|
633 | + * @param array{ |
|
634 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
635 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
636 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
637 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
638 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
639 | + * } $params |
|
640 | + * |
|
641 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
642 | + * @throws ClientResponseException if the status code of response is 4xx |
|
643 | + * @throws ServerResponseException if the status code of response is 5xx |
|
644 | + * |
|
645 | + * @return Elasticsearch|Promise |
|
646 | + */ |
|
647 | + public function getScriptContext(array $params = []) |
|
648 | + { |
|
649 | + $url = '/_script_context'; |
|
650 | + $method = 'GET'; |
|
651 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
652 | + $headers = ['Accept' => 'application/json']; |
|
653 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
654 | + } |
|
655 | + /** |
|
656 | + * Returns available script types, languages and contexts |
|
657 | + * |
|
658 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html |
|
659 | + * |
|
660 | + * @param array{ |
|
661 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
662 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
663 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
664 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
665 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
666 | + * } $params |
|
667 | + * |
|
668 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
669 | + * @throws ClientResponseException if the status code of response is 4xx |
|
670 | + * @throws ServerResponseException if the status code of response is 5xx |
|
671 | + * |
|
672 | + * @return Elasticsearch|Promise |
|
673 | + */ |
|
674 | + public function getScriptLanguages(array $params = []) |
|
675 | + { |
|
676 | + $url = '/_script_language'; |
|
677 | + $method = 'GET'; |
|
678 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
679 | + $headers = ['Accept' => 'application/json']; |
|
680 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
681 | + } |
|
682 | + /** |
|
683 | + * Returns the source of a document. |
|
684 | + * |
|
685 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html |
|
686 | + * |
|
687 | + * @param array{ |
|
688 | + * id: string, // (REQUIRED) The document ID |
|
689 | + * index: string, // (REQUIRED) The name of the index |
|
690 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
691 | + * realtime: boolean, // Specify whether to perform the operation in realtime or search mode |
|
692 | + * refresh: boolean, // Refresh the shard containing the document before performing the operation |
|
693 | + * routing: string, // Specific routing value |
|
694 | + * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
695 | + * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
696 | + * _source_includes: list, // A list of fields to extract and return from the _source field |
|
697 | + * version: number, // Explicit version number for concurrency control |
|
698 | + * version_type: enum, // Specific version type |
|
699 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
700 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
701 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
702 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
703 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
704 | + * } $params |
|
705 | + * |
|
706 | + * @throws MissingParameterException if a required parameter is missing |
|
707 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
708 | + * @throws ClientResponseException if the status code of response is 4xx |
|
709 | + * @throws ServerResponseException if the status code of response is 5xx |
|
710 | + * |
|
711 | + * @return Elasticsearch|Promise |
|
712 | + */ |
|
713 | + public function getSource(array $params = []) |
|
714 | + { |
|
715 | + $this->checkRequiredParameters(['id', 'index'], $params); |
|
716 | + $url = '/' . $this->encode($params['index']) . '/_source/' . $this->encode($params['id']); |
|
717 | + $method = 'GET'; |
|
718 | + $url = $this->addQueryString($url, $params, ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
719 | + $headers = ['Accept' => 'application/json']; |
|
720 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
721 | + } |
|
722 | + /** |
|
723 | + * Returns the health of the cluster. |
|
724 | + * |
|
725 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/health-api.html |
|
726 | + * |
|
727 | + * @param array{ |
|
728 | + * feature: string, // A feature of the cluster, as returned by the top-level health API |
|
729 | + * timeout: time, // Explicit operation timeout |
|
730 | + * verbose: boolean, // Opt in for more information about the health of the system |
|
731 | + * size: int, // Limit the number of affected resources the health API returns |
|
732 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
733 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
734 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
735 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
736 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
737 | + * } $params |
|
738 | + * |
|
739 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
740 | + * @throws ClientResponseException if the status code of response is 4xx |
|
741 | + * @throws ServerResponseException if the status code of response is 5xx |
|
742 | + * |
|
743 | + * @return Elasticsearch|Promise |
|
744 | + */ |
|
745 | + public function healthReport(array $params = []) |
|
746 | + { |
|
747 | + if (isset($params['feature'])) { |
|
748 | + $url = '/_health_report/' . $this->encode($params['feature']); |
|
749 | + $method = 'GET'; |
|
750 | + } else { |
|
751 | + $url = '/_health_report'; |
|
752 | + $method = 'GET'; |
|
753 | + } |
|
754 | + $url = $this->addQueryString($url, $params, ['timeout', 'verbose', 'size', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
755 | + $headers = ['Accept' => 'application/json']; |
|
756 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
757 | + } |
|
758 | + /** |
|
759 | + * Creates or updates a document in an index. |
|
760 | + * |
|
761 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html |
|
762 | + * |
|
763 | + * @param array{ |
|
764 | + * id: string, // Document ID |
|
765 | + * index: string, // (REQUIRED) The name of the index |
|
766 | + * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
767 | + * op_type: enum, // Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID |
|
768 | + * refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. |
|
769 | + * routing: string, // Specific routing value |
|
770 | + * timeout: time, // Explicit operation timeout |
|
771 | + * version: number, // Explicit version number for concurrency control |
|
772 | + * version_type: enum, // Specific version type |
|
773 | + * if_seq_no: number, // only perform the index operation if the last operation that has changed the document has the specified sequence number |
|
774 | + * if_primary_term: number, // only perform the index operation if the last operation that has changed the document has the specified primary term |
|
775 | + * pipeline: string, // The pipeline id to preprocess incoming documents with |
|
776 | + * require_alias: boolean, // When true, requires destination to be an alias. Default is false |
|
777 | + * require_data_stream: boolean, // When true, requires the destination to be a data stream (existing or to-be-created). Default is false |
|
778 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
779 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
780 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
781 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
782 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
783 | + * body: array, // (REQUIRED) The document |
|
784 | + * } $params |
|
785 | + * |
|
786 | + * @throws MissingParameterException if a required parameter is missing |
|
787 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
788 | + * @throws ClientResponseException if the status code of response is 4xx |
|
789 | + * @throws ServerResponseException if the status code of response is 5xx |
|
790 | + * |
|
791 | + * @return Elasticsearch|Promise |
|
792 | + */ |
|
793 | + public function index(array $params = []) |
|
794 | + { |
|
795 | + $this->checkRequiredParameters(['index', 'body'], $params); |
|
796 | + if (isset($params['id'])) { |
|
797 | + $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); |
|
798 | + $method = 'PUT'; |
|
799 | + } else { |
|
800 | + $url = '/' . $this->encode($params['index']) . '/_doc'; |
|
801 | + $method = 'POST'; |
|
802 | + } |
|
803 | + $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'op_type', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'if_seq_no', 'if_primary_term', 'pipeline', 'require_alias', 'require_data_stream', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
804 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
805 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
806 | + } |
|
807 | + /** |
|
808 | + * Returns basic information about the cluster. |
|
809 | + * |
|
810 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html |
|
811 | + * |
|
812 | + * @param array{ |
|
813 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
814 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
815 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
816 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
817 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
818 | + * } $params |
|
819 | + * |
|
820 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
821 | + * @throws ClientResponseException if the status code of response is 4xx |
|
822 | + * @throws ServerResponseException if the status code of response is 5xx |
|
823 | + * |
|
824 | + * @return Elasticsearch|Promise |
|
825 | + */ |
|
826 | + public function info(array $params = []) |
|
827 | + { |
|
828 | + $url = '/'; |
|
829 | + $method = 'GET'; |
|
830 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
831 | + $headers = ['Accept' => 'application/json']; |
|
832 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
833 | + } |
|
834 | + /** |
|
835 | + * Performs a kNN search. |
|
836 | + * |
|
837 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html |
|
838 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
839 | + * |
|
840 | + * @param array{ |
|
841 | + * index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` to perform the operation on all indices |
|
842 | + * routing: list, // A comma-separated list of specific routing values |
|
843 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
844 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
845 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
846 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
847 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
848 | + * body: array, // The search definition |
|
849 | + * } $params |
|
850 | + * |
|
851 | + * @throws MissingParameterException if a required parameter is missing |
|
852 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
853 | + * @throws ClientResponseException if the status code of response is 4xx |
|
854 | + * @throws ServerResponseException if the status code of response is 5xx |
|
855 | + * |
|
856 | + * @return Elasticsearch|Promise |
|
857 | + */ |
|
858 | + public function knnSearch(array $params = []) |
|
859 | + { |
|
860 | + $this->checkRequiredParameters(['index'], $params); |
|
861 | + $url = '/' . $this->encode($params['index']) . '/_knn_search'; |
|
862 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
863 | + $url = $this->addQueryString($url, $params, ['routing', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
864 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
865 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
866 | + } |
|
867 | + /** |
|
868 | + * Allows to get multiple documents in one request. |
|
869 | + * |
|
870 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html |
|
871 | + * |
|
872 | + * @param array{ |
|
873 | + * index: string, // The name of the index |
|
874 | + * force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. |
|
875 | + * stored_fields: list, // A comma-separated list of stored fields to return in the response |
|
876 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
877 | + * realtime: boolean, // Specify whether to perform the operation in realtime or search mode |
|
878 | + * refresh: boolean, // Refresh the shard containing the document before performing the operation |
|
879 | + * routing: string, // Specific routing value |
|
880 | + * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
881 | + * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
882 | + * _source_includes: list, // A list of fields to extract and return from the _source field |
|
883 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
884 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
885 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
886 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
887 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
888 | + * body: array, // (REQUIRED) Document identifiers; can be either `docs` (containing full document information) or `ids` (when index is provided in the URL. |
|
889 | + * } $params |
|
890 | + * |
|
891 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
892 | + * @throws ClientResponseException if the status code of response is 4xx |
|
893 | + * @throws ServerResponseException if the status code of response is 5xx |
|
894 | + * |
|
895 | + * @return Elasticsearch|Promise |
|
896 | + */ |
|
897 | + public function mget(array $params = []) |
|
898 | + { |
|
899 | + $this->checkRequiredParameters(['body'], $params); |
|
900 | + if (isset($params['index'])) { |
|
901 | + $url = '/' . $this->encode($params['index']) . '/_mget'; |
|
902 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
903 | + } else { |
|
904 | + $url = '/_mget'; |
|
905 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
906 | + } |
|
907 | + $url = $this->addQueryString($url, $params, ['force_synthetic_source', 'stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
908 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
909 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
910 | + } |
|
911 | + /** |
|
912 | + * Allows to execute several search operations in one request. |
|
913 | + * |
|
914 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html |
|
915 | + * |
|
916 | + * @param array{ |
|
917 | + * index: list, // A comma-separated list of index names to use as default |
|
918 | + * search_type: enum, // Search operation type |
|
919 | + * max_concurrent_searches: number, // Controls the maximum number of concurrent searches the multi search api will execute |
|
920 | + * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
921 | + * pre_filter_shard_size: number, // A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. |
|
922 | + * max_concurrent_shard_requests: number, // The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests |
|
923 | + * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response |
|
924 | + * ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution |
|
925 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
926 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
927 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
928 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
929 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
930 | + * body: array, // (REQUIRED) The request definitions (metadata-search request definition pairs), separated by newlines |
|
931 | + * } $params |
|
932 | + * |
|
933 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
934 | + * @throws ClientResponseException if the status code of response is 4xx |
|
935 | + * @throws ServerResponseException if the status code of response is 5xx |
|
936 | + * |
|
937 | + * @return Elasticsearch|Promise |
|
938 | + */ |
|
939 | + public function msearch(array $params = []) |
|
940 | + { |
|
941 | + $this->checkRequiredParameters(['body'], $params); |
|
942 | + if (isset($params['index'])) { |
|
943 | + $url = '/' . $this->encode($params['index']) . '/_msearch'; |
|
944 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
945 | + } else { |
|
946 | + $url = '/_msearch'; |
|
947 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
948 | + } |
|
949 | + $url = $this->addQueryString($url, $params, ['search_type', 'max_concurrent_searches', 'typed_keys', 'pre_filter_shard_size', 'max_concurrent_shard_requests', 'rest_total_hits_as_int', 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
950 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson']; |
|
951 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
952 | + } |
|
953 | + /** |
|
954 | + * Allows to execute several search template operations in one request. |
|
955 | + * |
|
956 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html |
|
957 | + * |
|
958 | + * @param array{ |
|
959 | + * index: list, // A comma-separated list of index names to use as default |
|
960 | + * search_type: enum, // Search operation type |
|
961 | + * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
962 | + * max_concurrent_searches: number, // Controls the maximum number of concurrent searches the multi search api will execute |
|
963 | + * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response |
|
964 | + * ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution |
|
965 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
966 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
967 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
968 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
969 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
970 | + * body: array, // (REQUIRED) The request definitions (metadata-search request definition pairs), separated by newlines |
|
971 | + * } $params |
|
972 | + * |
|
973 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
974 | + * @throws ClientResponseException if the status code of response is 4xx |
|
975 | + * @throws ServerResponseException if the status code of response is 5xx |
|
976 | + * |
|
977 | + * @return Elasticsearch|Promise |
|
978 | + */ |
|
979 | + public function msearchTemplate(array $params = []) |
|
980 | + { |
|
981 | + $this->checkRequiredParameters(['body'], $params); |
|
982 | + if (isset($params['index'])) { |
|
983 | + $url = '/' . $this->encode($params['index']) . '/_msearch/template'; |
|
984 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
985 | + } else { |
|
986 | + $url = '/_msearch/template'; |
|
987 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
988 | + } |
|
989 | + $url = $this->addQueryString($url, $params, ['search_type', 'typed_keys', 'max_concurrent_searches', 'rest_total_hits_as_int', 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
990 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson']; |
|
991 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
992 | + } |
|
993 | + /** |
|
994 | + * Returns multiple termvectors in one request. |
|
995 | + * |
|
996 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html |
|
997 | + * |
|
998 | + * @param array{ |
|
999 | + * index: string, // The index in which the document resides. |
|
1000 | + * ids: list, // A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body |
|
1001 | + * term_statistics: boolean, // Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1002 | + * field_statistics: boolean, // Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1003 | + * fields: list, // A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1004 | + * offsets: boolean, // Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1005 | + * positions: boolean, // Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1006 | + * payloads: boolean, // Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1007 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1008 | + * routing: string, // Specific routing value. Applies to all returned documents unless otherwise specified in body "params" or "docs". |
|
1009 | + * realtime: boolean, // Specifies if requests are real-time as opposed to near-real-time (default: true). |
|
1010 | + * version: number, // Explicit version number for concurrency control |
|
1011 | + * version_type: enum, // Specific version type |
|
1012 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1013 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1014 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1015 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1016 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1017 | + * body: array, // Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation. |
|
1018 | + * } $params |
|
1019 | + * |
|
1020 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1021 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1022 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1023 | + * |
|
1024 | + * @return Elasticsearch|Promise |
|
1025 | + */ |
|
1026 | + public function mtermvectors(array $params = []) |
|
1027 | + { |
|
1028 | + if (isset($params['index'])) { |
|
1029 | + $url = '/' . $this->encode($params['index']) . '/_mtermvectors'; |
|
1030 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1031 | + } else { |
|
1032 | + $url = '/_mtermvectors'; |
|
1033 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1034 | + } |
|
1035 | + $url = $this->addQueryString($url, $params, ['ids', 'term_statistics', 'field_statistics', 'fields', 'offsets', 'positions', 'payloads', 'preference', 'routing', 'realtime', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1036 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1037 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1038 | + } |
|
1039 | + /** |
|
1040 | + * Open a point in time that can be used in subsequent searches |
|
1041 | + * |
|
1042 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html |
|
1043 | + * |
|
1044 | + * @param array{ |
|
1045 | + * index: list, // (REQUIRED) A comma-separated list of index names to open point in time; use `_all` or empty string to perform the operation on all indices |
|
1046 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
1047 | + * routing: string, // Specific routing value |
|
1048 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1049 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1050 | + * keep_alive: string, // Specific the time to live for the point in time |
|
1051 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1052 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1053 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1054 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1055 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1056 | + * body: array, // An index_filter specified with the Query DSL |
|
1057 | + * } $params |
|
1058 | + * |
|
1059 | + * @throws MissingParameterException if a required parameter is missing |
|
1060 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1061 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1062 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1063 | + * |
|
1064 | + * @return Elasticsearch|Promise |
|
1065 | + */ |
|
1066 | + public function openPointInTime(array $params = []) |
|
1067 | + { |
|
1068 | + $this->checkRequiredParameters(['index', 'keep_alive'], $params); |
|
1069 | + $url = '/' . $this->encode($params['index']) . '/_pit'; |
|
1070 | + $method = 'POST'; |
|
1071 | + $url = $this->addQueryString($url, $params, ['preference', 'routing', 'ignore_unavailable', 'expand_wildcards', 'keep_alive', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1072 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1073 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1074 | + } |
|
1075 | + /** |
|
1076 | + * Returns whether the cluster is running. |
|
1077 | + * |
|
1078 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html |
|
1079 | + * |
|
1080 | + * @param array{ |
|
1081 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1082 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1083 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1084 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1085 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1086 | + * } $params |
|
1087 | + * |
|
1088 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1089 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1090 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1091 | + * |
|
1092 | + * @return Elasticsearch|Promise |
|
1093 | + */ |
|
1094 | + public function ping(array $params = []) |
|
1095 | + { |
|
1096 | + $url = '/'; |
|
1097 | + $method = 'HEAD'; |
|
1098 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1099 | + $headers = ['Accept' => 'application/json']; |
|
1100 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1101 | + } |
|
1102 | + /** |
|
1103 | + * Creates or updates a script. |
|
1104 | + * |
|
1105 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html |
|
1106 | + * |
|
1107 | + * @param array{ |
|
1108 | + * id: string, // (REQUIRED) Script ID |
|
1109 | + * context: string, // Script context |
|
1110 | + * timeout: time, // Explicit operation timeout |
|
1111 | + * master_timeout: time, // Specify timeout for connection to master |
|
1112 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1113 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1114 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1115 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1116 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1117 | + * body: array, // (REQUIRED) The document |
|
1118 | + * } $params |
|
1119 | + * |
|
1120 | + * @throws MissingParameterException if a required parameter is missing |
|
1121 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1122 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1123 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1124 | + * |
|
1125 | + * @return Elasticsearch|Promise |
|
1126 | + */ |
|
1127 | + public function putScript(array $params = []) |
|
1128 | + { |
|
1129 | + $this->checkRequiredParameters(['id', 'body'], $params); |
|
1130 | + if (isset($params['context'])) { |
|
1131 | + $url = '/_scripts/' . $this->encode($params['id']) . '/' . $this->encode($params['context']); |
|
1132 | + $method = 'PUT'; |
|
1133 | + } else { |
|
1134 | + $url = '/_scripts/' . $this->encode($params['id']); |
|
1135 | + $method = 'PUT'; |
|
1136 | + } |
|
1137 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1138 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1139 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1140 | + } |
|
1141 | + /** |
|
1142 | + * Allows to evaluate the quality of ranked search results over a set of typical search queries |
|
1143 | + * |
|
1144 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html |
|
1145 | + * |
|
1146 | + * @param array{ |
|
1147 | + * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
1148 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1149 | + * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
1150 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1151 | + * search_type: enum, // Search operation type |
|
1152 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1153 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1154 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1155 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1156 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1157 | + * body: array, // (REQUIRED) The ranking evaluation search definition, including search requests, document ratings and ranking metric definition. |
|
1158 | + * } $params |
|
1159 | + * |
|
1160 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1161 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1162 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1163 | + * |
|
1164 | + * @return Elasticsearch|Promise |
|
1165 | + */ |
|
1166 | + public function rankEval(array $params = []) |
|
1167 | + { |
|
1168 | + $this->checkRequiredParameters(['body'], $params); |
|
1169 | + if (isset($params['index'])) { |
|
1170 | + $url = '/' . $this->encode($params['index']) . '/_rank_eval'; |
|
1171 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1172 | + } else { |
|
1173 | + $url = '/_rank_eval'; |
|
1174 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1175 | + } |
|
1176 | + $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'search_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1177 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1178 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1179 | + } |
|
1180 | + /** |
|
1181 | + * Allows to copy documents from one index to another, optionally filtering the source |
|
1182 | + * documents by a query, changing the destination index settings, or fetching the |
|
1183 | + * documents from a remote cluster. |
|
1184 | + * |
|
1185 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html |
|
1186 | + * |
|
1187 | + * @param array{ |
|
1188 | + * refresh: boolean, // Should the affected indexes be refreshed? |
|
1189 | + * timeout: time, // Time each individual bulk request should wait for shards that are unavailable. |
|
1190 | + * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
1191 | + * wait_for_completion: boolean, // Should the request should block until the reindex is complete. |
|
1192 | + * requests_per_second: number, // The throttle to set on this request in sub-requests per second. -1 means no throttle. |
|
1193 | + * scroll: time, // Control how long to keep the search context alive |
|
1194 | + * slices: number|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. |
|
1195 | + * max_docs: number, // Maximum number of documents to process (default: all documents) |
|
1196 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1197 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1198 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1199 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1200 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1201 | + * body: array, // (REQUIRED) The search definition using the Query DSL and the prototype for the index request. |
|
1202 | + * } $params |
|
1203 | + * |
|
1204 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1205 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1206 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1207 | + * |
|
1208 | + * @return Elasticsearch|Promise |
|
1209 | + */ |
|
1210 | + public function reindex(array $params = []) |
|
1211 | + { |
|
1212 | + $this->checkRequiredParameters(['body'], $params); |
|
1213 | + $url = '/_reindex'; |
|
1214 | + $method = 'POST'; |
|
1215 | + $url = $this->addQueryString($url, $params, ['refresh', 'timeout', 'wait_for_active_shards', 'wait_for_completion', 'requests_per_second', 'scroll', 'slices', 'max_docs', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1216 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1217 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1218 | + } |
|
1219 | + /** |
|
1220 | + * Changes the number of requests per second for a particular Reindex operation. |
|
1221 | + * |
|
1222 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html |
|
1223 | + * |
|
1224 | + * @param array{ |
|
1225 | + * task_id: string, // (REQUIRED) The task id to rethrottle |
|
1226 | + * requests_per_second: number, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. |
|
1227 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1228 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1229 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1230 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1231 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1232 | + * } $params |
|
1233 | + * |
|
1234 | + * @throws MissingParameterException if a required parameter is missing |
|
1235 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1236 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1237 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1238 | + * |
|
1239 | + * @return Elasticsearch|Promise |
|
1240 | + */ |
|
1241 | + public function reindexRethrottle(array $params = []) |
|
1242 | + { |
|
1243 | + $this->checkRequiredParameters(['task_id', 'requests_per_second'], $params); |
|
1244 | + $url = '/_reindex/' . $this->encode($params['task_id']) . '/_rethrottle'; |
|
1245 | + $method = 'POST'; |
|
1246 | + $url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1247 | + $headers = ['Accept' => 'application/json']; |
|
1248 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1249 | + } |
|
1250 | + /** |
|
1251 | + * Allows to use the Mustache language to pre-render a search definition. |
|
1252 | + * |
|
1253 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/render-search-template-api.html |
|
1254 | + * |
|
1255 | + * @param array{ |
|
1256 | + * id: string, // The id of the stored search template |
|
1257 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1258 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1259 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1260 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1261 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1262 | + * body: array, // The search definition template and its params |
|
1263 | + * } $params |
|
1264 | + * |
|
1265 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1266 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1267 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1268 | + * |
|
1269 | + * @return Elasticsearch|Promise |
|
1270 | + */ |
|
1271 | + public function renderSearchTemplate(array $params = []) |
|
1272 | + { |
|
1273 | + if (isset($params['id'])) { |
|
1274 | + $url = '/_render/template/' . $this->encode($params['id']); |
|
1275 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1276 | + } else { |
|
1277 | + $url = '/_render/template'; |
|
1278 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1279 | + } |
|
1280 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1281 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1282 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1283 | + } |
|
1284 | + /** |
|
1285 | + * Allows an arbitrary script to be executed and a result to be returned |
|
1286 | + * |
|
1287 | + * @see https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html |
|
1288 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
1289 | + * |
|
1290 | + * @param array{ |
|
1291 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1292 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1293 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1294 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1295 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1296 | + * body: array, // The script to execute |
|
1297 | + * } $params |
|
1298 | + * |
|
1299 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1300 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1301 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1302 | + * |
|
1303 | + * @return Elasticsearch|Promise |
|
1304 | + */ |
|
1305 | + public function scriptsPainlessExecute(array $params = []) |
|
1306 | + { |
|
1307 | + $url = '/_scripts/painless/_execute'; |
|
1308 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1309 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1310 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1311 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1312 | + } |
|
1313 | + /** |
|
1314 | + * Allows to retrieve a large numbers of results from a single search request. |
|
1315 | + * |
|
1316 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll |
|
1317 | + * |
|
1318 | + * @param array{ |
|
1319 | + * scroll_id: string, // The scroll ID |
|
1320 | + * scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search |
|
1321 | + * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response |
|
1322 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1323 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1324 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1325 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1326 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1327 | + * body: array, // The scroll ID if not passed by URL or query parameter. |
|
1328 | + * } $params |
|
1329 | + * |
|
1330 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1331 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1332 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1333 | + * |
|
1334 | + * @return Elasticsearch|Promise |
|
1335 | + */ |
|
1336 | + public function scroll(array $params = []) |
|
1337 | + { |
|
1338 | + if (isset($params['scroll_id'])) { |
|
1339 | + $url = '/_search/scroll/' . $this->encode($params['scroll_id']); |
|
1340 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1341 | + } else { |
|
1342 | + $url = '/_search/scroll'; |
|
1343 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1344 | + } |
|
1345 | + $url = $this->addQueryString($url, $params, ['scroll', 'rest_total_hits_as_int', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1346 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1347 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1348 | + } |
|
1349 | + /** |
|
1350 | + * Returns results matching a query. |
|
1351 | + * |
|
1352 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html |
|
1353 | + * |
|
1354 | + * @param array{ |
|
1355 | + * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
1356 | + * analyzer: string, // The analyzer to use for the query string |
|
1357 | + * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) |
|
1358 | + * ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution |
|
1359 | + * default_operator: enum, // The default operator for query string query (AND or OR) |
|
1360 | + * df: string, // The field to use as default where no field prefix is given in the query string |
|
1361 | + * explain: boolean, // Specify whether to return detailed information about score computation as part of a hit |
|
1362 | + * stored_fields: list, // A comma-separated list of stored fields to return as part of a hit |
|
1363 | + * docvalue_fields: list, // A comma-separated list of fields to return as the docvalue representation of a field for each hit |
|
1364 | + * from: number, // Starting offset (default: 0) |
|
1365 | + * force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. |
|
1366 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1367 | + * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled |
|
1368 | + * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
1369 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1370 | + * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
1371 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
1372 | + * q: string, // Query in the Lucene query string syntax |
|
1373 | + * routing: list, // A comma-separated list of specific routing values |
|
1374 | + * scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search |
|
1375 | + * search_type: enum, // Search operation type |
|
1376 | + * size: number, // Number of hits to return (default: 10) |
|
1377 | + * sort: list, // A comma-separated list of <field>:<direction> pairs |
|
1378 | + * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
1379 | + * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
1380 | + * _source_includes: list, // A list of fields to extract and return from the _source field |
|
1381 | + * terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. |
|
1382 | + * stats: list, // Specific 'tag' of the request for logging and statistical purposes |
|
1383 | + * suggest_field: string, // Specify which field to use for suggestions |
|
1384 | + * suggest_mode: enum, // Specify suggest mode |
|
1385 | + * suggest_size: number, // How many suggestions to return in response |
|
1386 | + * suggest_text: string, // The source text for which the suggestions should be returned |
|
1387 | + * timeout: time, // Explicit operation timeout |
|
1388 | + * track_scores: boolean, // Whether to calculate and return scores even if they are not used for sorting |
|
1389 | + * track_total_hits: boolean|long, // Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number. |
|
1390 | + * allow_partial_search_results: boolean, // Indicate if an error should be returned if there is a partial search failure or timeout |
|
1391 | + * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
1392 | + * version: boolean, // Specify whether to return document version as part of a hit |
|
1393 | + * seq_no_primary_term: boolean, // Specify whether to return sequence number and primary term of the last modification of each hit |
|
1394 | + * request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to index level setting |
|
1395 | + * batched_reduce_size: number, // The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. |
|
1396 | + * max_concurrent_shard_requests: number, // The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests |
|
1397 | + * pre_filter_shard_size: number, // A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. |
|
1398 | + * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response |
|
1399 | + * min_compatible_shard_node: string, // The minimum compatible version that all shards involved in search should have for this request to be successful |
|
1400 | + * include_named_queries_score: boolean, // Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false) |
|
1401 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1402 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1403 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1404 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1405 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1406 | + * body: array, // The search definition using the Query DSL |
|
1407 | + * } $params |
|
1408 | + * |
|
1409 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1410 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1411 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1412 | + * |
|
1413 | + * @return Elasticsearch|Promise |
|
1414 | + */ |
|
1415 | + public function search(array $params = []) |
|
1416 | + { |
|
1417 | + if (isset($params['index'])) { |
|
1418 | + $url = '/' . $this->encode($params['index']) . '/_search'; |
|
1419 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1420 | + } else { |
|
1421 | + $url = '/_search'; |
|
1422 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1423 | + } |
|
1424 | + $url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'ccs_minimize_roundtrips', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'force_synthetic_source', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'size', 'sort', '_source', '_source_excludes', '_source_includes', 'terminate_after', 'stats', 'suggest_field', 'suggest_mode', 'suggest_size', 'suggest_text', 'timeout', 'track_scores', 'track_total_hits', 'allow_partial_search_results', 'typed_keys', 'version', 'seq_no_primary_term', 'request_cache', 'batched_reduce_size', 'max_concurrent_shard_requests', 'pre_filter_shard_size', 'rest_total_hits_as_int', 'min_compatible_shard_node', 'include_named_queries_score', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1425 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1426 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1427 | + } |
|
1428 | + /** |
|
1429 | + * Searches a vector tile for geospatial values. Returns results as a binary Mapbox vector tile. |
|
1430 | + * |
|
1431 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-vector-tile-api.html |
|
1432 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
1433 | + * |
|
1434 | + * @param array{ |
|
1435 | + * index: list, // (REQUIRED) Comma-separated list of data streams, indices, or aliases to search |
|
1436 | + * field: string, // (REQUIRED) Field containing geospatial data to return |
|
1437 | + * zoom: int, // (REQUIRED) Zoom level for the vector tile to search |
|
1438 | + * x: int, // (REQUIRED) X coordinate for the vector tile to search |
|
1439 | + * y: int, // (REQUIRED) Y coordinate for the vector tile to search |
|
1440 | + * exact_bounds: boolean, // If false, the meta layer's feature is the bounding box of the tile. If true, the meta layer's feature is a bounding box resulting from a `geo_bounds` aggregation. |
|
1441 | + * extent: int, // Size, in pixels, of a side of the vector tile. |
|
1442 | + * grid_precision: int, // Additional zoom levels available through the aggs layer. Accepts 0-8. |
|
1443 | + * grid_type: enum, // Determines the geometry type for features in the aggs layer. |
|
1444 | + * size: int, // Maximum number of features to return in the hits layer. Accepts 0-10000. |
|
1445 | + * track_total_hits: boolean|long, // Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number. |
|
1446 | + * with_labels: boolean, // If true, the hits and aggs layers will contain additional point features with suggested label positions for the original features. |
|
1447 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1448 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1449 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1450 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1451 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1452 | + * body: array, // Search request body. |
|
1453 | + * } $params |
|
1454 | + * |
|
1455 | + * @throws MissingParameterException if a required parameter is missing |
|
1456 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1457 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1458 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1459 | + * |
|
1460 | + * @return Elasticsearch|Promise |
|
1461 | + */ |
|
1462 | + public function searchMvt(array $params = []) |
|
1463 | + { |
|
1464 | + $this->checkRequiredParameters(['index', 'field', 'zoom', 'x', 'y'], $params); |
|
1465 | + $url = '/' . $this->encode($params['index']) . '/_mvt/' . $this->encode($params['field']) . '/' . $this->encode($params['zoom']) . '/' . $this->encode($params['x']) . '/' . $this->encode($params['y']); |
|
1466 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1467 | + $url = $this->addQueryString($url, $params, ['exact_bounds', 'extent', 'grid_precision', 'grid_type', 'size', 'track_total_hits', 'with_labels', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1468 | + $headers = ['Accept' => 'application/vnd.mapbox-vector-tile', 'Content-Type' => 'application/json']; |
|
1469 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1470 | + } |
|
1471 | + /** |
|
1472 | + * Returns information about the indices and shards that a search request would be executed against. |
|
1473 | + * |
|
1474 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html |
|
1475 | + * |
|
1476 | + * @param array{ |
|
1477 | + * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
1478 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
1479 | + * routing: string, // Specific routing value |
|
1480 | + * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
1481 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1482 | + * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
1483 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1484 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1485 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1486 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1487 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1488 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1489 | + * } $params |
|
1490 | + * |
|
1491 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1492 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1493 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1494 | + * |
|
1495 | + * @return Elasticsearch|Promise |
|
1496 | + */ |
|
1497 | + public function searchShards(array $params = []) |
|
1498 | + { |
|
1499 | + if (isset($params['index'])) { |
|
1500 | + $url = '/' . $this->encode($params['index']) . '/_search_shards'; |
|
1501 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1502 | + } else { |
|
1503 | + $url = '/_search_shards'; |
|
1504 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1505 | + } |
|
1506 | + $url = $this->addQueryString($url, $params, ['preference', 'routing', 'local', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1507 | + $headers = ['Accept' => 'application/json']; |
|
1508 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1509 | + } |
|
1510 | + /** |
|
1511 | + * Allows to use the Mustache language to pre-render a search definition. |
|
1512 | + * |
|
1513 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html |
|
1514 | + * |
|
1515 | + * @param array{ |
|
1516 | + * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
1517 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1518 | + * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled |
|
1519 | + * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
1520 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1521 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
1522 | + * routing: list, // A comma-separated list of specific routing values |
|
1523 | + * scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search |
|
1524 | + * search_type: enum, // Search operation type |
|
1525 | + * explain: boolean, // Specify whether to return detailed information about score computation as part of a hit |
|
1526 | + * profile: boolean, // Specify whether to profile the query execution |
|
1527 | + * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
1528 | + * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response |
|
1529 | + * ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution |
|
1530 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1531 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1532 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1533 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1534 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1535 | + * body: array, // (REQUIRED) The search definition template and its params |
|
1536 | + * } $params |
|
1537 | + * |
|
1538 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1539 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1540 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1541 | + * |
|
1542 | + * @return Elasticsearch|Promise |
|
1543 | + */ |
|
1544 | + public function searchTemplate(array $params = []) |
|
1545 | + { |
|
1546 | + $this->checkRequiredParameters(['body'], $params); |
|
1547 | + if (isset($params['index'])) { |
|
1548 | + $url = '/' . $this->encode($params['index']) . '/_search/template'; |
|
1549 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1550 | + } else { |
|
1551 | + $url = '/_search/template'; |
|
1552 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1553 | + } |
|
1554 | + $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'preference', 'routing', 'scroll', 'search_type', 'explain', 'profile', 'typed_keys', 'rest_total_hits_as_int', 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1555 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1556 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1557 | + } |
|
1558 | + /** |
|
1559 | + * The terms enum API can be used to discover terms in the index that begin with the provided string. It is designed for low-latency look-ups used in auto-complete scenarios. |
|
1560 | + * |
|
1561 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-terms-enum.html |
|
1562 | + * |
|
1563 | + * @param array{ |
|
1564 | + * index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
1565 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1566 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1567 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1568 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1569 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1570 | + * body: array, // field name, string which is the prefix expected in matching terms, timeout and size for max number of results |
|
1571 | + * } $params |
|
1572 | + * |
|
1573 | + * @throws MissingParameterException if a required parameter is missing |
|
1574 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1575 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1576 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1577 | + * |
|
1578 | + * @return Elasticsearch|Promise |
|
1579 | + */ |
|
1580 | + public function termsEnum(array $params = []) |
|
1581 | + { |
|
1582 | + $this->checkRequiredParameters(['index'], $params); |
|
1583 | + $url = '/' . $this->encode($params['index']) . '/_terms_enum'; |
|
1584 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1585 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1586 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1587 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1588 | + } |
|
1589 | + /** |
|
1590 | + * Returns information and statistics about terms in the fields of a particular document. |
|
1591 | + * |
|
1592 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html |
|
1593 | + * |
|
1594 | + * @param array{ |
|
1595 | + * index: string, // (REQUIRED) The index in which the document resides. |
|
1596 | + * id: string, // The id of the document, when not specified a doc param should be supplied. |
|
1597 | + * term_statistics: boolean, // Specifies if total term frequency and document frequency should be returned. |
|
1598 | + * field_statistics: boolean, // Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. |
|
1599 | + * fields: list, // A comma-separated list of fields to return. |
|
1600 | + * offsets: boolean, // Specifies if term offsets should be returned. |
|
1601 | + * positions: boolean, // Specifies if term positions should be returned. |
|
1602 | + * payloads: boolean, // Specifies if term payloads should be returned. |
|
1603 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random). |
|
1604 | + * routing: string, // Specific routing value. |
|
1605 | + * realtime: boolean, // Specifies if request is real-time as opposed to near-real-time (default: true). |
|
1606 | + * version: number, // Explicit version number for concurrency control |
|
1607 | + * version_type: enum, // Specific version type |
|
1608 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1609 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1610 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1611 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1612 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1613 | + * body: array, // Define parameters and or supply a document to get termvectors for. See documentation. |
|
1614 | + * } $params |
|
1615 | + * |
|
1616 | + * @throws MissingParameterException if a required parameter is missing |
|
1617 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1618 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1619 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1620 | + * |
|
1621 | + * @return Elasticsearch|Promise |
|
1622 | + */ |
|
1623 | + public function termvectors(array $params = []) |
|
1624 | + { |
|
1625 | + $this->checkRequiredParameters(['index'], $params); |
|
1626 | + if (isset($params['id'])) { |
|
1627 | + $url = '/' . $this->encode($params['index']) . '/_termvectors/' . $this->encode($params['id']); |
|
1628 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1629 | + } else { |
|
1630 | + $url = '/' . $this->encode($params['index']) . '/_termvectors'; |
|
1631 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1632 | + } |
|
1633 | + $url = $this->addQueryString($url, $params, ['term_statistics', 'field_statistics', 'fields', 'offsets', 'positions', 'payloads', 'preference', 'routing', 'realtime', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1634 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1635 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1636 | + } |
|
1637 | + /** |
|
1638 | + * Updates a document with a script or partial document. |
|
1639 | + * |
|
1640 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html |
|
1641 | + * |
|
1642 | + * @param array{ |
|
1643 | + * id: string, // (REQUIRED) Document ID |
|
1644 | + * index: string, // (REQUIRED) The name of the index |
|
1645 | + * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
1646 | + * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
1647 | + * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
1648 | + * _source_includes: list, // A list of fields to extract and return from the _source field |
|
1649 | + * lang: string, // The script language (default: painless) |
|
1650 | + * refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. |
|
1651 | + * retry_on_conflict: number, // Specify how many times should the operation be retried when a conflict occurs (default: 0) |
|
1652 | + * routing: string, // Specific routing value |
|
1653 | + * timeout: time, // Explicit operation timeout |
|
1654 | + * if_seq_no: number, // only perform the update operation if the last operation that has changed the document has the specified sequence number |
|
1655 | + * if_primary_term: number, // only perform the update operation if the last operation that has changed the document has the specified primary term |
|
1656 | + * require_alias: boolean, // When true, requires destination is an alias. Default is false |
|
1657 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1658 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1659 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1660 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1661 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1662 | + * body: array, // (REQUIRED) The request definition requires either `script` or partial `doc` |
|
1663 | + * } $params |
|
1664 | + * |
|
1665 | + * @throws MissingParameterException if a required parameter is missing |
|
1666 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1667 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1668 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1669 | + * |
|
1670 | + * @return Elasticsearch|Promise |
|
1671 | + */ |
|
1672 | + public function update(array $params = []) |
|
1673 | + { |
|
1674 | + $this->checkRequiredParameters(['id', 'index', 'body'], $params); |
|
1675 | + $url = '/' . $this->encode($params['index']) . '/_update/' . $this->encode($params['id']); |
|
1676 | + $method = 'POST'; |
|
1677 | + $url = $this->addQueryString($url, $params, ['wait_for_active_shards', '_source', '_source_excludes', '_source_includes', 'lang', 'refresh', 'retry_on_conflict', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1678 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1679 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1680 | + } |
|
1681 | + /** |
|
1682 | + * Performs an update on every document in the index without changing the source, |
|
1683 | + * for example to pick up a mapping change. |
|
1684 | + * |
|
1685 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html |
|
1686 | + * |
|
1687 | + * @param array{ |
|
1688 | + * index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
1689 | + * analyzer: string, // The analyzer to use for the query string |
|
1690 | + * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) |
|
1691 | + * default_operator: enum, // The default operator for query string query (AND or OR) |
|
1692 | + * df: string, // The field to use as default where no field prefix is given in the query string |
|
1693 | + * from: number, // Starting offset (default: 0) |
|
1694 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1695 | + * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) |
|
1696 | + * conflicts: enum, // What to do when the update by query hits version conflicts? |
|
1697 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1698 | + * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
1699 | + * pipeline: string, // Ingest pipeline to set on index requests made by this action. (default: none) |
|
1700 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
1701 | + * q: string, // Query in the Lucene query string syntax |
|
1702 | + * routing: list, // A comma-separated list of specific routing values |
|
1703 | + * scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search |
|
1704 | + * search_type: enum, // Search operation type |
|
1705 | + * search_timeout: time, // Explicit timeout for each search request. Defaults to no timeout. |
|
1706 | + * max_docs: number, // Maximum number of documents to process (default: all documents) |
|
1707 | + * sort: list, // A comma-separated list of <field>:<direction> pairs |
|
1708 | + * terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. |
|
1709 | + * stats: list, // Specific 'tag' of the request for logging and statistical purposes |
|
1710 | + * version: boolean, // Specify whether to return document version as part of a hit |
|
1711 | + * version_type: boolean, // Should the document increment the version number (internal) on hit or not (reindex) |
|
1712 | + * request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to index level setting |
|
1713 | + * refresh: boolean, // Should the affected indexes be refreshed? |
|
1714 | + * timeout: time, // Time each individual bulk request should wait for shards that are unavailable. |
|
1715 | + * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the update by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) |
|
1716 | + * scroll_size: number, // Size on the scroll request powering the update by query |
|
1717 | + * wait_for_completion: boolean, // Should the request should block until the update by query operation is complete. |
|
1718 | + * requests_per_second: number, // The throttle to set on this request in sub-requests per second. -1 means no throttle. |
|
1719 | + * slices: number|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. |
|
1720 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1721 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1722 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1723 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1724 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1725 | + * body: array, // The search definition using the Query DSL |
|
1726 | + * } $params |
|
1727 | + * |
|
1728 | + * @throws MissingParameterException if a required parameter is missing |
|
1729 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1730 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1731 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1732 | + * |
|
1733 | + * @return Elasticsearch|Promise |
|
1734 | + */ |
|
1735 | + public function updateByQuery(array $params = []) |
|
1736 | + { |
|
1737 | + $this->checkRequiredParameters(['index'], $params); |
|
1738 | + $url = '/' . $this->encode($params['index']) . '/_update_by_query'; |
|
1739 | + $method = 'POST'; |
|
1740 | + $url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'pipeline', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'max_docs', 'sort', 'terminate_after', 'stats', 'version', 'version_type', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1741 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1742 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1743 | + } |
|
1744 | + /** |
|
1745 | + * Changes the number of requests per second for a particular Update By Query operation. |
|
1746 | + * |
|
1747 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html |
|
1748 | + * |
|
1749 | + * @param array{ |
|
1750 | + * task_id: string, // (REQUIRED) The task id to rethrottle |
|
1751 | + * requests_per_second: number, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. |
|
1752 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1753 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1754 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1755 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1756 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1757 | + * } $params |
|
1758 | + * |
|
1759 | + * @throws MissingParameterException if a required parameter is missing |
|
1760 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1761 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1762 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1763 | + * |
|
1764 | + * @return Elasticsearch|Promise |
|
1765 | + */ |
|
1766 | + public function updateByQueryRethrottle(array $params = []) |
|
1767 | + { |
|
1768 | + $this->checkRequiredParameters(['task_id', 'requests_per_second'], $params); |
|
1769 | + $url = '/_update_by_query/' . $this->encode($params['task_id']) . '/_rethrottle'; |
|
1770 | + $method = 'POST'; |
|
1771 | + $url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1772 | + $headers = ['Accept' => 'application/json']; |
|
1773 | + return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
|
1774 | + } |
|
1775 | 1775 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Traits; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Exception\ClientResponseException; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $this->checkRequiredParameters(['body'], $params); |
64 | 64 | if (isset($params['index'])) { |
65 | - $url = '/' . $this->encode($params['index']) . '/_bulk'; |
|
65 | + $url = '/'.$this->encode($params['index']).'/_bulk'; |
|
66 | 66 | $method = 'POST'; |
67 | 67 | } else { |
68 | 68 | $url = '/_bulk'; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | public function clearScroll(array $params = []) |
97 | 97 | { |
98 | 98 | if (isset($params['scroll_id'])) { |
99 | - $url = '/_search/scroll/' . $this->encode($params['scroll_id']); |
|
99 | + $url = '/_search/scroll/'.$this->encode($params['scroll_id']); |
|
100 | 100 | $method = 'DELETE'; |
101 | 101 | } else { |
102 | 102 | $url = '/_search/scroll'; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | public function count(array $params = []) |
173 | 173 | { |
174 | 174 | if (isset($params['index'])) { |
175 | - $url = '/' . $this->encode($params['index']) . '/_count'; |
|
175 | + $url = '/'.$this->encode($params['index']).'/_count'; |
|
176 | 176 | $method = empty($params['body']) ? 'GET' : 'POST'; |
177 | 177 | } else { |
178 | 178 | $url = '/_count'; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | public function create(array $params = []) |
218 | 218 | { |
219 | 219 | $this->checkRequiredParameters(['id', 'index', 'body'], $params); |
220 | - $url = '/' . $this->encode($params['index']) . '/_create/' . $this->encode($params['id']); |
|
220 | + $url = '/'.$this->encode($params['index']).'/_create/'.$this->encode($params['id']); |
|
221 | 221 | $method = 'PUT'; |
222 | 222 | $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'pipeline', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
223 | 223 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | public function delete(array $params = []) |
257 | 257 | { |
258 | 258 | $this->checkRequiredParameters(['id', 'index'], $params); |
259 | - $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); |
|
259 | + $url = '/'.$this->encode($params['index']).'/_doc/'.$this->encode($params['id']); |
|
260 | 260 | $method = 'DELETE'; |
261 | 261 | $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
262 | 262 | $headers = ['Accept' => 'application/json']; |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | public function deleteByQuery(array $params = []) |
317 | 317 | { |
318 | 318 | $this->checkRequiredParameters(['index', 'body'], $params); |
319 | - $url = '/' . $this->encode($params['index']) . '/_delete_by_query'; |
|
319 | + $url = '/'.$this->encode($params['index']).'/_delete_by_query'; |
|
320 | 320 | $method = 'POST'; |
321 | 321 | $url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'max_docs', 'sort', 'terminate_after', 'stats', 'version', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
322 | 322 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | public function deleteByQueryRethrottle(array $params = []) |
348 | 348 | { |
349 | 349 | $this->checkRequiredParameters(['task_id', 'requests_per_second'], $params); |
350 | - $url = '/_delete_by_query/' . $this->encode($params['task_id']) . '/_rethrottle'; |
|
350 | + $url = '/_delete_by_query/'.$this->encode($params['task_id']).'/_rethrottle'; |
|
351 | 351 | $method = 'POST'; |
352 | 352 | $url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
353 | 353 | $headers = ['Accept' => 'application/json']; |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | public function deleteScript(array $params = []) |
380 | 380 | { |
381 | 381 | $this->checkRequiredParameters(['id'], $params); |
382 | - $url = '/_scripts/' . $this->encode($params['id']); |
|
382 | + $url = '/_scripts/'.$this->encode($params['id']); |
|
383 | 383 | $method = 'DELETE'; |
384 | 384 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
385 | 385 | $headers = ['Accept' => 'application/json']; |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | public function exists(array $params = []) |
421 | 421 | { |
422 | 422 | $this->checkRequiredParameters(['id', 'index'], $params); |
423 | - $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); |
|
423 | + $url = '/'.$this->encode($params['index']).'/_doc/'.$this->encode($params['id']); |
|
424 | 424 | $method = 'HEAD'; |
425 | 425 | $url = $this->addQueryString($url, $params, ['stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
426 | 426 | $headers = ['Accept' => 'application/json']; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | public function existsSource(array $params = []) |
461 | 461 | { |
462 | 462 | $this->checkRequiredParameters(['id', 'index'], $params); |
463 | - $url = '/' . $this->encode($params['index']) . '/_source/' . $this->encode($params['id']); |
|
463 | + $url = '/'.$this->encode($params['index']).'/_source/'.$this->encode($params['id']); |
|
464 | 464 | $method = 'HEAD'; |
465 | 465 | $url = $this->addQueryString($url, $params, ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
466 | 466 | $headers = ['Accept' => 'application/json']; |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | public function explain(array $params = []) |
505 | 505 | { |
506 | 506 | $this->checkRequiredParameters(['id', 'index'], $params); |
507 | - $url = '/' . $this->encode($params['index']) . '/_explain/' . $this->encode($params['id']); |
|
507 | + $url = '/'.$this->encode($params['index']).'/_explain/'.$this->encode($params['id']); |
|
508 | 508 | $method = empty($params['body']) ? 'GET' : 'POST'; |
509 | 509 | $url = $this->addQueryString($url, $params, ['analyze_wildcard', 'analyzer', 'default_operator', 'df', 'stored_fields', 'lenient', 'preference', 'q', 'routing', '_source', '_source_excludes', '_source_includes', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
510 | 510 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | public function fieldCaps(array $params = []) |
543 | 543 | { |
544 | 544 | if (isset($params['index'])) { |
545 | - $url = '/' . $this->encode($params['index']) . '/_field_caps'; |
|
545 | + $url = '/'.$this->encode($params['index']).'/_field_caps'; |
|
546 | 546 | $method = empty($params['body']) ? 'GET' : 'POST'; |
547 | 547 | } else { |
548 | 548 | $url = '/_field_caps'; |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | public function get(array $params = []) |
589 | 589 | { |
590 | 590 | $this->checkRequiredParameters(['id', 'index'], $params); |
591 | - $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); |
|
591 | + $url = '/'.$this->encode($params['index']).'/_doc/'.$this->encode($params['id']); |
|
592 | 592 | $method = 'GET'; |
593 | 593 | $url = $this->addQueryString($url, $params, ['force_synthetic_source', 'stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
594 | 594 | $headers = ['Accept' => 'application/json']; |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | public function getScript(array $params = []) |
620 | 620 | { |
621 | 621 | $this->checkRequiredParameters(['id'], $params); |
622 | - $url = '/_scripts/' . $this->encode($params['id']); |
|
622 | + $url = '/_scripts/'.$this->encode($params['id']); |
|
623 | 623 | $method = 'GET'; |
624 | 624 | $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
625 | 625 | $headers = ['Accept' => 'application/json']; |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | public function getSource(array $params = []) |
714 | 714 | { |
715 | 715 | $this->checkRequiredParameters(['id', 'index'], $params); |
716 | - $url = '/' . $this->encode($params['index']) . '/_source/' . $this->encode($params['id']); |
|
716 | + $url = '/'.$this->encode($params['index']).'/_source/'.$this->encode($params['id']); |
|
717 | 717 | $method = 'GET'; |
718 | 718 | $url = $this->addQueryString($url, $params, ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
719 | 719 | $headers = ['Accept' => 'application/json']; |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | public function healthReport(array $params = []) |
746 | 746 | { |
747 | 747 | if (isset($params['feature'])) { |
748 | - $url = '/_health_report/' . $this->encode($params['feature']); |
|
748 | + $url = '/_health_report/'.$this->encode($params['feature']); |
|
749 | 749 | $method = 'GET'; |
750 | 750 | } else { |
751 | 751 | $url = '/_health_report'; |
@@ -794,10 +794,10 @@ discard block |
||
794 | 794 | { |
795 | 795 | $this->checkRequiredParameters(['index', 'body'], $params); |
796 | 796 | if (isset($params['id'])) { |
797 | - $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); |
|
797 | + $url = '/'.$this->encode($params['index']).'/_doc/'.$this->encode($params['id']); |
|
798 | 798 | $method = 'PUT'; |
799 | 799 | } else { |
800 | - $url = '/' . $this->encode($params['index']) . '/_doc'; |
|
800 | + $url = '/'.$this->encode($params['index']).'/_doc'; |
|
801 | 801 | $method = 'POST'; |
802 | 802 | } |
803 | 803 | $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'op_type', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'if_seq_no', 'if_primary_term', 'pipeline', 'require_alias', 'require_data_stream', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | public function knnSearch(array $params = []) |
859 | 859 | { |
860 | 860 | $this->checkRequiredParameters(['index'], $params); |
861 | - $url = '/' . $this->encode($params['index']) . '/_knn_search'; |
|
861 | + $url = '/'.$this->encode($params['index']).'/_knn_search'; |
|
862 | 862 | $method = empty($params['body']) ? 'GET' : 'POST'; |
863 | 863 | $url = $this->addQueryString($url, $params, ['routing', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
864 | 864 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | { |
899 | 899 | $this->checkRequiredParameters(['body'], $params); |
900 | 900 | if (isset($params['index'])) { |
901 | - $url = '/' . $this->encode($params['index']) . '/_mget'; |
|
901 | + $url = '/'.$this->encode($params['index']).'/_mget'; |
|
902 | 902 | $method = empty($params['body']) ? 'GET' : 'POST'; |
903 | 903 | } else { |
904 | 904 | $url = '/_mget'; |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | { |
941 | 941 | $this->checkRequiredParameters(['body'], $params); |
942 | 942 | if (isset($params['index'])) { |
943 | - $url = '/' . $this->encode($params['index']) . '/_msearch'; |
|
943 | + $url = '/'.$this->encode($params['index']).'/_msearch'; |
|
944 | 944 | $method = empty($params['body']) ? 'GET' : 'POST'; |
945 | 945 | } else { |
946 | 946 | $url = '/_msearch'; |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | { |
981 | 981 | $this->checkRequiredParameters(['body'], $params); |
982 | 982 | if (isset($params['index'])) { |
983 | - $url = '/' . $this->encode($params['index']) . '/_msearch/template'; |
|
983 | + $url = '/'.$this->encode($params['index']).'/_msearch/template'; |
|
984 | 984 | $method = empty($params['body']) ? 'GET' : 'POST'; |
985 | 985 | } else { |
986 | 986 | $url = '/_msearch/template'; |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | public function mtermvectors(array $params = []) |
1027 | 1027 | { |
1028 | 1028 | if (isset($params['index'])) { |
1029 | - $url = '/' . $this->encode($params['index']) . '/_mtermvectors'; |
|
1029 | + $url = '/'.$this->encode($params['index']).'/_mtermvectors'; |
|
1030 | 1030 | $method = empty($params['body']) ? 'GET' : 'POST'; |
1031 | 1031 | } else { |
1032 | 1032 | $url = '/_mtermvectors'; |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | public function openPointInTime(array $params = []) |
1067 | 1067 | { |
1068 | 1068 | $this->checkRequiredParameters(['index', 'keep_alive'], $params); |
1069 | - $url = '/' . $this->encode($params['index']) . '/_pit'; |
|
1069 | + $url = '/'.$this->encode($params['index']).'/_pit'; |
|
1070 | 1070 | $method = 'POST'; |
1071 | 1071 | $url = $this->addQueryString($url, $params, ['preference', 'routing', 'ignore_unavailable', 'expand_wildcards', 'keep_alive', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1072 | 1072 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -1128,10 +1128,10 @@ discard block |
||
1128 | 1128 | { |
1129 | 1129 | $this->checkRequiredParameters(['id', 'body'], $params); |
1130 | 1130 | if (isset($params['context'])) { |
1131 | - $url = '/_scripts/' . $this->encode($params['id']) . '/' . $this->encode($params['context']); |
|
1131 | + $url = '/_scripts/'.$this->encode($params['id']).'/'.$this->encode($params['context']); |
|
1132 | 1132 | $method = 'PUT'; |
1133 | 1133 | } else { |
1134 | - $url = '/_scripts/' . $this->encode($params['id']); |
|
1134 | + $url = '/_scripts/'.$this->encode($params['id']); |
|
1135 | 1135 | $method = 'PUT'; |
1136 | 1136 | } |
1137 | 1137 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | { |
1168 | 1168 | $this->checkRequiredParameters(['body'], $params); |
1169 | 1169 | if (isset($params['index'])) { |
1170 | - $url = '/' . $this->encode($params['index']) . '/_rank_eval'; |
|
1170 | + $url = '/'.$this->encode($params['index']).'/_rank_eval'; |
|
1171 | 1171 | $method = empty($params['body']) ? 'GET' : 'POST'; |
1172 | 1172 | } else { |
1173 | 1173 | $url = '/_rank_eval'; |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | public function reindexRethrottle(array $params = []) |
1242 | 1242 | { |
1243 | 1243 | $this->checkRequiredParameters(['task_id', 'requests_per_second'], $params); |
1244 | - $url = '/_reindex/' . $this->encode($params['task_id']) . '/_rethrottle'; |
|
1244 | + $url = '/_reindex/'.$this->encode($params['task_id']).'/_rethrottle'; |
|
1245 | 1245 | $method = 'POST'; |
1246 | 1246 | $url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1247 | 1247 | $headers = ['Accept' => 'application/json']; |
@@ -1271,7 +1271,7 @@ discard block |
||
1271 | 1271 | public function renderSearchTemplate(array $params = []) |
1272 | 1272 | { |
1273 | 1273 | if (isset($params['id'])) { |
1274 | - $url = '/_render/template/' . $this->encode($params['id']); |
|
1274 | + $url = '/_render/template/'.$this->encode($params['id']); |
|
1275 | 1275 | $method = empty($params['body']) ? 'GET' : 'POST'; |
1276 | 1276 | } else { |
1277 | 1277 | $url = '/_render/template'; |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | public function scroll(array $params = []) |
1337 | 1337 | { |
1338 | 1338 | if (isset($params['scroll_id'])) { |
1339 | - $url = '/_search/scroll/' . $this->encode($params['scroll_id']); |
|
1339 | + $url = '/_search/scroll/'.$this->encode($params['scroll_id']); |
|
1340 | 1340 | $method = empty($params['body']) ? 'GET' : 'POST'; |
1341 | 1341 | } else { |
1342 | 1342 | $url = '/_search/scroll'; |
@@ -1415,7 +1415,7 @@ discard block |
||
1415 | 1415 | public function search(array $params = []) |
1416 | 1416 | { |
1417 | 1417 | if (isset($params['index'])) { |
1418 | - $url = '/' . $this->encode($params['index']) . '/_search'; |
|
1418 | + $url = '/'.$this->encode($params['index']).'/_search'; |
|
1419 | 1419 | $method = empty($params['body']) ? 'GET' : 'POST'; |
1420 | 1420 | } else { |
1421 | 1421 | $url = '/_search'; |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | public function searchMvt(array $params = []) |
1463 | 1463 | { |
1464 | 1464 | $this->checkRequiredParameters(['index', 'field', 'zoom', 'x', 'y'], $params); |
1465 | - $url = '/' . $this->encode($params['index']) . '/_mvt/' . $this->encode($params['field']) . '/' . $this->encode($params['zoom']) . '/' . $this->encode($params['x']) . '/' . $this->encode($params['y']); |
|
1465 | + $url = '/'.$this->encode($params['index']).'/_mvt/'.$this->encode($params['field']).'/'.$this->encode($params['zoom']).'/'.$this->encode($params['x']).'/'.$this->encode($params['y']); |
|
1466 | 1466 | $method = empty($params['body']) ? 'GET' : 'POST'; |
1467 | 1467 | $url = $this->addQueryString($url, $params, ['exact_bounds', 'extent', 'grid_precision', 'grid_type', 'size', 'track_total_hits', 'with_labels', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1468 | 1468 | $headers = ['Accept' => 'application/vnd.mapbox-vector-tile', 'Content-Type' => 'application/json']; |
@@ -1497,7 +1497,7 @@ discard block |
||
1497 | 1497 | public function searchShards(array $params = []) |
1498 | 1498 | { |
1499 | 1499 | if (isset($params['index'])) { |
1500 | - $url = '/' . $this->encode($params['index']) . '/_search_shards'; |
|
1500 | + $url = '/'.$this->encode($params['index']).'/_search_shards'; |
|
1501 | 1501 | $method = empty($params['body']) ? 'GET' : 'POST'; |
1502 | 1502 | } else { |
1503 | 1503 | $url = '/_search_shards'; |
@@ -1545,7 +1545,7 @@ discard block |
||
1545 | 1545 | { |
1546 | 1546 | $this->checkRequiredParameters(['body'], $params); |
1547 | 1547 | if (isset($params['index'])) { |
1548 | - $url = '/' . $this->encode($params['index']) . '/_search/template'; |
|
1548 | + $url = '/'.$this->encode($params['index']).'/_search/template'; |
|
1549 | 1549 | $method = empty($params['body']) ? 'GET' : 'POST'; |
1550 | 1550 | } else { |
1551 | 1551 | $url = '/_search/template'; |
@@ -1580,7 +1580,7 @@ discard block |
||
1580 | 1580 | public function termsEnum(array $params = []) |
1581 | 1581 | { |
1582 | 1582 | $this->checkRequiredParameters(['index'], $params); |
1583 | - $url = '/' . $this->encode($params['index']) . '/_terms_enum'; |
|
1583 | + $url = '/'.$this->encode($params['index']).'/_terms_enum'; |
|
1584 | 1584 | $method = empty($params['body']) ? 'GET' : 'POST'; |
1585 | 1585 | $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1586 | 1586 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -1624,10 +1624,10 @@ discard block |
||
1624 | 1624 | { |
1625 | 1625 | $this->checkRequiredParameters(['index'], $params); |
1626 | 1626 | if (isset($params['id'])) { |
1627 | - $url = '/' . $this->encode($params['index']) . '/_termvectors/' . $this->encode($params['id']); |
|
1627 | + $url = '/'.$this->encode($params['index']).'/_termvectors/'.$this->encode($params['id']); |
|
1628 | 1628 | $method = empty($params['body']) ? 'GET' : 'POST'; |
1629 | 1629 | } else { |
1630 | - $url = '/' . $this->encode($params['index']) . '/_termvectors'; |
|
1630 | + $url = '/'.$this->encode($params['index']).'/_termvectors'; |
|
1631 | 1631 | $method = empty($params['body']) ? 'GET' : 'POST'; |
1632 | 1632 | } |
1633 | 1633 | $url = $this->addQueryString($url, $params, ['term_statistics', 'field_statistics', 'fields', 'offsets', 'positions', 'payloads', 'preference', 'routing', 'realtime', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
@@ -1672,7 +1672,7 @@ discard block |
||
1672 | 1672 | public function update(array $params = []) |
1673 | 1673 | { |
1674 | 1674 | $this->checkRequiredParameters(['id', 'index', 'body'], $params); |
1675 | - $url = '/' . $this->encode($params['index']) . '/_update/' . $this->encode($params['id']); |
|
1675 | + $url = '/'.$this->encode($params['index']).'/_update/'.$this->encode($params['id']); |
|
1676 | 1676 | $method = 'POST'; |
1677 | 1677 | $url = $this->addQueryString($url, $params, ['wait_for_active_shards', '_source', '_source_excludes', '_source_includes', 'lang', 'refresh', 'retry_on_conflict', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1678 | 1678 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -1735,7 +1735,7 @@ discard block |
||
1735 | 1735 | public function updateByQuery(array $params = []) |
1736 | 1736 | { |
1737 | 1737 | $this->checkRequiredParameters(['index'], $params); |
1738 | - $url = '/' . $this->encode($params['index']) . '/_update_by_query'; |
|
1738 | + $url = '/'.$this->encode($params['index']).'/_update_by_query'; |
|
1739 | 1739 | $method = 'POST'; |
1740 | 1740 | $url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'pipeline', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'max_docs', 'sort', 'terminate_after', 'stats', 'version', 'version_type', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1741 | 1741 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -1766,7 +1766,7 @@ discard block |
||
1766 | 1766 | public function updateByQueryRethrottle(array $params = []) |
1767 | 1767 | { |
1768 | 1768 | $this->checkRequiredParameters(['task_id', 'requests_per_second'], $params); |
1769 | - $url = '/_update_by_query/' . $this->encode($params['task_id']) . '/_rethrottle'; |
|
1769 | + $url = '/_update_by_query/'.$this->encode($params['task_id']).'/_rethrottle'; |
|
1770 | 1770 | $method = 'POST'; |
1771 | 1771 | $url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1772 | 1772 | $headers = ['Accept' => 'application/json']; |
@@ -23,8 +23,7 @@ |
||
23 | 23 | /** |
24 | 24 | * @generated This file is generated, please do not edit |
25 | 25 | */ |
26 | -trait ClientEndpointsTrait |
|
27 | -{ |
|
26 | +trait ClientEndpointsTrait { |
|
28 | 27 | /** |
29 | 28 | * Allows to perform multiple index/update/delete operations in a single request. |
30 | 29 | * |
@@ -17,14 +17,14 @@ |
||
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\ResponseInterface; |
18 | 18 | trait ResponseTrait |
19 | 19 | { |
20 | - protected ResponseInterface $response; |
|
21 | - public function setResponse(ResponseInterface $response) : self |
|
22 | - { |
|
23 | - $this->response = $response; |
|
24 | - return $this; |
|
25 | - } |
|
26 | - public function getResponse() : ResponseInterface |
|
27 | - { |
|
28 | - return $this->response; |
|
29 | - } |
|
20 | + protected ResponseInterface $response; |
|
21 | + public function setResponse(ResponseInterface $response) : self |
|
22 | + { |
|
23 | + $this->response = $response; |
|
24 | + return $this; |
|
25 | + } |
|
26 | + public function getResponse() : ResponseInterface |
|
27 | + { |
|
28 | + return $this->response; |
|
29 | + } |
|
30 | 30 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
12 | 12 | * See the LICENSE file in the project root for more information. |
13 | 13 | */ |
14 | -declare (strict_types=1); |
|
14 | +declare(strict_types=1); |
|
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Traits; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\ResponseInterface; |
@@ -15,8 +15,7 @@ |
||
15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Traits; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\ResponseInterface; |
18 | -trait ResponseTrait |
|
19 | -{ |
|
18 | +trait ResponseTrait { |
|
20 | 19 | protected ResponseInterface $response; |
21 | 20 | public function setResponse(ResponseInterface $response) : self |
22 | 21 | { |