@@ -25,44 +25,44 @@ |
||
25 | 25 | */ |
26 | 26 | class Monitoring extends AbstractEndpoint |
27 | 27 | { |
28 | - /** |
|
29 | - * Used by the monitoring features to send monitoring data. |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/monitor-elasticsearch-cluster.html |
|
32 | - * |
|
33 | - * @param array{ |
|
34 | - * type: string, // Default document type for items which don't provide one |
|
35 | - * system_id: string, // Identifier of the monitored system |
|
36 | - * system_api_version: string, // API Version of the monitored system |
|
37 | - * interval: string, // Collection interval (e.g., '10s' or '10000ms') of the payload |
|
38 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
39 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
40 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
41 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
42 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
43 | - * body: array, // (REQUIRED) The operation definition and data (action-data pairs), separated by newlines |
|
44 | - * } $params |
|
45 | - * |
|
46 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
47 | - * @throws ClientResponseException if the status code of response is 4xx |
|
48 | - * @throws ServerResponseException if the status code of response is 5xx |
|
49 | - * |
|
50 | - * @return Elasticsearch|Promise |
|
51 | - */ |
|
52 | - public function bulk(array $params = []) |
|
53 | - { |
|
54 | - $this->checkRequiredParameters(['body'], $params); |
|
55 | - if (isset($params['type'])) { |
|
56 | - $url = '/_monitoring/' . $this->encode($params['type']) . '/bulk'; |
|
57 | - $method = 'POST'; |
|
58 | - } else { |
|
59 | - $url = '/_monitoring/bulk'; |
|
60 | - $method = 'POST'; |
|
61 | - } |
|
62 | - $url = $this->addQueryString($url, $params, ['system_id', 'system_api_version', 'interval', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
63 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson']; |
|
64 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
65 | - $request = $this->addOtelAttributes($params, ['type'], $request, 'monitoring.bulk'); |
|
66 | - return $this->client->sendRequest($request); |
|
67 | - } |
|
28 | + /** |
|
29 | + * Used by the monitoring features to send monitoring data. |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/monitor-elasticsearch-cluster.html |
|
32 | + * |
|
33 | + * @param array{ |
|
34 | + * type: string, // Default document type for items which don't provide one |
|
35 | + * system_id: string, // Identifier of the monitored system |
|
36 | + * system_api_version: string, // API Version of the monitored system |
|
37 | + * interval: string, // Collection interval (e.g., '10s' or '10000ms') of the payload |
|
38 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
39 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
40 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
41 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
42 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
43 | + * body: array, // (REQUIRED) The operation definition and data (action-data pairs), separated by newlines |
|
44 | + * } $params |
|
45 | + * |
|
46 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
47 | + * @throws ClientResponseException if the status code of response is 4xx |
|
48 | + * @throws ServerResponseException if the status code of response is 5xx |
|
49 | + * |
|
50 | + * @return Elasticsearch|Promise |
|
51 | + */ |
|
52 | + public function bulk(array $params = []) |
|
53 | + { |
|
54 | + $this->checkRequiredParameters(['body'], $params); |
|
55 | + if (isset($params['type'])) { |
|
56 | + $url = '/_monitoring/' . $this->encode($params['type']) . '/bulk'; |
|
57 | + $method = 'POST'; |
|
58 | + } else { |
|
59 | + $url = '/_monitoring/bulk'; |
|
60 | + $method = 'POST'; |
|
61 | + } |
|
62 | + $url = $this->addQueryString($url, $params, ['system_id', 'system_api_version', 'interval', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
63 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson']; |
|
64 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
65 | + $request = $this->addOtelAttributes($params, ['type'], $request, 'monitoring.bulk'); |
|
66 | + return $this->client->sendRequest($request); |
|
67 | + } |
|
68 | 68 | } |
@@ -25,2245 +25,2245 @@ |
||
25 | 25 | */ |
26 | 26 | class Indices extends AbstractEndpoint |
27 | 27 | { |
28 | - /** |
|
29 | - * Adds a block to an index. |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-blocks.html |
|
32 | - * |
|
33 | - * @param array{ |
|
34 | - * index: list, // (REQUIRED) A comma separated list of indices to add a block to |
|
35 | - * block: string, // (REQUIRED) The block to add (one of read, write, read_only or metadata) |
|
36 | - * timeout: time, // Explicit operation timeout |
|
37 | - * master_timeout: time, // Specify timeout for connection to master |
|
38 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
39 | - * 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) |
|
40 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
41 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
42 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
43 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
44 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
45 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
46 | - * } $params |
|
47 | - * |
|
48 | - * @throws MissingParameterException if a required parameter is missing |
|
49 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
50 | - * @throws ClientResponseException if the status code of response is 4xx |
|
51 | - * @throws ServerResponseException if the status code of response is 5xx |
|
52 | - * |
|
53 | - * @return Elasticsearch|Promise |
|
54 | - */ |
|
55 | - public function addBlock(array $params = []) |
|
56 | - { |
|
57 | - $this->checkRequiredParameters(['index', 'block'], $params); |
|
58 | - $url = '/' . $this->encode($params['index']) . '/_block/' . $this->encode($params['block']); |
|
59 | - $method = 'PUT'; |
|
60 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
61 | - $headers = ['Accept' => 'application/json']; |
|
62 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
63 | - $request = $this->addOtelAttributes($params, ['index', 'block'], $request, 'indices.add_block'); |
|
64 | - return $this->client->sendRequest($request); |
|
65 | - } |
|
66 | - /** |
|
67 | - * Performs the analysis process on a text and return the tokens breakdown of the text. |
|
68 | - * |
|
69 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html |
|
70 | - * |
|
71 | - * @param array{ |
|
72 | - * index: string, // The name of the index to scope the operation |
|
73 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
74 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
75 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
76 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
77 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
78 | - * body: array, // Define analyzer/tokenizer parameters and the text on which the analysis should be performed |
|
79 | - * } $params |
|
80 | - * |
|
81 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
82 | - * @throws ClientResponseException if the status code of response is 4xx |
|
83 | - * @throws ServerResponseException if the status code of response is 5xx |
|
84 | - * |
|
85 | - * @return Elasticsearch|Promise |
|
86 | - */ |
|
87 | - public function analyze(array $params = []) |
|
88 | - { |
|
89 | - if (isset($params['index'])) { |
|
90 | - $url = '/' . $this->encode($params['index']) . '/_analyze'; |
|
91 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
92 | - } else { |
|
93 | - $url = '/_analyze'; |
|
94 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
95 | - } |
|
96 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
97 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
98 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
99 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.analyze'); |
|
100 | - return $this->client->sendRequest($request); |
|
101 | - } |
|
102 | - /** |
|
103 | - * Clears all or specific caches for one or more indices. |
|
104 | - * |
|
105 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html |
|
106 | - * |
|
107 | - * @param array{ |
|
108 | - * index: list, // A comma-separated list of index name to limit the operation |
|
109 | - * fielddata: boolean, // Clear field data |
|
110 | - * fields: list, // A comma-separated list of fields to clear when using the `fielddata` parameter (default: all) |
|
111 | - * query: boolean, // Clear query caches |
|
112 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
113 | - * 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) |
|
114 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
115 | - * request: boolean, // Clear request cache |
|
116 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
117 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
118 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
119 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
120 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
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 clearCache(array $params = []) |
|
130 | - { |
|
131 | - if (isset($params['index'])) { |
|
132 | - $url = '/' . $this->encode($params['index']) . '/_cache/clear'; |
|
133 | - $method = 'POST'; |
|
134 | - } else { |
|
135 | - $url = '/_cache/clear'; |
|
136 | - $method = 'POST'; |
|
137 | - } |
|
138 | - $url = $this->addQueryString($url, $params, ['fielddata', 'fields', 'query', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'request', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
139 | - $headers = ['Accept' => 'application/json']; |
|
140 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
141 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.clear_cache'); |
|
142 | - return $this->client->sendRequest($request); |
|
143 | - } |
|
144 | - /** |
|
145 | - * Clones an index |
|
146 | - * |
|
147 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clone-index.html |
|
148 | - * |
|
149 | - * @param array{ |
|
150 | - * index: string, // (REQUIRED) The name of the source index to clone |
|
151 | - * target: string, // (REQUIRED) The name of the target index to clone into |
|
152 | - * timeout: time, // Explicit operation timeout |
|
153 | - * master_timeout: time, // Specify timeout for connection to master |
|
154 | - * wait_for_active_shards: string, // Set the number of active shards to wait for on the cloned index before the operation returns. |
|
155 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
156 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
157 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
158 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
159 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
160 | - * body: array, // The configuration for the target index (`settings` and `aliases`) |
|
161 | - * } $params |
|
162 | - * |
|
163 | - * @throws MissingParameterException if a required parameter is missing |
|
164 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
165 | - * @throws ClientResponseException if the status code of response is 4xx |
|
166 | - * @throws ServerResponseException if the status code of response is 5xx |
|
167 | - * |
|
168 | - * @return Elasticsearch|Promise |
|
169 | - */ |
|
170 | - public function clone(array $params = []) |
|
171 | - { |
|
172 | - $this->checkRequiredParameters(['index', 'target'], $params); |
|
173 | - $url = '/' . $this->encode($params['index']) . '/_clone/' . $this->encode($params['target']); |
|
174 | - $method = 'PUT'; |
|
175 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
176 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
177 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
178 | - $request = $this->addOtelAttributes($params, ['index', 'target'], $request, 'indices.clone'); |
|
179 | - return $this->client->sendRequest($request); |
|
180 | - } |
|
181 | - /** |
|
182 | - * Closes an index. |
|
183 | - * |
|
184 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html |
|
185 | - * |
|
186 | - * @param array{ |
|
187 | - * index: list, // (REQUIRED) A comma separated list of indices to close |
|
188 | - * timeout: time, // Explicit operation timeout |
|
189 | - * master_timeout: time, // Specify timeout for connection to master |
|
190 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
191 | - * 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) |
|
192 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
193 | - * wait_for_active_shards: string, // Sets the number of active shards to wait for before the operation returns. |
|
194 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
195 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
196 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
197 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
198 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
199 | - * } $params |
|
200 | - * |
|
201 | - * @throws MissingParameterException if a required parameter is missing |
|
202 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
203 | - * @throws ClientResponseException if the status code of response is 4xx |
|
204 | - * @throws ServerResponseException if the status code of response is 5xx |
|
205 | - * |
|
206 | - * @return Elasticsearch|Promise |
|
207 | - */ |
|
208 | - public function close(array $params = []) |
|
209 | - { |
|
210 | - $this->checkRequiredParameters(['index'], $params); |
|
211 | - $url = '/' . $this->encode($params['index']) . '/_close'; |
|
212 | - $method = 'POST'; |
|
213 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
214 | - $headers = ['Accept' => 'application/json']; |
|
215 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
216 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.close'); |
|
217 | - return $this->client->sendRequest($request); |
|
218 | - } |
|
219 | - /** |
|
220 | - * Creates an index with optional settings and mappings. |
|
221 | - * |
|
222 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html |
|
223 | - * |
|
224 | - * @param array{ |
|
225 | - * index: string, // (REQUIRED) The name of the index |
|
226 | - * wait_for_active_shards: string, // Set the number of active shards to wait for before the operation returns. |
|
227 | - * timeout: time, // Explicit operation timeout |
|
228 | - * master_timeout: time, // Specify timeout for connection to master |
|
229 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
230 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
231 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
232 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
233 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
234 | - * body: array, // The configuration for the index (`settings` and `mappings`) |
|
235 | - * } $params |
|
236 | - * |
|
237 | - * @throws MissingParameterException if a required parameter is missing |
|
238 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
239 | - * @throws ClientResponseException if the status code of response is 4xx |
|
240 | - * @throws ServerResponseException if the status code of response is 5xx |
|
241 | - * |
|
242 | - * @return Elasticsearch|Promise |
|
243 | - */ |
|
244 | - public function create(array $params = []) |
|
245 | - { |
|
246 | - $this->checkRequiredParameters(['index'], $params); |
|
247 | - $url = '/' . $this->encode($params['index']); |
|
248 | - $method = 'PUT'; |
|
249 | - $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
250 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
251 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
252 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.create'); |
|
253 | - return $this->client->sendRequest($request); |
|
254 | - } |
|
255 | - /** |
|
256 | - * Creates a data stream |
|
257 | - * |
|
258 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html |
|
259 | - * |
|
260 | - * @param array{ |
|
261 | - * name: string, // (REQUIRED) The name of the data stream |
|
262 | - * timeout: time, // Specify timeout for acknowledging the cluster state update |
|
263 | - * master_timeout: time, // Specify timeout for connection to master |
|
264 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
265 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
266 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
267 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
268 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
269 | - * } $params |
|
270 | - * |
|
271 | - * @throws MissingParameterException if a required parameter is missing |
|
272 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
273 | - * @throws ClientResponseException if the status code of response is 4xx |
|
274 | - * @throws ServerResponseException if the status code of response is 5xx |
|
275 | - * |
|
276 | - * @return Elasticsearch|Promise |
|
277 | - */ |
|
278 | - public function createDataStream(array $params = []) |
|
279 | - { |
|
280 | - $this->checkRequiredParameters(['name'], $params); |
|
281 | - $url = '/_data_stream/' . $this->encode($params['name']); |
|
282 | - $method = 'PUT'; |
|
283 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
284 | - $headers = ['Accept' => 'application/json']; |
|
285 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
286 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.create_data_stream'); |
|
287 | - return $this->client->sendRequest($request); |
|
288 | - } |
|
289 | - /** |
|
290 | - * Provides statistics on operations happening in a data stream. |
|
291 | - * |
|
292 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html |
|
293 | - * |
|
294 | - * @param array{ |
|
295 | - * name: list, // A comma-separated list of data stream names; use `_all` or empty string to perform the operation on all data streams |
|
296 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
297 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
298 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
299 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
300 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
301 | - * } $params |
|
302 | - * |
|
303 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
304 | - * @throws ClientResponseException if the status code of response is 4xx |
|
305 | - * @throws ServerResponseException if the status code of response is 5xx |
|
306 | - * |
|
307 | - * @return Elasticsearch|Promise |
|
308 | - */ |
|
309 | - public function dataStreamsStats(array $params = []) |
|
310 | - { |
|
311 | - if (isset($params['name'])) { |
|
312 | - $url = '/_data_stream/' . $this->encode($params['name']) . '/_stats'; |
|
313 | - $method = 'GET'; |
|
314 | - } else { |
|
315 | - $url = '/_data_stream/_stats'; |
|
316 | - $method = 'GET'; |
|
317 | - } |
|
318 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
319 | - $headers = ['Accept' => 'application/json']; |
|
320 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
321 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.data_streams_stats'); |
|
322 | - return $this->client->sendRequest($request); |
|
323 | - } |
|
324 | - /** |
|
325 | - * Deletes an index. |
|
326 | - * |
|
327 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html |
|
328 | - * |
|
329 | - * @param array{ |
|
330 | - * index: list, // (REQUIRED) A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices |
|
331 | - * timeout: time, // Explicit operation timeout |
|
332 | - * master_timeout: time, // Specify timeout for connection to master |
|
333 | - * ignore_unavailable: boolean, // Ignore unavailable indexes (default: false) |
|
334 | - * allow_no_indices: boolean, // Ignore if a wildcard expression resolves to no concrete indices (default: false) |
|
335 | - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open, closed, or hidden indices |
|
336 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
337 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
338 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
339 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
340 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
341 | - * } $params |
|
342 | - * |
|
343 | - * @throws MissingParameterException if a required parameter is missing |
|
344 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
345 | - * @throws ClientResponseException if the status code of response is 4xx |
|
346 | - * @throws ServerResponseException if the status code of response is 5xx |
|
347 | - * |
|
348 | - * @return Elasticsearch|Promise |
|
349 | - */ |
|
350 | - public function delete(array $params = []) |
|
351 | - { |
|
352 | - $this->checkRequiredParameters(['index'], $params); |
|
353 | - $url = '/' . $this->encode($params['index']); |
|
354 | - $method = 'DELETE'; |
|
355 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
356 | - $headers = ['Accept' => 'application/json']; |
|
357 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
358 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.delete'); |
|
359 | - return $this->client->sendRequest($request); |
|
360 | - } |
|
361 | - /** |
|
362 | - * Deletes an alias. |
|
363 | - * |
|
364 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html |
|
365 | - * |
|
366 | - * @param array{ |
|
367 | - * index: list, // (REQUIRED) A comma-separated list of index names (supports wildcards); use `_all` for all indices |
|
368 | - * name: list, // (REQUIRED) A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices. |
|
369 | - * timeout: time, // Explicit timestamp for the document |
|
370 | - * master_timeout: time, // Specify timeout for connection to master |
|
371 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
372 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
373 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
374 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
375 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
376 | - * } $params |
|
377 | - * |
|
378 | - * @throws MissingParameterException if a required parameter is missing |
|
379 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
380 | - * @throws ClientResponseException if the status code of response is 4xx |
|
381 | - * @throws ServerResponseException if the status code of response is 5xx |
|
382 | - * |
|
383 | - * @return Elasticsearch|Promise |
|
384 | - */ |
|
385 | - public function deleteAlias(array $params = []) |
|
386 | - { |
|
387 | - $this->checkRequiredParameters(['index', 'name'], $params); |
|
388 | - $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); |
|
389 | - $method = 'DELETE'; |
|
390 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
391 | - $headers = ['Accept' => 'application/json']; |
|
392 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
393 | - $request = $this->addOtelAttributes($params, ['index', 'name'], $request, 'indices.delete_alias'); |
|
394 | - return $this->client->sendRequest($request); |
|
395 | - } |
|
396 | - /** |
|
397 | - * Deletes the data stream lifecycle of the selected data streams. |
|
398 | - * |
|
399 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-delete-lifecycle.html |
|
400 | - * |
|
401 | - * @param array{ |
|
402 | - * name: list, // (REQUIRED) A comma-separated list of data streams of which the data stream lifecycle will be deleted; use `*` to get all data streams |
|
403 | - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
404 | - * timeout: time, // Explicit timestamp for the document |
|
405 | - * master_timeout: time, // Specify timeout for connection to master |
|
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 deleteDataLifecycle(array $params = []) |
|
421 | - { |
|
422 | - $this->checkRequiredParameters(['name'], $params); |
|
423 | - $url = '/_data_stream/' . $this->encode($params['name']) . '/_lifecycle'; |
|
424 | - $method = 'DELETE'; |
|
425 | - $url = $this->addQueryString($url, $params, ['expand_wildcards', 'timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
426 | - $headers = ['Accept' => 'application/json']; |
|
427 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
428 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.delete_data_lifecycle'); |
|
429 | - return $this->client->sendRequest($request); |
|
430 | - } |
|
431 | - /** |
|
432 | - * Deletes a data stream. |
|
433 | - * |
|
434 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html |
|
435 | - * |
|
436 | - * @param array{ |
|
437 | - * name: list, // (REQUIRED) A comma-separated list of data streams to delete; use `*` to delete all data streams |
|
438 | - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
439 | - * master_timeout: time, // Specify timeout for connection to master |
|
440 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
441 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
442 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
443 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
444 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
445 | - * } $params |
|
446 | - * |
|
447 | - * @throws MissingParameterException if a required parameter is missing |
|
448 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
449 | - * @throws ClientResponseException if the status code of response is 4xx |
|
450 | - * @throws ServerResponseException if the status code of response is 5xx |
|
451 | - * |
|
452 | - * @return Elasticsearch|Promise |
|
453 | - */ |
|
454 | - public function deleteDataStream(array $params = []) |
|
455 | - { |
|
456 | - $this->checkRequiredParameters(['name'], $params); |
|
457 | - $url = '/_data_stream/' . $this->encode($params['name']); |
|
458 | - $method = 'DELETE'; |
|
459 | - $url = $this->addQueryString($url, $params, ['expand_wildcards', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
460 | - $headers = ['Accept' => 'application/json']; |
|
461 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
462 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.delete_data_stream'); |
|
463 | - return $this->client->sendRequest($request); |
|
464 | - } |
|
465 | - /** |
|
466 | - * Deletes an index template. |
|
467 | - * |
|
468 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template.html |
|
469 | - * |
|
470 | - * @param array{ |
|
471 | - * name: string, // (REQUIRED) The name of the template |
|
472 | - * timeout: time, // Explicit operation timeout |
|
473 | - * master_timeout: time, // Specify timeout for connection to master |
|
474 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
475 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
476 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
477 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
478 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
479 | - * } $params |
|
480 | - * |
|
481 | - * @throws MissingParameterException if a required parameter is missing |
|
482 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
483 | - * @throws ClientResponseException if the status code of response is 4xx |
|
484 | - * @throws ServerResponseException if the status code of response is 5xx |
|
485 | - * |
|
486 | - * @return Elasticsearch|Promise |
|
487 | - */ |
|
488 | - public function deleteIndexTemplate(array $params = []) |
|
489 | - { |
|
490 | - $this->checkRequiredParameters(['name'], $params); |
|
491 | - $url = '/_index_template/' . $this->encode($params['name']); |
|
492 | - $method = 'DELETE'; |
|
493 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
494 | - $headers = ['Accept' => 'application/json']; |
|
495 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
496 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.delete_index_template'); |
|
497 | - return $this->client->sendRequest($request); |
|
498 | - } |
|
499 | - /** |
|
500 | - * Deletes an index template. |
|
501 | - * |
|
502 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template-v1.html |
|
503 | - * |
|
504 | - * @param array{ |
|
505 | - * name: string, // (REQUIRED) The name of the template |
|
506 | - * timeout: time, // Explicit operation timeout |
|
507 | - * master_timeout: time, // Specify timeout for connection to master |
|
508 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
509 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
510 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
511 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
512 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
513 | - * } $params |
|
514 | - * |
|
515 | - * @throws MissingParameterException if a required parameter is missing |
|
516 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
517 | - * @throws ClientResponseException if the status code of response is 4xx |
|
518 | - * @throws ServerResponseException if the status code of response is 5xx |
|
519 | - * |
|
520 | - * @return Elasticsearch|Promise |
|
521 | - */ |
|
522 | - public function deleteTemplate(array $params = []) |
|
523 | - { |
|
524 | - $this->checkRequiredParameters(['name'], $params); |
|
525 | - $url = '/_template/' . $this->encode($params['name']); |
|
526 | - $method = 'DELETE'; |
|
527 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
528 | - $headers = ['Accept' => 'application/json']; |
|
529 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
530 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.delete_template'); |
|
531 | - return $this->client->sendRequest($request); |
|
532 | - } |
|
533 | - /** |
|
534 | - * Analyzes the disk usage of each field of an index or data stream |
|
535 | - * |
|
536 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-disk-usage.html |
|
537 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
538 | - * |
|
539 | - * @param array{ |
|
540 | - * index: string, // (REQUIRED) Comma-separated list of indices or data streams to analyze the disk usage |
|
541 | - * run_expensive_tasks: boolean, // Must be set to [true] in order for the task to be performed. Defaults to false. |
|
542 | - * flush: boolean, // Whether flush or not before analyzing the index disk usage. Defaults to true |
|
543 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
544 | - * 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) |
|
545 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
546 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
547 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
548 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
549 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
550 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
551 | - * } $params |
|
552 | - * |
|
553 | - * @throws MissingParameterException if a required parameter is missing |
|
554 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
555 | - * @throws ClientResponseException if the status code of response is 4xx |
|
556 | - * @throws ServerResponseException if the status code of response is 5xx |
|
557 | - * |
|
558 | - * @return Elasticsearch|Promise |
|
559 | - */ |
|
560 | - public function diskUsage(array $params = []) |
|
561 | - { |
|
562 | - $this->checkRequiredParameters(['index'], $params); |
|
563 | - $url = '/' . $this->encode($params['index']) . '/_disk_usage'; |
|
564 | - $method = 'POST'; |
|
565 | - $url = $this->addQueryString($url, $params, ['run_expensive_tasks', 'flush', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
566 | - $headers = ['Accept' => 'application/json']; |
|
567 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
568 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.disk_usage'); |
|
569 | - return $this->client->sendRequest($request); |
|
570 | - } |
|
571 | - /** |
|
572 | - * Downsample an index |
|
573 | - * |
|
574 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-rollup.html |
|
575 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
576 | - * |
|
577 | - * @param array{ |
|
578 | - * index: string, // (REQUIRED) The index to downsample |
|
579 | - * target_index: string, // (REQUIRED) The name of the target index to store downsampled data |
|
580 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
581 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
582 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
583 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
584 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
585 | - * body: array, // (REQUIRED) The downsampling configuration |
|
586 | - * } $params |
|
587 | - * |
|
588 | - * @throws MissingParameterException if a required parameter is missing |
|
589 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
590 | - * @throws ClientResponseException if the status code of response is 4xx |
|
591 | - * @throws ServerResponseException if the status code of response is 5xx |
|
592 | - * |
|
593 | - * @return Elasticsearch|Promise |
|
594 | - */ |
|
595 | - public function downsample(array $params = []) |
|
596 | - { |
|
597 | - $this->checkRequiredParameters(['index', 'target_index', 'body'], $params); |
|
598 | - $url = '/' . $this->encode($params['index']) . '/_downsample/' . $this->encode($params['target_index']); |
|
599 | - $method = 'POST'; |
|
600 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
601 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
602 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
603 | - $request = $this->addOtelAttributes($params, ['index', 'target_index'], $request, 'indices.downsample'); |
|
604 | - return $this->client->sendRequest($request); |
|
605 | - } |
|
606 | - /** |
|
607 | - * Returns information about whether a particular index exists. |
|
608 | - * |
|
609 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html |
|
610 | - * |
|
611 | - * @param array{ |
|
612 | - * index: list, // (REQUIRED) A comma-separated list of index names |
|
613 | - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
614 | - * ignore_unavailable: boolean, // Ignore unavailable indexes (default: false) |
|
615 | - * allow_no_indices: boolean, // Ignore if a wildcard expression resolves to no concrete indices (default: false) |
|
616 | - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
617 | - * flat_settings: boolean, // Return settings in flat format (default: false) |
|
618 | - * include_defaults: boolean, // Whether to return all default setting for each of the indices. |
|
619 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
620 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
621 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
622 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
623 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
624 | - * } $params |
|
625 | - * |
|
626 | - * @throws MissingParameterException if a required parameter is missing |
|
627 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
628 | - * @throws ClientResponseException if the status code of response is 4xx |
|
629 | - * @throws ServerResponseException if the status code of response is 5xx |
|
630 | - * |
|
631 | - * @return Elasticsearch|Promise |
|
632 | - */ |
|
633 | - public function exists(array $params = []) |
|
634 | - { |
|
635 | - $this->checkRequiredParameters(['index'], $params); |
|
636 | - $url = '/' . $this->encode($params['index']); |
|
637 | - $method = 'HEAD'; |
|
638 | - $url = $this->addQueryString($url, $params, ['local', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'flat_settings', 'include_defaults', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
639 | - $headers = ['Accept' => 'application/json']; |
|
640 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
641 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.exists'); |
|
642 | - return $this->client->sendRequest($request); |
|
643 | - } |
|
644 | - /** |
|
645 | - * Returns information about whether a particular alias exists. |
|
646 | - * |
|
647 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html |
|
648 | - * |
|
649 | - * @param array{ |
|
650 | - * name: list, // (REQUIRED) A comma-separated list of alias names to return |
|
651 | - * index: list, // A comma-separated list of index names to filter aliases |
|
652 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
653 | - * 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) |
|
654 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
655 | - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
656 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
657 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
658 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
659 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
660 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
661 | - * } $params |
|
662 | - * |
|
663 | - * @throws MissingParameterException if a required parameter is missing |
|
664 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
665 | - * @throws ClientResponseException if the status code of response is 4xx |
|
666 | - * @throws ServerResponseException if the status code of response is 5xx |
|
667 | - * |
|
668 | - * @return Elasticsearch|Promise |
|
669 | - */ |
|
670 | - public function existsAlias(array $params = []) |
|
671 | - { |
|
672 | - $this->checkRequiredParameters(['name'], $params); |
|
673 | - if (isset($params['index'])) { |
|
674 | - $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); |
|
675 | - $method = 'HEAD'; |
|
676 | - } else { |
|
677 | - $url = '/_alias/' . $this->encode($params['name']); |
|
678 | - $method = 'HEAD'; |
|
679 | - } |
|
680 | - $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
681 | - $headers = ['Accept' => 'application/json']; |
|
682 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
683 | - $request = $this->addOtelAttributes($params, ['name', 'index'], $request, 'indices.exists_alias'); |
|
684 | - return $this->client->sendRequest($request); |
|
685 | - } |
|
686 | - /** |
|
687 | - * Returns information about whether a particular index template exists. |
|
688 | - * |
|
689 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/index-templates.html |
|
690 | - * |
|
691 | - * @param array{ |
|
692 | - * name: string, // (REQUIRED) The name of the template |
|
693 | - * flat_settings: boolean, // Return settings in flat format (default: false) |
|
694 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
695 | - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
696 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
697 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
698 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
699 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
700 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
701 | - * } $params |
|
702 | - * |
|
703 | - * @throws MissingParameterException if a required parameter is missing |
|
704 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
705 | - * @throws ClientResponseException if the status code of response is 4xx |
|
706 | - * @throws ServerResponseException if the status code of response is 5xx |
|
707 | - * |
|
708 | - * @return Elasticsearch|Promise |
|
709 | - */ |
|
710 | - public function existsIndexTemplate(array $params = []) |
|
711 | - { |
|
712 | - $this->checkRequiredParameters(['name'], $params); |
|
713 | - $url = '/_index_template/' . $this->encode($params['name']); |
|
714 | - $method = 'HEAD'; |
|
715 | - $url = $this->addQueryString($url, $params, ['flat_settings', 'master_timeout', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
716 | - $headers = ['Accept' => 'application/json']; |
|
717 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
718 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.exists_index_template'); |
|
719 | - return $this->client->sendRequest($request); |
|
720 | - } |
|
721 | - /** |
|
722 | - * Returns information about whether a particular index template exists. |
|
723 | - * |
|
724 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-template-exists-v1.html |
|
725 | - * |
|
726 | - * @param array{ |
|
727 | - * name: list, // (REQUIRED) The comma separated names of the index templates |
|
728 | - * flat_settings: boolean, // Return settings in flat format (default: false) |
|
729 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
730 | - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
731 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
732 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
733 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
734 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
735 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
736 | - * } $params |
|
737 | - * |
|
738 | - * @throws MissingParameterException if a required parameter is missing |
|
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 existsTemplate(array $params = []) |
|
746 | - { |
|
747 | - $this->checkRequiredParameters(['name'], $params); |
|
748 | - $url = '/_template/' . $this->encode($params['name']); |
|
749 | - $method = 'HEAD'; |
|
750 | - $url = $this->addQueryString($url, $params, ['flat_settings', 'master_timeout', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
751 | - $headers = ['Accept' => 'application/json']; |
|
752 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
753 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.exists_template'); |
|
754 | - return $this->client->sendRequest($request); |
|
755 | - } |
|
756 | - /** |
|
757 | - * Retrieves information about the index's current data stream lifecycle, such as any potential encountered error, time since creation etc. |
|
758 | - * |
|
759 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams-explain-lifecycle.html |
|
760 | - * |
|
761 | - * @param array{ |
|
762 | - * index: string, // (REQUIRED) The name of the index to explain |
|
763 | - * include_defaults: boolean, // indicates if the API should return the default values the system uses for the index's lifecycle |
|
764 | - * master_timeout: time, // Specify timeout for connection to master |
|
765 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
766 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
767 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
768 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
769 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
770 | - * } $params |
|
771 | - * |
|
772 | - * @throws MissingParameterException if a required parameter is missing |
|
773 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
774 | - * @throws ClientResponseException if the status code of response is 4xx |
|
775 | - * @throws ServerResponseException if the status code of response is 5xx |
|
776 | - * |
|
777 | - * @return Elasticsearch|Promise |
|
778 | - */ |
|
779 | - public function explainDataLifecycle(array $params = []) |
|
780 | - { |
|
781 | - $this->checkRequiredParameters(['index'], $params); |
|
782 | - $url = '/' . $this->encode($params['index']) . '/_lifecycle/explain'; |
|
783 | - $method = 'GET'; |
|
784 | - $url = $this->addQueryString($url, $params, ['include_defaults', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
785 | - $headers = ['Accept' => 'application/json']; |
|
786 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
787 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.explain_data_lifecycle'); |
|
788 | - return $this->client->sendRequest($request); |
|
789 | - } |
|
790 | - /** |
|
791 | - * Returns the field usage stats for each field of an index |
|
792 | - * |
|
793 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/field-usage-stats.html |
|
794 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
795 | - * |
|
796 | - * @param array{ |
|
797 | - * index: string, // (REQUIRED) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
798 | - * fields: list, // A comma-separated list of fields to include in the stats if only a subset of fields should be returned (supports wildcards) |
|
799 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
800 | - * 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) |
|
801 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
802 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
803 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
804 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
805 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
806 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
807 | - * } $params |
|
808 | - * |
|
809 | - * @throws MissingParameterException if a required parameter is missing |
|
810 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
811 | - * @throws ClientResponseException if the status code of response is 4xx |
|
812 | - * @throws ServerResponseException if the status code of response is 5xx |
|
813 | - * |
|
814 | - * @return Elasticsearch|Promise |
|
815 | - */ |
|
816 | - public function fieldUsageStats(array $params = []) |
|
817 | - { |
|
818 | - $this->checkRequiredParameters(['index'], $params); |
|
819 | - $url = '/' . $this->encode($params['index']) . '/_field_usage_stats'; |
|
820 | - $method = 'GET'; |
|
821 | - $url = $this->addQueryString($url, $params, ['fields', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
822 | - $headers = ['Accept' => 'application/json']; |
|
823 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
824 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.field_usage_stats'); |
|
825 | - return $this->client->sendRequest($request); |
|
826 | - } |
|
827 | - /** |
|
828 | - * Performs the flush operation on one or more indices. |
|
829 | - * |
|
830 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html |
|
831 | - * |
|
832 | - * @param array{ |
|
833 | - * index: list, // A comma-separated list of index names; use `_all` or empty string for all indices |
|
834 | - * force: boolean, // Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal) |
|
835 | - * wait_if_ongoing: boolean, // If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. The default is true. If set to false the flush will be skipped iff if another flush operation is already running. |
|
836 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
837 | - * 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) |
|
838 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
839 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
840 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
841 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
842 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
843 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
844 | - * } $params |
|
845 | - * |
|
846 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
847 | - * @throws ClientResponseException if the status code of response is 4xx |
|
848 | - * @throws ServerResponseException if the status code of response is 5xx |
|
849 | - * |
|
850 | - * @return Elasticsearch|Promise |
|
851 | - */ |
|
852 | - public function flush(array $params = []) |
|
853 | - { |
|
854 | - if (isset($params['index'])) { |
|
855 | - $url = '/' . $this->encode($params['index']) . '/_flush'; |
|
856 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
857 | - } else { |
|
858 | - $url = '/_flush'; |
|
859 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
860 | - } |
|
861 | - $url = $this->addQueryString($url, $params, ['force', 'wait_if_ongoing', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
862 | - $headers = ['Accept' => 'application/json']; |
|
863 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
864 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.flush'); |
|
865 | - return $this->client->sendRequest($request); |
|
866 | - } |
|
867 | - /** |
|
868 | - * Performs the force merge operation on one or more indices. |
|
869 | - * |
|
870 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html |
|
871 | - * |
|
872 | - * @param array{ |
|
873 | - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
874 | - * flush: boolean, // Specify whether the index should be flushed after performing the operation (default: true) |
|
875 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
876 | - * 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) |
|
877 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
878 | - * max_num_segments: number, // The number of segments the index should be merged into (default: dynamic) |
|
879 | - * only_expunge_deletes: boolean, // Specify whether the operation should only expunge deleted documents |
|
880 | - * wait_for_completion: boolean, // Should the request wait until the force merge is completed. |
|
881 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
882 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
883 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
884 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
885 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
886 | - * } $params |
|
887 | - * |
|
888 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
889 | - * @throws ClientResponseException if the status code of response is 4xx |
|
890 | - * @throws ServerResponseException if the status code of response is 5xx |
|
891 | - * |
|
892 | - * @return Elasticsearch|Promise |
|
893 | - */ |
|
894 | - public function forcemerge(array $params = []) |
|
895 | - { |
|
896 | - if (isset($params['index'])) { |
|
897 | - $url = '/' . $this->encode($params['index']) . '/_forcemerge'; |
|
898 | - $method = 'POST'; |
|
899 | - } else { |
|
900 | - $url = '/_forcemerge'; |
|
901 | - $method = 'POST'; |
|
902 | - } |
|
903 | - $url = $this->addQueryString($url, $params, ['flush', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'max_num_segments', 'only_expunge_deletes', 'wait_for_completion', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
904 | - $headers = ['Accept' => 'application/json']; |
|
905 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
906 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.forcemerge'); |
|
907 | - return $this->client->sendRequest($request); |
|
908 | - } |
|
909 | - /** |
|
910 | - * Returns information about one or more indices. |
|
911 | - * |
|
912 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html |
|
913 | - * |
|
914 | - * @param array{ |
|
915 | - * index: list, // (REQUIRED) A comma-separated list of index names |
|
916 | - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
917 | - * ignore_unavailable: boolean, // Ignore unavailable indexes (default: false) |
|
918 | - * allow_no_indices: boolean, // Ignore if a wildcard expression resolves to no concrete indices (default: false) |
|
919 | - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
920 | - * features: enum, // Return only information on specified index features |
|
921 | - * flat_settings: boolean, // Return settings in flat format (default: false) |
|
922 | - * include_defaults: boolean, // Whether to return all default setting for each of the indices. |
|
923 | - * master_timeout: time, // Specify timeout for connection to master |
|
924 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
925 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
926 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
927 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
928 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
929 | - * } $params |
|
930 | - * |
|
931 | - * @throws MissingParameterException if a required parameter is missing |
|
932 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
933 | - * @throws ClientResponseException if the status code of response is 4xx |
|
934 | - * @throws ServerResponseException if the status code of response is 5xx |
|
935 | - * |
|
936 | - * @return Elasticsearch|Promise |
|
937 | - */ |
|
938 | - public function get(array $params = []) |
|
939 | - { |
|
940 | - $this->checkRequiredParameters(['index'], $params); |
|
941 | - $url = '/' . $this->encode($params['index']); |
|
942 | - $method = 'GET'; |
|
943 | - $url = $this->addQueryString($url, $params, ['local', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'features', 'flat_settings', 'include_defaults', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
944 | - $headers = ['Accept' => 'application/json']; |
|
945 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
946 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.get'); |
|
947 | - return $this->client->sendRequest($request); |
|
948 | - } |
|
949 | - /** |
|
950 | - * Returns an alias. |
|
951 | - * |
|
952 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html |
|
953 | - * |
|
954 | - * @param array{ |
|
955 | - * name: list, // A comma-separated list of alias names to return |
|
956 | - * index: list, // A comma-separated list of index names to filter aliases |
|
957 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
958 | - * 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) |
|
959 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
960 | - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
961 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
962 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
963 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
964 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
965 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
966 | - * } $params |
|
967 | - * |
|
968 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
969 | - * @throws ClientResponseException if the status code of response is 4xx |
|
970 | - * @throws ServerResponseException if the status code of response is 5xx |
|
971 | - * |
|
972 | - * @return Elasticsearch|Promise |
|
973 | - */ |
|
974 | - public function getAlias(array $params = []) |
|
975 | - { |
|
976 | - if (isset($params['index']) && isset($params['name'])) { |
|
977 | - $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); |
|
978 | - $method = 'GET'; |
|
979 | - } elseif (isset($params['name'])) { |
|
980 | - $url = '/_alias/' . $this->encode($params['name']); |
|
981 | - $method = 'GET'; |
|
982 | - } elseif (isset($params['index'])) { |
|
983 | - $url = '/' . $this->encode($params['index']) . '/_alias'; |
|
984 | - $method = 'GET'; |
|
985 | - } else { |
|
986 | - $url = '/_alias'; |
|
987 | - $method = 'GET'; |
|
988 | - } |
|
989 | - $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
990 | - $headers = ['Accept' => 'application/json']; |
|
991 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
992 | - $request = $this->addOtelAttributes($params, ['name', 'index'], $request, 'indices.get_alias'); |
|
993 | - return $this->client->sendRequest($request); |
|
994 | - } |
|
995 | - /** |
|
996 | - * Returns the data stream lifecycle of the selected data streams. |
|
997 | - * |
|
998 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-get-lifecycle.html |
|
999 | - * |
|
1000 | - * @param array{ |
|
1001 | - * name: list, // (REQUIRED) A comma-separated list of data streams to get; use `*` to get all data streams |
|
1002 | - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
1003 | - * include_defaults: boolean, // Return all relevant default configurations for the data stream (default: false) |
|
1004 | - * master_timeout: time, // Specify timeout for connection to master |
|
1005 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1006 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1007 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1008 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1009 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1010 | - * } $params |
|
1011 | - * |
|
1012 | - * @throws MissingParameterException if a required parameter is missing |
|
1013 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1014 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1015 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1016 | - * |
|
1017 | - * @return Elasticsearch|Promise |
|
1018 | - */ |
|
1019 | - public function getDataLifecycle(array $params = []) |
|
1020 | - { |
|
1021 | - $this->checkRequiredParameters(['name'], $params); |
|
1022 | - $url = '/_data_stream/' . $this->encode($params['name']) . '/_lifecycle'; |
|
1023 | - $method = 'GET'; |
|
1024 | - $url = $this->addQueryString($url, $params, ['expand_wildcards', 'include_defaults', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1025 | - $headers = ['Accept' => 'application/json']; |
|
1026 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1027 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.get_data_lifecycle'); |
|
1028 | - return $this->client->sendRequest($request); |
|
1029 | - } |
|
1030 | - /** |
|
1031 | - * Returns data streams. |
|
1032 | - * |
|
1033 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html |
|
1034 | - * |
|
1035 | - * @param array{ |
|
1036 | - * name: list, // A comma-separated list of data streams to get; use `*` to get all data streams |
|
1037 | - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
1038 | - * include_defaults: boolean, // Return all relevant default configurations for the data stream (default: false) |
|
1039 | - * master_timeout: time, // Specify timeout for connection to master |
|
1040 | - * verbose: boolean, // Whether the maximum timestamp for each data stream should be calculated and returned (default: false) |
|
1041 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1042 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1043 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1044 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1045 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1046 | - * } $params |
|
1047 | - * |
|
1048 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1049 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1050 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1051 | - * |
|
1052 | - * @return Elasticsearch|Promise |
|
1053 | - */ |
|
1054 | - public function getDataStream(array $params = []) |
|
1055 | - { |
|
1056 | - if (isset($params['name'])) { |
|
1057 | - $url = '/_data_stream/' . $this->encode($params['name']); |
|
1058 | - $method = 'GET'; |
|
1059 | - } else { |
|
1060 | - $url = '/_data_stream'; |
|
1061 | - $method = 'GET'; |
|
1062 | - } |
|
1063 | - $url = $this->addQueryString($url, $params, ['expand_wildcards', 'include_defaults', 'master_timeout', 'verbose', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1064 | - $headers = ['Accept' => 'application/json']; |
|
1065 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1066 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.get_data_stream'); |
|
1067 | - return $this->client->sendRequest($request); |
|
1068 | - } |
|
1069 | - /** |
|
1070 | - * Returns mapping for one or more fields. |
|
1071 | - * |
|
1072 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html |
|
1073 | - * |
|
1074 | - * @param array{ |
|
1075 | - * fields: list, // (REQUIRED) A comma-separated list of fields |
|
1076 | - * index: list, // A comma-separated list of index names |
|
1077 | - * include_defaults: boolean, // Whether the default mapping values should be returned as well |
|
1078 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1079 | - * 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) |
|
1080 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1081 | - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
1082 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1083 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1084 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1085 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1086 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1087 | - * } $params |
|
1088 | - * |
|
1089 | - * @throws MissingParameterException if a required parameter is missing |
|
1090 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1091 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1092 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1093 | - * |
|
1094 | - * @return Elasticsearch|Promise |
|
1095 | - */ |
|
1096 | - public function getFieldMapping(array $params = []) |
|
1097 | - { |
|
1098 | - $this->checkRequiredParameters(['fields'], $params); |
|
1099 | - if (isset($params['index'])) { |
|
1100 | - $url = '/' . $this->encode($params['index']) . '/_mapping/field/' . $this->encode($params['fields']); |
|
1101 | - $method = 'GET'; |
|
1102 | - } else { |
|
1103 | - $url = '/_mapping/field/' . $this->encode($params['fields']); |
|
1104 | - $method = 'GET'; |
|
1105 | - } |
|
1106 | - $url = $this->addQueryString($url, $params, ['include_defaults', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1107 | - $headers = ['Accept' => 'application/json']; |
|
1108 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1109 | - $request = $this->addOtelAttributes($params, ['fields', 'index'], $request, 'indices.get_field_mapping'); |
|
1110 | - return $this->client->sendRequest($request); |
|
1111 | - } |
|
1112 | - /** |
|
1113 | - * Returns an index template. |
|
1114 | - * |
|
1115 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template.html |
|
1116 | - * |
|
1117 | - * @param array{ |
|
1118 | - * name: string, // A pattern that returned template names must match |
|
1119 | - * flat_settings: boolean, // Return settings in flat format (default: false) |
|
1120 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
1121 | - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
1122 | - * include_defaults: boolean, // Return all relevant default configurations for the index template (default: false) |
|
1123 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1124 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1125 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1126 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1127 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1128 | - * } $params |
|
1129 | - * |
|
1130 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1131 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1132 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1133 | - * |
|
1134 | - * @return Elasticsearch|Promise |
|
1135 | - */ |
|
1136 | - public function getIndexTemplate(array $params = []) |
|
1137 | - { |
|
1138 | - if (isset($params['name'])) { |
|
1139 | - $url = '/_index_template/' . $this->encode($params['name']); |
|
1140 | - $method = 'GET'; |
|
1141 | - } else { |
|
1142 | - $url = '/_index_template'; |
|
1143 | - $method = 'GET'; |
|
1144 | - } |
|
1145 | - $url = $this->addQueryString($url, $params, ['flat_settings', 'master_timeout', 'local', 'include_defaults', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1146 | - $headers = ['Accept' => 'application/json']; |
|
1147 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1148 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.get_index_template'); |
|
1149 | - return $this->client->sendRequest($request); |
|
1150 | - } |
|
1151 | - /** |
|
1152 | - * Returns mappings for one or more indices. |
|
1153 | - * |
|
1154 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html |
|
1155 | - * |
|
1156 | - * @param array{ |
|
1157 | - * index: list, // A comma-separated list of index names |
|
1158 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1159 | - * 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) |
|
1160 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1161 | - * master_timeout: time, // Specify timeout for connection to master |
|
1162 | - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
1163 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1164 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1165 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1166 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1167 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1168 | - * } $params |
|
1169 | - * |
|
1170 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1171 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1172 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1173 | - * |
|
1174 | - * @return Elasticsearch|Promise |
|
1175 | - */ |
|
1176 | - public function getMapping(array $params = []) |
|
1177 | - { |
|
1178 | - if (isset($params['index'])) { |
|
1179 | - $url = '/' . $this->encode($params['index']) . '/_mapping'; |
|
1180 | - $method = 'GET'; |
|
1181 | - } else { |
|
1182 | - $url = '/_mapping'; |
|
1183 | - $method = 'GET'; |
|
1184 | - } |
|
1185 | - $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'master_timeout', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1186 | - $headers = ['Accept' => 'application/json']; |
|
1187 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1188 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.get_mapping'); |
|
1189 | - return $this->client->sendRequest($request); |
|
1190 | - } |
|
1191 | - /** |
|
1192 | - * Returns settings for one or more indices. |
|
1193 | - * |
|
1194 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html |
|
1195 | - * |
|
1196 | - * @param array{ |
|
1197 | - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
1198 | - * name: list, // The name of the settings that should be included |
|
1199 | - * master_timeout: time, // Specify timeout for connection to master |
|
1200 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1201 | - * 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) |
|
1202 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1203 | - * flat_settings: boolean, // Return settings in flat format (default: false) |
|
1204 | - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
1205 | - * include_defaults: boolean, // Whether to return all default setting for each of the indices. |
|
1206 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1207 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1208 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1209 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1210 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1211 | - * } $params |
|
1212 | - * |
|
1213 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1214 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1215 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1216 | - * |
|
1217 | - * @return Elasticsearch|Promise |
|
1218 | - */ |
|
1219 | - public function getSettings(array $params = []) |
|
1220 | - { |
|
1221 | - if (isset($params['index']) && isset($params['name'])) { |
|
1222 | - $url = '/' . $this->encode($params['index']) . '/_settings/' . $this->encode($params['name']); |
|
1223 | - $method = 'GET'; |
|
1224 | - } elseif (isset($params['index'])) { |
|
1225 | - $url = '/' . $this->encode($params['index']) . '/_settings'; |
|
1226 | - $method = 'GET'; |
|
1227 | - } elseif (isset($params['name'])) { |
|
1228 | - $url = '/_settings/' . $this->encode($params['name']); |
|
1229 | - $method = 'GET'; |
|
1230 | - } else { |
|
1231 | - $url = '/_settings'; |
|
1232 | - $method = 'GET'; |
|
1233 | - } |
|
1234 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'flat_settings', 'local', 'include_defaults', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1235 | - $headers = ['Accept' => 'application/json']; |
|
1236 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1237 | - $request = $this->addOtelAttributes($params, ['index', 'name'], $request, 'indices.get_settings'); |
|
1238 | - return $this->client->sendRequest($request); |
|
1239 | - } |
|
1240 | - /** |
|
1241 | - * Returns an index template. |
|
1242 | - * |
|
1243 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template-v1.html |
|
1244 | - * |
|
1245 | - * @param array{ |
|
1246 | - * name: list, // The comma separated names of the index templates |
|
1247 | - * flat_settings: boolean, // Return settings in flat format (default: false) |
|
1248 | - * master_timeout: time, // Explicit operation timeout for connection to master node |
|
1249 | - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
1250 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1251 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1252 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1253 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1254 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1255 | - * } $params |
|
1256 | - * |
|
1257 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1258 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1259 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1260 | - * |
|
1261 | - * @return Elasticsearch|Promise |
|
1262 | - */ |
|
1263 | - public function getTemplate(array $params = []) |
|
1264 | - { |
|
1265 | - if (isset($params['name'])) { |
|
1266 | - $url = '/_template/' . $this->encode($params['name']); |
|
1267 | - $method = 'GET'; |
|
1268 | - } else { |
|
1269 | - $url = '/_template'; |
|
1270 | - $method = 'GET'; |
|
1271 | - } |
|
1272 | - $url = $this->addQueryString($url, $params, ['flat_settings', 'master_timeout', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1273 | - $headers = ['Accept' => 'application/json']; |
|
1274 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1275 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.get_template'); |
|
1276 | - return $this->client->sendRequest($request); |
|
1277 | - } |
|
1278 | - /** |
|
1279 | - * Migrates an alias to a data stream |
|
1280 | - * |
|
1281 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html |
|
1282 | - * |
|
1283 | - * @param array{ |
|
1284 | - * name: string, // (REQUIRED) The name of the alias to migrate |
|
1285 | - * timeout: time, // Specify timeout for acknowledging the cluster state update |
|
1286 | - * master_timeout: time, // Specify timeout for connection to master |
|
1287 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1288 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1289 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1290 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1291 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1292 | - * } $params |
|
1293 | - * |
|
1294 | - * @throws MissingParameterException if a required parameter is missing |
|
1295 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1296 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1297 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1298 | - * |
|
1299 | - * @return Elasticsearch|Promise |
|
1300 | - */ |
|
1301 | - public function migrateToDataStream(array $params = []) |
|
1302 | - { |
|
1303 | - $this->checkRequiredParameters(['name'], $params); |
|
1304 | - $url = '/_data_stream/_migrate/' . $this->encode($params['name']); |
|
1305 | - $method = 'POST'; |
|
1306 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1307 | - $headers = ['Accept' => 'application/json']; |
|
1308 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1309 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.migrate_to_data_stream'); |
|
1310 | - return $this->client->sendRequest($request); |
|
1311 | - } |
|
1312 | - /** |
|
1313 | - * Modifies a data stream |
|
1314 | - * |
|
1315 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html |
|
1316 | - * |
|
1317 | - * @param array{ |
|
1318 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1319 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1320 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1321 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1322 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1323 | - * body: array, // (REQUIRED) The data stream modifications |
|
1324 | - * } $params |
|
1325 | - * |
|
1326 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1327 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1328 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1329 | - * |
|
1330 | - * @return Elasticsearch|Promise |
|
1331 | - */ |
|
1332 | - public function modifyDataStream(array $params = []) |
|
1333 | - { |
|
1334 | - $this->checkRequiredParameters(['body'], $params); |
|
1335 | - $url = '/_data_stream/_modify'; |
|
1336 | - $method = 'POST'; |
|
1337 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1338 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1339 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1340 | - $request = $this->addOtelAttributes($params, [], $request, 'indices.modify_data_stream'); |
|
1341 | - return $this->client->sendRequest($request); |
|
1342 | - } |
|
1343 | - /** |
|
1344 | - * Opens an index. |
|
1345 | - * |
|
1346 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html |
|
1347 | - * |
|
1348 | - * @param array{ |
|
1349 | - * index: list, // (REQUIRED) A comma separated list of indices to open |
|
1350 | - * timeout: time, // Explicit operation timeout |
|
1351 | - * master_timeout: time, // Specify timeout for connection to master |
|
1352 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1353 | - * 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) |
|
1354 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1355 | - * wait_for_active_shards: string, // Sets the number of active shards to wait for before the operation returns. |
|
1356 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1357 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1358 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1359 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1360 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1361 | - * } $params |
|
1362 | - * |
|
1363 | - * @throws MissingParameterException if a required parameter is missing |
|
1364 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1365 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1366 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1367 | - * |
|
1368 | - * @return Elasticsearch|Promise |
|
1369 | - */ |
|
1370 | - public function open(array $params = []) |
|
1371 | - { |
|
1372 | - $this->checkRequiredParameters(['index'], $params); |
|
1373 | - $url = '/' . $this->encode($params['index']) . '/_open'; |
|
1374 | - $method = 'POST'; |
|
1375 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1376 | - $headers = ['Accept' => 'application/json']; |
|
1377 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1378 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.open'); |
|
1379 | - return $this->client->sendRequest($request); |
|
1380 | - } |
|
1381 | - /** |
|
1382 | - * Promotes a data stream from a replicated data stream managed by CCR to a regular data stream |
|
1383 | - * |
|
1384 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html |
|
1385 | - * |
|
1386 | - * @param array{ |
|
1387 | - * name: string, // (REQUIRED) The name of the data stream |
|
1388 | - * master_timeout: time, // Specify timeout for connection to master |
|
1389 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1390 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1391 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1392 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1393 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1394 | - * } $params |
|
1395 | - * |
|
1396 | - * @throws MissingParameterException if a required parameter is missing |
|
1397 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1398 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1399 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1400 | - * |
|
1401 | - * @return Elasticsearch|Promise |
|
1402 | - */ |
|
1403 | - public function promoteDataStream(array $params = []) |
|
1404 | - { |
|
1405 | - $this->checkRequiredParameters(['name'], $params); |
|
1406 | - $url = '/_data_stream/_promote/' . $this->encode($params['name']); |
|
1407 | - $method = 'POST'; |
|
1408 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1409 | - $headers = ['Accept' => 'application/json']; |
|
1410 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1411 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.promote_data_stream'); |
|
1412 | - return $this->client->sendRequest($request); |
|
1413 | - } |
|
1414 | - /** |
|
1415 | - * Creates or updates an alias. |
|
1416 | - * |
|
1417 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html |
|
1418 | - * |
|
1419 | - * @param array{ |
|
1420 | - * index: list, // (REQUIRED) A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices. |
|
1421 | - * name: string, // (REQUIRED) The name of the alias to be created or updated |
|
1422 | - * timeout: time, // Explicit timestamp for the document |
|
1423 | - * master_timeout: time, // Specify timeout for connection to master |
|
1424 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1425 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1426 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1427 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1428 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1429 | - * body: array, // The settings for the alias, such as `routing` or `filter` |
|
1430 | - * } $params |
|
1431 | - * |
|
1432 | - * @throws MissingParameterException if a required parameter is missing |
|
1433 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1434 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1435 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1436 | - * |
|
1437 | - * @return Elasticsearch|Promise |
|
1438 | - */ |
|
1439 | - public function putAlias(array $params = []) |
|
1440 | - { |
|
1441 | - $this->checkRequiredParameters(['index', 'name'], $params); |
|
1442 | - $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); |
|
1443 | - $method = 'PUT'; |
|
1444 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1445 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1446 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1447 | - $request = $this->addOtelAttributes($params, ['index', 'name'], $request, 'indices.put_alias'); |
|
1448 | - return $this->client->sendRequest($request); |
|
1449 | - } |
|
1450 | - /** |
|
1451 | - * Updates the data stream lifecycle of the selected data streams. |
|
1452 | - * |
|
1453 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-put-lifecycle.html |
|
1454 | - * |
|
1455 | - * @param array{ |
|
1456 | - * name: list, // (REQUIRED) A comma-separated list of data streams whose lifecycle will be updated; use `*` to set the lifecycle to all data streams |
|
1457 | - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
1458 | - * timeout: time, // Explicit timestamp for the document |
|
1459 | - * master_timeout: time, // Specify timeout for connection to master |
|
1460 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1461 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1462 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1463 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1464 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1465 | - * body: array, // The data stream lifecycle configuration that consist of the data retention |
|
1466 | - * } $params |
|
1467 | - * |
|
1468 | - * @throws MissingParameterException if a required parameter is missing |
|
1469 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1470 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1471 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1472 | - * |
|
1473 | - * @return Elasticsearch|Promise |
|
1474 | - */ |
|
1475 | - public function putDataLifecycle(array $params = []) |
|
1476 | - { |
|
1477 | - $this->checkRequiredParameters(['name'], $params); |
|
1478 | - $url = '/_data_stream/' . $this->encode($params['name']) . '/_lifecycle'; |
|
1479 | - $method = 'PUT'; |
|
1480 | - $url = $this->addQueryString($url, $params, ['expand_wildcards', 'timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1481 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1482 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1483 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.put_data_lifecycle'); |
|
1484 | - return $this->client->sendRequest($request); |
|
1485 | - } |
|
1486 | - /** |
|
1487 | - * Creates or updates an index template. |
|
1488 | - * |
|
1489 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-template.html |
|
1490 | - * |
|
1491 | - * @param array{ |
|
1492 | - * name: string, // (REQUIRED) The name of the template |
|
1493 | - * create: boolean, // Whether the index template should only be added if new or can also replace an existing one |
|
1494 | - * cause: string, // User defined reason for creating/updating the index template |
|
1495 | - * master_timeout: time, // Specify timeout for connection to master |
|
1496 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1497 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1498 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1499 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1500 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1501 | - * body: array, // (REQUIRED) The template definition |
|
1502 | - * } $params |
|
1503 | - * |
|
1504 | - * @throws MissingParameterException if a required parameter is missing |
|
1505 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1506 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1507 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1508 | - * |
|
1509 | - * @return Elasticsearch|Promise |
|
1510 | - */ |
|
1511 | - public function putIndexTemplate(array $params = []) |
|
1512 | - { |
|
1513 | - $this->checkRequiredParameters(['name', 'body'], $params); |
|
1514 | - $url = '/_index_template/' . $this->encode($params['name']); |
|
1515 | - $method = 'PUT'; |
|
1516 | - $url = $this->addQueryString($url, $params, ['create', 'cause', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1517 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1518 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1519 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.put_index_template'); |
|
1520 | - return $this->client->sendRequest($request); |
|
1521 | - } |
|
1522 | - /** |
|
1523 | - * Updates the index mappings. |
|
1524 | - * |
|
1525 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html |
|
1526 | - * |
|
1527 | - * @param array{ |
|
1528 | - * index: list, // (REQUIRED) A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. |
|
1529 | - * timeout: time, // Explicit operation timeout |
|
1530 | - * master_timeout: time, // Specify timeout for connection to master |
|
1531 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1532 | - * 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) |
|
1533 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1534 | - * write_index_only: boolean, // When true, applies mappings only to the write index of an alias or data stream |
|
1535 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1536 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1537 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1538 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1539 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1540 | - * body: array, // (REQUIRED) The mapping definition |
|
1541 | - * } $params |
|
1542 | - * |
|
1543 | - * @throws MissingParameterException if a required parameter is missing |
|
1544 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1545 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1546 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1547 | - * |
|
1548 | - * @return Elasticsearch|Promise |
|
1549 | - */ |
|
1550 | - public function putMapping(array $params = []) |
|
1551 | - { |
|
1552 | - $this->checkRequiredParameters(['index', 'body'], $params); |
|
1553 | - $url = '/' . $this->encode($params['index']) . '/_mapping'; |
|
1554 | - $method = 'PUT'; |
|
1555 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'write_index_only', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1556 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1557 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1558 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.put_mapping'); |
|
1559 | - return $this->client->sendRequest($request); |
|
1560 | - } |
|
1561 | - /** |
|
1562 | - * Updates the index settings. |
|
1563 | - * |
|
1564 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html |
|
1565 | - * |
|
1566 | - * @param array{ |
|
1567 | - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
1568 | - * master_timeout: time, // Specify timeout for connection to master |
|
1569 | - * timeout: time, // Explicit operation timeout |
|
1570 | - * preserve_existing: boolean, // Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false` |
|
1571 | - * reopen: boolean, // Whether to close and reopen the index to apply non-dynamic settings. If set to `true` the indices to which the settings are being applied will be closed temporarily and then reopened in order to apply the changes. The default is `false` |
|
1572 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1573 | - * 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) |
|
1574 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1575 | - * flat_settings: boolean, // Return settings in flat format (default: false) |
|
1576 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1577 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1578 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1579 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1580 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1581 | - * body: array, // (REQUIRED) The index settings to be updated |
|
1582 | - * } $params |
|
1583 | - * |
|
1584 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1585 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1586 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1587 | - * |
|
1588 | - * @return Elasticsearch|Promise |
|
1589 | - */ |
|
1590 | - public function putSettings(array $params = []) |
|
1591 | - { |
|
1592 | - $this->checkRequiredParameters(['body'], $params); |
|
1593 | - if (isset($params['index'])) { |
|
1594 | - $url = '/' . $this->encode($params['index']) . '/_settings'; |
|
1595 | - $method = 'PUT'; |
|
1596 | - } else { |
|
1597 | - $url = '/_settings'; |
|
1598 | - $method = 'PUT'; |
|
1599 | - } |
|
1600 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'timeout', 'preserve_existing', 'reopen', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'flat_settings', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1601 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1602 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1603 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.put_settings'); |
|
1604 | - return $this->client->sendRequest($request); |
|
1605 | - } |
|
1606 | - /** |
|
1607 | - * Creates or updates an index template. |
|
1608 | - * |
|
1609 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates-v1.html |
|
1610 | - * |
|
1611 | - * @param array{ |
|
1612 | - * name: string, // (REQUIRED) The name of the template |
|
1613 | - * order: number, // The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers) |
|
1614 | - * create: boolean, // Whether the index template should only be added if new or can also replace an existing one |
|
1615 | - * master_timeout: time, // Specify timeout for connection to master |
|
1616 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1617 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1618 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1619 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1620 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1621 | - * body: array, // (REQUIRED) The template definition |
|
1622 | - * } $params |
|
1623 | - * |
|
1624 | - * @throws MissingParameterException if a required parameter is missing |
|
1625 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1626 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1627 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1628 | - * |
|
1629 | - * @return Elasticsearch|Promise |
|
1630 | - */ |
|
1631 | - public function putTemplate(array $params = []) |
|
1632 | - { |
|
1633 | - $this->checkRequiredParameters(['name', 'body'], $params); |
|
1634 | - $url = '/_template/' . $this->encode($params['name']); |
|
1635 | - $method = 'PUT'; |
|
1636 | - $url = $this->addQueryString($url, $params, ['order', 'create', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1637 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1638 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1639 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.put_template'); |
|
1640 | - return $this->client->sendRequest($request); |
|
1641 | - } |
|
1642 | - /** |
|
1643 | - * Returns information about ongoing index shard recoveries. |
|
1644 | - * |
|
1645 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html |
|
1646 | - * |
|
1647 | - * @param array{ |
|
1648 | - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
1649 | - * detailed: boolean, // Whether to display detailed information about shard recovery |
|
1650 | - * active_only: boolean, // Display only those recoveries that are currently on-going |
|
1651 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1652 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1653 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1654 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1655 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1656 | - * } $params |
|
1657 | - * |
|
1658 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1659 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1660 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1661 | - * |
|
1662 | - * @return Elasticsearch|Promise |
|
1663 | - */ |
|
1664 | - public function recovery(array $params = []) |
|
1665 | - { |
|
1666 | - if (isset($params['index'])) { |
|
1667 | - $url = '/' . $this->encode($params['index']) . '/_recovery'; |
|
1668 | - $method = 'GET'; |
|
1669 | - } else { |
|
1670 | - $url = '/_recovery'; |
|
1671 | - $method = 'GET'; |
|
1672 | - } |
|
1673 | - $url = $this->addQueryString($url, $params, ['detailed', 'active_only', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1674 | - $headers = ['Accept' => 'application/json']; |
|
1675 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1676 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.recovery'); |
|
1677 | - return $this->client->sendRequest($request); |
|
1678 | - } |
|
1679 | - /** |
|
1680 | - * Performs the refresh operation in one or more indices. |
|
1681 | - * |
|
1682 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html |
|
1683 | - * |
|
1684 | - * @param array{ |
|
1685 | - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
1686 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1687 | - * 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) |
|
1688 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1689 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1690 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1691 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1692 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1693 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1694 | - * } $params |
|
1695 | - * |
|
1696 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1697 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1698 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1699 | - * |
|
1700 | - * @return Elasticsearch|Promise |
|
1701 | - */ |
|
1702 | - public function refresh(array $params = []) |
|
1703 | - { |
|
1704 | - if (isset($params['index'])) { |
|
1705 | - $url = '/' . $this->encode($params['index']) . '/_refresh'; |
|
1706 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1707 | - } else { |
|
1708 | - $url = '/_refresh'; |
|
1709 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1710 | - } |
|
1711 | - $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1712 | - $headers = ['Accept' => 'application/json']; |
|
1713 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1714 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.refresh'); |
|
1715 | - return $this->client->sendRequest($request); |
|
1716 | - } |
|
1717 | - /** |
|
1718 | - * Reloads an index's search analyzers and their resources. |
|
1719 | - * |
|
1720 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-reload-analyzers.html |
|
1721 | - * |
|
1722 | - * @param array{ |
|
1723 | - * index: list, // (REQUIRED) A comma-separated list of index names to reload analyzers for |
|
1724 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1725 | - * 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) |
|
1726 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1727 | - * resource: string, // changed resource to reload analyzers from if applicable |
|
1728 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1729 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1730 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1731 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1732 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1733 | - * } $params |
|
1734 | - * |
|
1735 | - * @throws MissingParameterException if a required parameter is missing |
|
1736 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1737 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1738 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1739 | - * |
|
1740 | - * @return Elasticsearch|Promise |
|
1741 | - */ |
|
1742 | - public function reloadSearchAnalyzers(array $params = []) |
|
1743 | - { |
|
1744 | - $this->checkRequiredParameters(['index'], $params); |
|
1745 | - $url = '/' . $this->encode($params['index']) . '/_reload_search_analyzers'; |
|
1746 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1747 | - $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'resource', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1748 | - $headers = ['Accept' => 'application/json']; |
|
1749 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1750 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.reload_search_analyzers'); |
|
1751 | - return $this->client->sendRequest($request); |
|
1752 | - } |
|
1753 | - /** |
|
1754 | - * Resolves the specified index expressions to return information about each cluster, including the local cluster, if included. |
|
1755 | - * |
|
1756 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-cluster-api.html |
|
1757 | - * |
|
1758 | - * @param array{ |
|
1759 | - * name: list, // (REQUIRED) A comma-separated list of cluster:index names or wildcard expressions |
|
1760 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1761 | - * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled |
|
1762 | - * 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) |
|
1763 | - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
1764 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1765 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1766 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1767 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1768 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1769 | - * } $params |
|
1770 | - * |
|
1771 | - * @throws MissingParameterException if a required parameter is missing |
|
1772 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1773 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1774 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1775 | - * |
|
1776 | - * @return Elasticsearch|Promise |
|
1777 | - */ |
|
1778 | - public function resolveCluster(array $params = []) |
|
1779 | - { |
|
1780 | - $this->checkRequiredParameters(['name'], $params); |
|
1781 | - $url = '/_resolve/cluster/' . $this->encode($params['name']); |
|
1782 | - $method = 'GET'; |
|
1783 | - $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1784 | - $headers = ['Accept' => 'application/json']; |
|
1785 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1786 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.resolve_cluster'); |
|
1787 | - return $this->client->sendRequest($request); |
|
1788 | - } |
|
1789 | - /** |
|
1790 | - * Returns information about any matching indices, aliases, and data streams |
|
1791 | - * |
|
1792 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-index-api.html |
|
1793 | - * |
|
1794 | - * @param array{ |
|
1795 | - * name: list, // (REQUIRED) A comma-separated list of names or wildcard expressions |
|
1796 | - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
1797 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1798 | - * 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) |
|
1799 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1800 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1801 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1802 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1803 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1804 | - * } $params |
|
1805 | - * |
|
1806 | - * @throws MissingParameterException if a required parameter is missing |
|
1807 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1808 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1809 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1810 | - * |
|
1811 | - * @return Elasticsearch|Promise |
|
1812 | - */ |
|
1813 | - public function resolveIndex(array $params = []) |
|
1814 | - { |
|
1815 | - $this->checkRequiredParameters(['name'], $params); |
|
1816 | - $url = '/_resolve/index/' . $this->encode($params['name']); |
|
1817 | - $method = 'GET'; |
|
1818 | - $url = $this->addQueryString($url, $params, ['expand_wildcards', 'ignore_unavailable', 'allow_no_indices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1819 | - $headers = ['Accept' => 'application/json']; |
|
1820 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1821 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.resolve_index'); |
|
1822 | - return $this->client->sendRequest($request); |
|
1823 | - } |
|
1824 | - /** |
|
1825 | - * Updates an alias to point to a new index when the existing index |
|
1826 | - * is considered to be too large or too old. |
|
1827 | - * |
|
1828 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html |
|
1829 | - * |
|
1830 | - * @param array{ |
|
1831 | - * alias: string, // (REQUIRED) The name of the alias to rollover |
|
1832 | - * new_index: string, // The name of the rollover index |
|
1833 | - * timeout: time, // Explicit operation timeout |
|
1834 | - * dry_run: boolean, // If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false |
|
1835 | - * master_timeout: time, // Specify timeout for connection to master |
|
1836 | - * wait_for_active_shards: string, // Set the number of active shards to wait for on the newly created rollover index before the operation returns. |
|
1837 | - * lazy: boolean, // If set to true, the rollover action will only mark a data stream to signal that it needs to be rolled over at the next write. Only allowed on data streams. |
|
1838 | - * target_failure_store: boolean, // If set to true, the rollover action will be applied on the failure store of the data stream. |
|
1839 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1840 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1841 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1842 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1843 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1844 | - * body: array, // The conditions that needs to be met for executing rollover |
|
1845 | - * } $params |
|
1846 | - * |
|
1847 | - * @throws MissingParameterException if a required parameter is missing |
|
1848 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1849 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1850 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1851 | - * |
|
1852 | - * @return Elasticsearch|Promise |
|
1853 | - */ |
|
1854 | - public function rollover(array $params = []) |
|
1855 | - { |
|
1856 | - $this->checkRequiredParameters(['alias'], $params); |
|
1857 | - if (isset($params['new_index'])) { |
|
1858 | - $url = '/' . $this->encode($params['alias']) . '/_rollover/' . $this->encode($params['new_index']); |
|
1859 | - $method = 'POST'; |
|
1860 | - } else { |
|
1861 | - $url = '/' . $this->encode($params['alias']) . '/_rollover'; |
|
1862 | - $method = 'POST'; |
|
1863 | - } |
|
1864 | - $url = $this->addQueryString($url, $params, ['timeout', 'dry_run', 'master_timeout', 'wait_for_active_shards', 'lazy', 'target_failure_store', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1865 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1866 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1867 | - $request = $this->addOtelAttributes($params, ['alias', 'new_index'], $request, 'indices.rollover'); |
|
1868 | - return $this->client->sendRequest($request); |
|
1869 | - } |
|
1870 | - /** |
|
1871 | - * Provides low-level information about segments in a Lucene index. |
|
1872 | - * |
|
1873 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html |
|
1874 | - * |
|
1875 | - * @param array{ |
|
1876 | - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
1877 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1878 | - * 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) |
|
1879 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1880 | - * verbose: boolean, // Includes detailed memory usage by Lucene. |
|
1881 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1882 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1883 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1884 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1885 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1886 | - * } $params |
|
1887 | - * |
|
1888 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1889 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1890 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1891 | - * |
|
1892 | - * @return Elasticsearch|Promise |
|
1893 | - */ |
|
1894 | - public function segments(array $params = []) |
|
1895 | - { |
|
1896 | - if (isset($params['index'])) { |
|
1897 | - $url = '/' . $this->encode($params['index']) . '/_segments'; |
|
1898 | - $method = 'GET'; |
|
1899 | - } else { |
|
1900 | - $url = '/_segments'; |
|
1901 | - $method = 'GET'; |
|
1902 | - } |
|
1903 | - $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'verbose', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1904 | - $headers = ['Accept' => 'application/json']; |
|
1905 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1906 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.segments'); |
|
1907 | - return $this->client->sendRequest($request); |
|
1908 | - } |
|
1909 | - /** |
|
1910 | - * Provides store information for shard copies of indices. |
|
1911 | - * |
|
1912 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.html |
|
1913 | - * |
|
1914 | - * @param array{ |
|
1915 | - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
1916 | - * status: list, // A comma-separated list of statuses used to filter on shards to get store information for |
|
1917 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1918 | - * 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) |
|
1919 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1920 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1921 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1922 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1923 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1924 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1925 | - * } $params |
|
1926 | - * |
|
1927 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1928 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1929 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1930 | - * |
|
1931 | - * @return Elasticsearch|Promise |
|
1932 | - */ |
|
1933 | - public function shardStores(array $params = []) |
|
1934 | - { |
|
1935 | - if (isset($params['index'])) { |
|
1936 | - $url = '/' . $this->encode($params['index']) . '/_shard_stores'; |
|
1937 | - $method = 'GET'; |
|
1938 | - } else { |
|
1939 | - $url = '/_shard_stores'; |
|
1940 | - $method = 'GET'; |
|
1941 | - } |
|
1942 | - $url = $this->addQueryString($url, $params, ['status', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1943 | - $headers = ['Accept' => 'application/json']; |
|
1944 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1945 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.shard_stores'); |
|
1946 | - return $this->client->sendRequest($request); |
|
1947 | - } |
|
1948 | - /** |
|
1949 | - * Allow to shrink an existing index into a new index with fewer primary shards. |
|
1950 | - * |
|
1951 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html |
|
1952 | - * |
|
1953 | - * @param array{ |
|
1954 | - * index: string, // (REQUIRED) The name of the source index to shrink |
|
1955 | - * target: string, // (REQUIRED) The name of the target index to shrink into |
|
1956 | - * timeout: time, // Explicit operation timeout |
|
1957 | - * master_timeout: time, // Specify timeout for connection to master |
|
1958 | - * wait_for_active_shards: string, // Set the number of active shards to wait for on the shrunken index before the operation returns. |
|
1959 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1960 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1961 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1962 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1963 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1964 | - * body: array, // The configuration for the target index (`settings` and `aliases`) |
|
1965 | - * } $params |
|
1966 | - * |
|
1967 | - * @throws MissingParameterException if a required parameter is missing |
|
1968 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
1969 | - * @throws ClientResponseException if the status code of response is 4xx |
|
1970 | - * @throws ServerResponseException if the status code of response is 5xx |
|
1971 | - * |
|
1972 | - * @return Elasticsearch|Promise |
|
1973 | - */ |
|
1974 | - public function shrink(array $params = []) |
|
1975 | - { |
|
1976 | - $this->checkRequiredParameters(['index', 'target'], $params); |
|
1977 | - $url = '/' . $this->encode($params['index']) . '/_shrink/' . $this->encode($params['target']); |
|
1978 | - $method = 'PUT'; |
|
1979 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1980 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1981 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1982 | - $request = $this->addOtelAttributes($params, ['index', 'target'], $request, 'indices.shrink'); |
|
1983 | - return $this->client->sendRequest($request); |
|
1984 | - } |
|
1985 | - /** |
|
1986 | - * Simulate matching the given index name against the index templates in the system |
|
1987 | - * |
|
1988 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-index.html |
|
1989 | - * |
|
1990 | - * @param array{ |
|
1991 | - * name: string, // (REQUIRED) The name of the index (it must be a concrete index name) |
|
1992 | - * create: boolean, // Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one |
|
1993 | - * cause: string, // User defined reason for dry-run creating the new template for simulation purposes |
|
1994 | - * master_timeout: time, // Specify timeout for connection to master |
|
1995 | - * include_defaults: boolean, // Return all relevant default configurations for this index template simulation (default: false) |
|
1996 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1997 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1998 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1999 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
2000 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
2001 | - * body: array, // New index template definition, which will be included in the simulation, as if it already exists in the system |
|
2002 | - * } $params |
|
2003 | - * |
|
2004 | - * @throws MissingParameterException if a required parameter is missing |
|
2005 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
2006 | - * @throws ClientResponseException if the status code of response is 4xx |
|
2007 | - * @throws ServerResponseException if the status code of response is 5xx |
|
2008 | - * |
|
2009 | - * @return Elasticsearch|Promise |
|
2010 | - */ |
|
2011 | - public function simulateIndexTemplate(array $params = []) |
|
2012 | - { |
|
2013 | - $this->checkRequiredParameters(['name'], $params); |
|
2014 | - $url = '/_index_template/_simulate_index/' . $this->encode($params['name']); |
|
2015 | - $method = 'POST'; |
|
2016 | - $url = $this->addQueryString($url, $params, ['create', 'cause', 'master_timeout', 'include_defaults', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
2017 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
2018 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
2019 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.simulate_index_template'); |
|
2020 | - return $this->client->sendRequest($request); |
|
2021 | - } |
|
2022 | - /** |
|
2023 | - * Simulate resolving the given template name or body |
|
2024 | - * |
|
2025 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-template.html |
|
2026 | - * |
|
2027 | - * @param array{ |
|
2028 | - * name: string, // The name of the index template |
|
2029 | - * create: boolean, // Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one |
|
2030 | - * cause: string, // User defined reason for dry-run creating the new template for simulation purposes |
|
2031 | - * master_timeout: time, // Specify timeout for connection to master |
|
2032 | - * include_defaults: boolean, // Return all relevant default configurations for this template simulation (default: false) |
|
2033 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
2034 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
2035 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
2036 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
2037 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
2038 | - * body: array, // New index template definition to be simulated, if no index template name is specified |
|
2039 | - * } $params |
|
2040 | - * |
|
2041 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
2042 | - * @throws ClientResponseException if the status code of response is 4xx |
|
2043 | - * @throws ServerResponseException if the status code of response is 5xx |
|
2044 | - * |
|
2045 | - * @return Elasticsearch|Promise |
|
2046 | - */ |
|
2047 | - public function simulateTemplate(array $params = []) |
|
2048 | - { |
|
2049 | - if (isset($params['name'])) { |
|
2050 | - $url = '/_index_template/_simulate/' . $this->encode($params['name']); |
|
2051 | - $method = 'POST'; |
|
2052 | - } else { |
|
2053 | - $url = '/_index_template/_simulate'; |
|
2054 | - $method = 'POST'; |
|
2055 | - } |
|
2056 | - $url = $this->addQueryString($url, $params, ['create', 'cause', 'master_timeout', 'include_defaults', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
2057 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
2058 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
2059 | - $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.simulate_template'); |
|
2060 | - return $this->client->sendRequest($request); |
|
2061 | - } |
|
2062 | - /** |
|
2063 | - * Allows you to split an existing index into a new index with more primary shards. |
|
2064 | - * |
|
2065 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-index.html |
|
2066 | - * |
|
2067 | - * @param array{ |
|
2068 | - * index: string, // (REQUIRED) The name of the source index to split |
|
2069 | - * target: string, // (REQUIRED) The name of the target index to split into |
|
2070 | - * timeout: time, // Explicit operation timeout |
|
2071 | - * master_timeout: time, // Specify timeout for connection to master |
|
2072 | - * wait_for_active_shards: string, // Set the number of active shards to wait for on the shrunken index before the operation returns. |
|
2073 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
2074 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
2075 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
2076 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
2077 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
2078 | - * body: array, // The configuration for the target index (`settings` and `aliases`) |
|
2079 | - * } $params |
|
2080 | - * |
|
2081 | - * @throws MissingParameterException if a required parameter is missing |
|
2082 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
2083 | - * @throws ClientResponseException if the status code of response is 4xx |
|
2084 | - * @throws ServerResponseException if the status code of response is 5xx |
|
2085 | - * |
|
2086 | - * @return Elasticsearch|Promise |
|
2087 | - */ |
|
2088 | - public function split(array $params = []) |
|
2089 | - { |
|
2090 | - $this->checkRequiredParameters(['index', 'target'], $params); |
|
2091 | - $url = '/' . $this->encode($params['index']) . '/_split/' . $this->encode($params['target']); |
|
2092 | - $method = 'PUT'; |
|
2093 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
2094 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
2095 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
2096 | - $request = $this->addOtelAttributes($params, ['index', 'target'], $request, 'indices.split'); |
|
2097 | - return $this->client->sendRequest($request); |
|
2098 | - } |
|
2099 | - /** |
|
2100 | - * Provides statistics on operations happening in an index. |
|
2101 | - * |
|
2102 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html |
|
2103 | - * |
|
2104 | - * @param array{ |
|
2105 | - * metric: list, // Limit the information returned the specific metrics. |
|
2106 | - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
2107 | - * completion_fields: list, // A comma-separated list of fields for the `completion` index metric (supports wildcards) |
|
2108 | - * fielddata_fields: list, // A comma-separated list of fields for the `fielddata` index metric (supports wildcards) |
|
2109 | - * fields: list, // A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) |
|
2110 | - * groups: list, // A comma-separated list of search groups for `search` index metric |
|
2111 | - * level: enum, // Return stats aggregated at cluster, index or shard level |
|
2112 | - * include_segment_file_sizes: boolean, // Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) |
|
2113 | - * include_unloaded_segments: boolean, // If set to true segment stats will include stats for segments that are not currently loaded into memory |
|
2114 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
2115 | - * forbid_closed_indices: boolean, // If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices |
|
2116 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
2117 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
2118 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
2119 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
2120 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
2121 | - * } $params |
|
2122 | - * |
|
2123 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
2124 | - * @throws ClientResponseException if the status code of response is 4xx |
|
2125 | - * @throws ServerResponseException if the status code of response is 5xx |
|
2126 | - * |
|
2127 | - * @return Elasticsearch|Promise |
|
2128 | - */ |
|
2129 | - public function stats(array $params = []) |
|
2130 | - { |
|
2131 | - if (isset($params['index']) && isset($params['metric'])) { |
|
2132 | - $url = '/' . $this->encode($params['index']) . '/_stats/' . $this->encode($params['metric']); |
|
2133 | - $method = 'GET'; |
|
2134 | - } elseif (isset($params['metric'])) { |
|
2135 | - $url = '/_stats/' . $this->encode($params['metric']); |
|
2136 | - $method = 'GET'; |
|
2137 | - } elseif (isset($params['index'])) { |
|
2138 | - $url = '/' . $this->encode($params['index']) . '/_stats'; |
|
2139 | - $method = 'GET'; |
|
2140 | - } else { |
|
2141 | - $url = '/_stats'; |
|
2142 | - $method = 'GET'; |
|
2143 | - } |
|
2144 | - $url = $this->addQueryString($url, $params, ['completion_fields', 'fielddata_fields', 'fields', 'groups', 'level', 'include_segment_file_sizes', 'include_unloaded_segments', 'expand_wildcards', 'forbid_closed_indices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
2145 | - $headers = ['Accept' => 'application/json']; |
|
2146 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
2147 | - $request = $this->addOtelAttributes($params, ['metric', 'index'], $request, 'indices.stats'); |
|
2148 | - return $this->client->sendRequest($request); |
|
2149 | - } |
|
2150 | - /** |
|
2151 | - * Unfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again. |
|
2152 | - * |
|
2153 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/unfreeze-index-api.html |
|
2154 | - * |
|
2155 | - * @param array{ |
|
2156 | - * index: string, // (REQUIRED) The name of the index to unfreeze |
|
2157 | - * timeout: time, // Explicit operation timeout |
|
2158 | - * master_timeout: time, // Specify timeout for connection to master |
|
2159 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
2160 | - * 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) |
|
2161 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
2162 | - * wait_for_active_shards: string, // Sets the number of active shards to wait for before the operation returns. |
|
2163 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
2164 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
2165 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
2166 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
2167 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
2168 | - * } $params |
|
2169 | - * |
|
2170 | - * @throws MissingParameterException if a required parameter is missing |
|
2171 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
2172 | - * @throws ClientResponseException if the status code of response is 4xx |
|
2173 | - * @throws ServerResponseException if the status code of response is 5xx |
|
2174 | - * |
|
2175 | - * @return Elasticsearch|Promise |
|
2176 | - */ |
|
2177 | - public function unfreeze(array $params = []) |
|
2178 | - { |
|
2179 | - $this->checkRequiredParameters(['index'], $params); |
|
2180 | - $url = '/' . $this->encode($params['index']) . '/_unfreeze'; |
|
2181 | - $method = 'POST'; |
|
2182 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
2183 | - $headers = ['Accept' => 'application/json']; |
|
2184 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
2185 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.unfreeze'); |
|
2186 | - return $this->client->sendRequest($request); |
|
2187 | - } |
|
2188 | - /** |
|
2189 | - * Updates index aliases. |
|
2190 | - * |
|
2191 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html |
|
2192 | - * |
|
2193 | - * @param array{ |
|
2194 | - * timeout: time, // Request timeout |
|
2195 | - * master_timeout: time, // Specify timeout for connection to master |
|
2196 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
2197 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
2198 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
2199 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
2200 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
2201 | - * body: array, // (REQUIRED) The definition of `actions` to perform |
|
2202 | - * } $params |
|
2203 | - * |
|
2204 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
2205 | - * @throws ClientResponseException if the status code of response is 4xx |
|
2206 | - * @throws ServerResponseException if the status code of response is 5xx |
|
2207 | - * |
|
2208 | - * @return Elasticsearch|Promise |
|
2209 | - */ |
|
2210 | - public function updateAliases(array $params = []) |
|
2211 | - { |
|
2212 | - $this->checkRequiredParameters(['body'], $params); |
|
2213 | - $url = '/_aliases'; |
|
2214 | - $method = 'POST'; |
|
2215 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
2216 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
2217 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
2218 | - $request = $this->addOtelAttributes($params, [], $request, 'indices.update_aliases'); |
|
2219 | - return $this->client->sendRequest($request); |
|
2220 | - } |
|
2221 | - /** |
|
2222 | - * Allows a user to validate a potentially expensive query without executing it. |
|
2223 | - * |
|
2224 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.html |
|
2225 | - * |
|
2226 | - * @param array{ |
|
2227 | - * index: list, // A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices |
|
2228 | - * explain: boolean, // Return detailed information about the error |
|
2229 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
2230 | - * 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) |
|
2231 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
2232 | - * q: string, // Query in the Lucene query string syntax |
|
2233 | - * analyzer: string, // The analyzer to use for the query string |
|
2234 | - * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) |
|
2235 | - * default_operator: enum, // The default operator for query string query (AND or OR) |
|
2236 | - * df: string, // The field to use as default where no field prefix is given in the query string |
|
2237 | - * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
2238 | - * rewrite: boolean, // Provide a more detailed explanation showing the actual Lucene query that will be executed. |
|
2239 | - * all_shards: boolean, // Execute validation on all shards instead of one random shard per index |
|
2240 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
2241 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
2242 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
2243 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
2244 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
2245 | - * body: array, // The query definition specified with the Query DSL |
|
2246 | - * } $params |
|
2247 | - * |
|
2248 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
2249 | - * @throws ClientResponseException if the status code of response is 4xx |
|
2250 | - * @throws ServerResponseException if the status code of response is 5xx |
|
2251 | - * |
|
2252 | - * @return Elasticsearch|Promise |
|
2253 | - */ |
|
2254 | - public function validateQuery(array $params = []) |
|
2255 | - { |
|
2256 | - if (isset($params['index'])) { |
|
2257 | - $url = '/' . $this->encode($params['index']) . '/_validate/query'; |
|
2258 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
2259 | - } else { |
|
2260 | - $url = '/_validate/query'; |
|
2261 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
2262 | - } |
|
2263 | - $url = $this->addQueryString($url, $params, ['explain', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'q', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'rewrite', 'all_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
2264 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
2265 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
2266 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.validate_query'); |
|
2267 | - return $this->client->sendRequest($request); |
|
2268 | - } |
|
28 | + /** |
|
29 | + * Adds a block to an index. |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-blocks.html |
|
32 | + * |
|
33 | + * @param array{ |
|
34 | + * index: list, // (REQUIRED) A comma separated list of indices to add a block to |
|
35 | + * block: string, // (REQUIRED) The block to add (one of read, write, read_only or metadata) |
|
36 | + * timeout: time, // Explicit operation timeout |
|
37 | + * master_timeout: time, // Specify timeout for connection to master |
|
38 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
39 | + * 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) |
|
40 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
41 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
42 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
43 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
44 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
45 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
46 | + * } $params |
|
47 | + * |
|
48 | + * @throws MissingParameterException if a required parameter is missing |
|
49 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
50 | + * @throws ClientResponseException if the status code of response is 4xx |
|
51 | + * @throws ServerResponseException if the status code of response is 5xx |
|
52 | + * |
|
53 | + * @return Elasticsearch|Promise |
|
54 | + */ |
|
55 | + public function addBlock(array $params = []) |
|
56 | + { |
|
57 | + $this->checkRequiredParameters(['index', 'block'], $params); |
|
58 | + $url = '/' . $this->encode($params['index']) . '/_block/' . $this->encode($params['block']); |
|
59 | + $method = 'PUT'; |
|
60 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
61 | + $headers = ['Accept' => 'application/json']; |
|
62 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
63 | + $request = $this->addOtelAttributes($params, ['index', 'block'], $request, 'indices.add_block'); |
|
64 | + return $this->client->sendRequest($request); |
|
65 | + } |
|
66 | + /** |
|
67 | + * Performs the analysis process on a text and return the tokens breakdown of the text. |
|
68 | + * |
|
69 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html |
|
70 | + * |
|
71 | + * @param array{ |
|
72 | + * index: string, // The name of the index to scope the operation |
|
73 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
74 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
75 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
76 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
77 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
78 | + * body: array, // Define analyzer/tokenizer parameters and the text on which the analysis should be performed |
|
79 | + * } $params |
|
80 | + * |
|
81 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
82 | + * @throws ClientResponseException if the status code of response is 4xx |
|
83 | + * @throws ServerResponseException if the status code of response is 5xx |
|
84 | + * |
|
85 | + * @return Elasticsearch|Promise |
|
86 | + */ |
|
87 | + public function analyze(array $params = []) |
|
88 | + { |
|
89 | + if (isset($params['index'])) { |
|
90 | + $url = '/' . $this->encode($params['index']) . '/_analyze'; |
|
91 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
92 | + } else { |
|
93 | + $url = '/_analyze'; |
|
94 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
95 | + } |
|
96 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
97 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
98 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
99 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.analyze'); |
|
100 | + return $this->client->sendRequest($request); |
|
101 | + } |
|
102 | + /** |
|
103 | + * Clears all or specific caches for one or more indices. |
|
104 | + * |
|
105 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html |
|
106 | + * |
|
107 | + * @param array{ |
|
108 | + * index: list, // A comma-separated list of index name to limit the operation |
|
109 | + * fielddata: boolean, // Clear field data |
|
110 | + * fields: list, // A comma-separated list of fields to clear when using the `fielddata` parameter (default: all) |
|
111 | + * query: boolean, // Clear query caches |
|
112 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
113 | + * 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) |
|
114 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
115 | + * request: boolean, // Clear request cache |
|
116 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
117 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
118 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
119 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
120 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
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 clearCache(array $params = []) |
|
130 | + { |
|
131 | + if (isset($params['index'])) { |
|
132 | + $url = '/' . $this->encode($params['index']) . '/_cache/clear'; |
|
133 | + $method = 'POST'; |
|
134 | + } else { |
|
135 | + $url = '/_cache/clear'; |
|
136 | + $method = 'POST'; |
|
137 | + } |
|
138 | + $url = $this->addQueryString($url, $params, ['fielddata', 'fields', 'query', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'request', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
139 | + $headers = ['Accept' => 'application/json']; |
|
140 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
141 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.clear_cache'); |
|
142 | + return $this->client->sendRequest($request); |
|
143 | + } |
|
144 | + /** |
|
145 | + * Clones an index |
|
146 | + * |
|
147 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clone-index.html |
|
148 | + * |
|
149 | + * @param array{ |
|
150 | + * index: string, // (REQUIRED) The name of the source index to clone |
|
151 | + * target: string, // (REQUIRED) The name of the target index to clone into |
|
152 | + * timeout: time, // Explicit operation timeout |
|
153 | + * master_timeout: time, // Specify timeout for connection to master |
|
154 | + * wait_for_active_shards: string, // Set the number of active shards to wait for on the cloned index before the operation returns. |
|
155 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
156 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
157 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
158 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
159 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
160 | + * body: array, // The configuration for the target index (`settings` and `aliases`) |
|
161 | + * } $params |
|
162 | + * |
|
163 | + * @throws MissingParameterException if a required parameter is missing |
|
164 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
165 | + * @throws ClientResponseException if the status code of response is 4xx |
|
166 | + * @throws ServerResponseException if the status code of response is 5xx |
|
167 | + * |
|
168 | + * @return Elasticsearch|Promise |
|
169 | + */ |
|
170 | + public function clone(array $params = []) |
|
171 | + { |
|
172 | + $this->checkRequiredParameters(['index', 'target'], $params); |
|
173 | + $url = '/' . $this->encode($params['index']) . '/_clone/' . $this->encode($params['target']); |
|
174 | + $method = 'PUT'; |
|
175 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
176 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
177 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
178 | + $request = $this->addOtelAttributes($params, ['index', 'target'], $request, 'indices.clone'); |
|
179 | + return $this->client->sendRequest($request); |
|
180 | + } |
|
181 | + /** |
|
182 | + * Closes an index. |
|
183 | + * |
|
184 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html |
|
185 | + * |
|
186 | + * @param array{ |
|
187 | + * index: list, // (REQUIRED) A comma separated list of indices to close |
|
188 | + * timeout: time, // Explicit operation timeout |
|
189 | + * master_timeout: time, // Specify timeout for connection to master |
|
190 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
191 | + * 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) |
|
192 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
193 | + * wait_for_active_shards: string, // Sets the number of active shards to wait for before the operation returns. |
|
194 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
195 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
196 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
197 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
198 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
199 | + * } $params |
|
200 | + * |
|
201 | + * @throws MissingParameterException if a required parameter is missing |
|
202 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
203 | + * @throws ClientResponseException if the status code of response is 4xx |
|
204 | + * @throws ServerResponseException if the status code of response is 5xx |
|
205 | + * |
|
206 | + * @return Elasticsearch|Promise |
|
207 | + */ |
|
208 | + public function close(array $params = []) |
|
209 | + { |
|
210 | + $this->checkRequiredParameters(['index'], $params); |
|
211 | + $url = '/' . $this->encode($params['index']) . '/_close'; |
|
212 | + $method = 'POST'; |
|
213 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
214 | + $headers = ['Accept' => 'application/json']; |
|
215 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
216 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.close'); |
|
217 | + return $this->client->sendRequest($request); |
|
218 | + } |
|
219 | + /** |
|
220 | + * Creates an index with optional settings and mappings. |
|
221 | + * |
|
222 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html |
|
223 | + * |
|
224 | + * @param array{ |
|
225 | + * index: string, // (REQUIRED) The name of the index |
|
226 | + * wait_for_active_shards: string, // Set the number of active shards to wait for before the operation returns. |
|
227 | + * timeout: time, // Explicit operation timeout |
|
228 | + * master_timeout: time, // Specify timeout for connection to master |
|
229 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
230 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
231 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
232 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
233 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
234 | + * body: array, // The configuration for the index (`settings` and `mappings`) |
|
235 | + * } $params |
|
236 | + * |
|
237 | + * @throws MissingParameterException if a required parameter is missing |
|
238 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
239 | + * @throws ClientResponseException if the status code of response is 4xx |
|
240 | + * @throws ServerResponseException if the status code of response is 5xx |
|
241 | + * |
|
242 | + * @return Elasticsearch|Promise |
|
243 | + */ |
|
244 | + public function create(array $params = []) |
|
245 | + { |
|
246 | + $this->checkRequiredParameters(['index'], $params); |
|
247 | + $url = '/' . $this->encode($params['index']); |
|
248 | + $method = 'PUT'; |
|
249 | + $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
250 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
251 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
252 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.create'); |
|
253 | + return $this->client->sendRequest($request); |
|
254 | + } |
|
255 | + /** |
|
256 | + * Creates a data stream |
|
257 | + * |
|
258 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html |
|
259 | + * |
|
260 | + * @param array{ |
|
261 | + * name: string, // (REQUIRED) The name of the data stream |
|
262 | + * timeout: time, // Specify timeout for acknowledging the cluster state update |
|
263 | + * master_timeout: time, // Specify timeout for connection to master |
|
264 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
265 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
266 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
267 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
268 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
269 | + * } $params |
|
270 | + * |
|
271 | + * @throws MissingParameterException if a required parameter is missing |
|
272 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
273 | + * @throws ClientResponseException if the status code of response is 4xx |
|
274 | + * @throws ServerResponseException if the status code of response is 5xx |
|
275 | + * |
|
276 | + * @return Elasticsearch|Promise |
|
277 | + */ |
|
278 | + public function createDataStream(array $params = []) |
|
279 | + { |
|
280 | + $this->checkRequiredParameters(['name'], $params); |
|
281 | + $url = '/_data_stream/' . $this->encode($params['name']); |
|
282 | + $method = 'PUT'; |
|
283 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
284 | + $headers = ['Accept' => 'application/json']; |
|
285 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
286 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.create_data_stream'); |
|
287 | + return $this->client->sendRequest($request); |
|
288 | + } |
|
289 | + /** |
|
290 | + * Provides statistics on operations happening in a data stream. |
|
291 | + * |
|
292 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html |
|
293 | + * |
|
294 | + * @param array{ |
|
295 | + * name: list, // A comma-separated list of data stream names; use `_all` or empty string to perform the operation on all data streams |
|
296 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
297 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
298 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
299 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
300 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
301 | + * } $params |
|
302 | + * |
|
303 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
304 | + * @throws ClientResponseException if the status code of response is 4xx |
|
305 | + * @throws ServerResponseException if the status code of response is 5xx |
|
306 | + * |
|
307 | + * @return Elasticsearch|Promise |
|
308 | + */ |
|
309 | + public function dataStreamsStats(array $params = []) |
|
310 | + { |
|
311 | + if (isset($params['name'])) { |
|
312 | + $url = '/_data_stream/' . $this->encode($params['name']) . '/_stats'; |
|
313 | + $method = 'GET'; |
|
314 | + } else { |
|
315 | + $url = '/_data_stream/_stats'; |
|
316 | + $method = 'GET'; |
|
317 | + } |
|
318 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
319 | + $headers = ['Accept' => 'application/json']; |
|
320 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
321 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.data_streams_stats'); |
|
322 | + return $this->client->sendRequest($request); |
|
323 | + } |
|
324 | + /** |
|
325 | + * Deletes an index. |
|
326 | + * |
|
327 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html |
|
328 | + * |
|
329 | + * @param array{ |
|
330 | + * index: list, // (REQUIRED) A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices |
|
331 | + * timeout: time, // Explicit operation timeout |
|
332 | + * master_timeout: time, // Specify timeout for connection to master |
|
333 | + * ignore_unavailable: boolean, // Ignore unavailable indexes (default: false) |
|
334 | + * allow_no_indices: boolean, // Ignore if a wildcard expression resolves to no concrete indices (default: false) |
|
335 | + * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open, closed, or hidden indices |
|
336 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
337 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
338 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
339 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
340 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
341 | + * } $params |
|
342 | + * |
|
343 | + * @throws MissingParameterException if a required parameter is missing |
|
344 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
345 | + * @throws ClientResponseException if the status code of response is 4xx |
|
346 | + * @throws ServerResponseException if the status code of response is 5xx |
|
347 | + * |
|
348 | + * @return Elasticsearch|Promise |
|
349 | + */ |
|
350 | + public function delete(array $params = []) |
|
351 | + { |
|
352 | + $this->checkRequiredParameters(['index'], $params); |
|
353 | + $url = '/' . $this->encode($params['index']); |
|
354 | + $method = 'DELETE'; |
|
355 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
356 | + $headers = ['Accept' => 'application/json']; |
|
357 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
358 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.delete'); |
|
359 | + return $this->client->sendRequest($request); |
|
360 | + } |
|
361 | + /** |
|
362 | + * Deletes an alias. |
|
363 | + * |
|
364 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html |
|
365 | + * |
|
366 | + * @param array{ |
|
367 | + * index: list, // (REQUIRED) A comma-separated list of index names (supports wildcards); use `_all` for all indices |
|
368 | + * name: list, // (REQUIRED) A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices. |
|
369 | + * timeout: time, // Explicit timestamp for the document |
|
370 | + * master_timeout: time, // Specify timeout for connection to master |
|
371 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
372 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
373 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
374 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
375 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
376 | + * } $params |
|
377 | + * |
|
378 | + * @throws MissingParameterException if a required parameter is missing |
|
379 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
380 | + * @throws ClientResponseException if the status code of response is 4xx |
|
381 | + * @throws ServerResponseException if the status code of response is 5xx |
|
382 | + * |
|
383 | + * @return Elasticsearch|Promise |
|
384 | + */ |
|
385 | + public function deleteAlias(array $params = []) |
|
386 | + { |
|
387 | + $this->checkRequiredParameters(['index', 'name'], $params); |
|
388 | + $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); |
|
389 | + $method = 'DELETE'; |
|
390 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
391 | + $headers = ['Accept' => 'application/json']; |
|
392 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
393 | + $request = $this->addOtelAttributes($params, ['index', 'name'], $request, 'indices.delete_alias'); |
|
394 | + return $this->client->sendRequest($request); |
|
395 | + } |
|
396 | + /** |
|
397 | + * Deletes the data stream lifecycle of the selected data streams. |
|
398 | + * |
|
399 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-delete-lifecycle.html |
|
400 | + * |
|
401 | + * @param array{ |
|
402 | + * name: list, // (REQUIRED) A comma-separated list of data streams of which the data stream lifecycle will be deleted; use `*` to get all data streams |
|
403 | + * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
404 | + * timeout: time, // Explicit timestamp for the document |
|
405 | + * master_timeout: time, // Specify timeout for connection to master |
|
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 deleteDataLifecycle(array $params = []) |
|
421 | + { |
|
422 | + $this->checkRequiredParameters(['name'], $params); |
|
423 | + $url = '/_data_stream/' . $this->encode($params['name']) . '/_lifecycle'; |
|
424 | + $method = 'DELETE'; |
|
425 | + $url = $this->addQueryString($url, $params, ['expand_wildcards', 'timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
426 | + $headers = ['Accept' => 'application/json']; |
|
427 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
428 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.delete_data_lifecycle'); |
|
429 | + return $this->client->sendRequest($request); |
|
430 | + } |
|
431 | + /** |
|
432 | + * Deletes a data stream. |
|
433 | + * |
|
434 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html |
|
435 | + * |
|
436 | + * @param array{ |
|
437 | + * name: list, // (REQUIRED) A comma-separated list of data streams to delete; use `*` to delete all data streams |
|
438 | + * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
439 | + * master_timeout: time, // Specify timeout for connection to master |
|
440 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
441 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
442 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
443 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
444 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
445 | + * } $params |
|
446 | + * |
|
447 | + * @throws MissingParameterException if a required parameter is missing |
|
448 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
449 | + * @throws ClientResponseException if the status code of response is 4xx |
|
450 | + * @throws ServerResponseException if the status code of response is 5xx |
|
451 | + * |
|
452 | + * @return Elasticsearch|Promise |
|
453 | + */ |
|
454 | + public function deleteDataStream(array $params = []) |
|
455 | + { |
|
456 | + $this->checkRequiredParameters(['name'], $params); |
|
457 | + $url = '/_data_stream/' . $this->encode($params['name']); |
|
458 | + $method = 'DELETE'; |
|
459 | + $url = $this->addQueryString($url, $params, ['expand_wildcards', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
460 | + $headers = ['Accept' => 'application/json']; |
|
461 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
462 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.delete_data_stream'); |
|
463 | + return $this->client->sendRequest($request); |
|
464 | + } |
|
465 | + /** |
|
466 | + * Deletes an index template. |
|
467 | + * |
|
468 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template.html |
|
469 | + * |
|
470 | + * @param array{ |
|
471 | + * name: string, // (REQUIRED) The name of the template |
|
472 | + * timeout: time, // Explicit operation timeout |
|
473 | + * master_timeout: time, // Specify timeout for connection to master |
|
474 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
475 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
476 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
477 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
478 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
479 | + * } $params |
|
480 | + * |
|
481 | + * @throws MissingParameterException if a required parameter is missing |
|
482 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
483 | + * @throws ClientResponseException if the status code of response is 4xx |
|
484 | + * @throws ServerResponseException if the status code of response is 5xx |
|
485 | + * |
|
486 | + * @return Elasticsearch|Promise |
|
487 | + */ |
|
488 | + public function deleteIndexTemplate(array $params = []) |
|
489 | + { |
|
490 | + $this->checkRequiredParameters(['name'], $params); |
|
491 | + $url = '/_index_template/' . $this->encode($params['name']); |
|
492 | + $method = 'DELETE'; |
|
493 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
494 | + $headers = ['Accept' => 'application/json']; |
|
495 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
496 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.delete_index_template'); |
|
497 | + return $this->client->sendRequest($request); |
|
498 | + } |
|
499 | + /** |
|
500 | + * Deletes an index template. |
|
501 | + * |
|
502 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template-v1.html |
|
503 | + * |
|
504 | + * @param array{ |
|
505 | + * name: string, // (REQUIRED) The name of the template |
|
506 | + * timeout: time, // Explicit operation timeout |
|
507 | + * master_timeout: time, // Specify timeout for connection to master |
|
508 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
509 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
510 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
511 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
512 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
513 | + * } $params |
|
514 | + * |
|
515 | + * @throws MissingParameterException if a required parameter is missing |
|
516 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
517 | + * @throws ClientResponseException if the status code of response is 4xx |
|
518 | + * @throws ServerResponseException if the status code of response is 5xx |
|
519 | + * |
|
520 | + * @return Elasticsearch|Promise |
|
521 | + */ |
|
522 | + public function deleteTemplate(array $params = []) |
|
523 | + { |
|
524 | + $this->checkRequiredParameters(['name'], $params); |
|
525 | + $url = '/_template/' . $this->encode($params['name']); |
|
526 | + $method = 'DELETE'; |
|
527 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
528 | + $headers = ['Accept' => 'application/json']; |
|
529 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
530 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.delete_template'); |
|
531 | + return $this->client->sendRequest($request); |
|
532 | + } |
|
533 | + /** |
|
534 | + * Analyzes the disk usage of each field of an index or data stream |
|
535 | + * |
|
536 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-disk-usage.html |
|
537 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
538 | + * |
|
539 | + * @param array{ |
|
540 | + * index: string, // (REQUIRED) Comma-separated list of indices or data streams to analyze the disk usage |
|
541 | + * run_expensive_tasks: boolean, // Must be set to [true] in order for the task to be performed. Defaults to false. |
|
542 | + * flush: boolean, // Whether flush or not before analyzing the index disk usage. Defaults to true |
|
543 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
544 | + * 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) |
|
545 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
546 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
547 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
548 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
549 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
550 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
551 | + * } $params |
|
552 | + * |
|
553 | + * @throws MissingParameterException if a required parameter is missing |
|
554 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
555 | + * @throws ClientResponseException if the status code of response is 4xx |
|
556 | + * @throws ServerResponseException if the status code of response is 5xx |
|
557 | + * |
|
558 | + * @return Elasticsearch|Promise |
|
559 | + */ |
|
560 | + public function diskUsage(array $params = []) |
|
561 | + { |
|
562 | + $this->checkRequiredParameters(['index'], $params); |
|
563 | + $url = '/' . $this->encode($params['index']) . '/_disk_usage'; |
|
564 | + $method = 'POST'; |
|
565 | + $url = $this->addQueryString($url, $params, ['run_expensive_tasks', 'flush', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
566 | + $headers = ['Accept' => 'application/json']; |
|
567 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
568 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.disk_usage'); |
|
569 | + return $this->client->sendRequest($request); |
|
570 | + } |
|
571 | + /** |
|
572 | + * Downsample an index |
|
573 | + * |
|
574 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-rollup.html |
|
575 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
576 | + * |
|
577 | + * @param array{ |
|
578 | + * index: string, // (REQUIRED) The index to downsample |
|
579 | + * target_index: string, // (REQUIRED) The name of the target index to store downsampled data |
|
580 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
581 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
582 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
583 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
584 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
585 | + * body: array, // (REQUIRED) The downsampling configuration |
|
586 | + * } $params |
|
587 | + * |
|
588 | + * @throws MissingParameterException if a required parameter is missing |
|
589 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
590 | + * @throws ClientResponseException if the status code of response is 4xx |
|
591 | + * @throws ServerResponseException if the status code of response is 5xx |
|
592 | + * |
|
593 | + * @return Elasticsearch|Promise |
|
594 | + */ |
|
595 | + public function downsample(array $params = []) |
|
596 | + { |
|
597 | + $this->checkRequiredParameters(['index', 'target_index', 'body'], $params); |
|
598 | + $url = '/' . $this->encode($params['index']) . '/_downsample/' . $this->encode($params['target_index']); |
|
599 | + $method = 'POST'; |
|
600 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
601 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
602 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
603 | + $request = $this->addOtelAttributes($params, ['index', 'target_index'], $request, 'indices.downsample'); |
|
604 | + return $this->client->sendRequest($request); |
|
605 | + } |
|
606 | + /** |
|
607 | + * Returns information about whether a particular index exists. |
|
608 | + * |
|
609 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html |
|
610 | + * |
|
611 | + * @param array{ |
|
612 | + * index: list, // (REQUIRED) A comma-separated list of index names |
|
613 | + * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
614 | + * ignore_unavailable: boolean, // Ignore unavailable indexes (default: false) |
|
615 | + * allow_no_indices: boolean, // Ignore if a wildcard expression resolves to no concrete indices (default: false) |
|
616 | + * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
617 | + * flat_settings: boolean, // Return settings in flat format (default: false) |
|
618 | + * include_defaults: boolean, // Whether to return all default setting for each of the indices. |
|
619 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
620 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
621 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
622 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
623 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
624 | + * } $params |
|
625 | + * |
|
626 | + * @throws MissingParameterException if a required parameter is missing |
|
627 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
628 | + * @throws ClientResponseException if the status code of response is 4xx |
|
629 | + * @throws ServerResponseException if the status code of response is 5xx |
|
630 | + * |
|
631 | + * @return Elasticsearch|Promise |
|
632 | + */ |
|
633 | + public function exists(array $params = []) |
|
634 | + { |
|
635 | + $this->checkRequiredParameters(['index'], $params); |
|
636 | + $url = '/' . $this->encode($params['index']); |
|
637 | + $method = 'HEAD'; |
|
638 | + $url = $this->addQueryString($url, $params, ['local', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'flat_settings', 'include_defaults', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
639 | + $headers = ['Accept' => 'application/json']; |
|
640 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
641 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.exists'); |
|
642 | + return $this->client->sendRequest($request); |
|
643 | + } |
|
644 | + /** |
|
645 | + * Returns information about whether a particular alias exists. |
|
646 | + * |
|
647 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html |
|
648 | + * |
|
649 | + * @param array{ |
|
650 | + * name: list, // (REQUIRED) A comma-separated list of alias names to return |
|
651 | + * index: list, // A comma-separated list of index names to filter aliases |
|
652 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
653 | + * 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) |
|
654 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
655 | + * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
656 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
657 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
658 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
659 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
660 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
661 | + * } $params |
|
662 | + * |
|
663 | + * @throws MissingParameterException if a required parameter is missing |
|
664 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
665 | + * @throws ClientResponseException if the status code of response is 4xx |
|
666 | + * @throws ServerResponseException if the status code of response is 5xx |
|
667 | + * |
|
668 | + * @return Elasticsearch|Promise |
|
669 | + */ |
|
670 | + public function existsAlias(array $params = []) |
|
671 | + { |
|
672 | + $this->checkRequiredParameters(['name'], $params); |
|
673 | + if (isset($params['index'])) { |
|
674 | + $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); |
|
675 | + $method = 'HEAD'; |
|
676 | + } else { |
|
677 | + $url = '/_alias/' . $this->encode($params['name']); |
|
678 | + $method = 'HEAD'; |
|
679 | + } |
|
680 | + $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
681 | + $headers = ['Accept' => 'application/json']; |
|
682 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
683 | + $request = $this->addOtelAttributes($params, ['name', 'index'], $request, 'indices.exists_alias'); |
|
684 | + return $this->client->sendRequest($request); |
|
685 | + } |
|
686 | + /** |
|
687 | + * Returns information about whether a particular index template exists. |
|
688 | + * |
|
689 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/index-templates.html |
|
690 | + * |
|
691 | + * @param array{ |
|
692 | + * name: string, // (REQUIRED) The name of the template |
|
693 | + * flat_settings: boolean, // Return settings in flat format (default: false) |
|
694 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
695 | + * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
696 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
697 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
698 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
699 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
700 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
701 | + * } $params |
|
702 | + * |
|
703 | + * @throws MissingParameterException if a required parameter is missing |
|
704 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
705 | + * @throws ClientResponseException if the status code of response is 4xx |
|
706 | + * @throws ServerResponseException if the status code of response is 5xx |
|
707 | + * |
|
708 | + * @return Elasticsearch|Promise |
|
709 | + */ |
|
710 | + public function existsIndexTemplate(array $params = []) |
|
711 | + { |
|
712 | + $this->checkRequiredParameters(['name'], $params); |
|
713 | + $url = '/_index_template/' . $this->encode($params['name']); |
|
714 | + $method = 'HEAD'; |
|
715 | + $url = $this->addQueryString($url, $params, ['flat_settings', 'master_timeout', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
716 | + $headers = ['Accept' => 'application/json']; |
|
717 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
718 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.exists_index_template'); |
|
719 | + return $this->client->sendRequest($request); |
|
720 | + } |
|
721 | + /** |
|
722 | + * Returns information about whether a particular index template exists. |
|
723 | + * |
|
724 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-template-exists-v1.html |
|
725 | + * |
|
726 | + * @param array{ |
|
727 | + * name: list, // (REQUIRED) The comma separated names of the index templates |
|
728 | + * flat_settings: boolean, // Return settings in flat format (default: false) |
|
729 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
730 | + * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
731 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
732 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
733 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
734 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
735 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
736 | + * } $params |
|
737 | + * |
|
738 | + * @throws MissingParameterException if a required parameter is missing |
|
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 existsTemplate(array $params = []) |
|
746 | + { |
|
747 | + $this->checkRequiredParameters(['name'], $params); |
|
748 | + $url = '/_template/' . $this->encode($params['name']); |
|
749 | + $method = 'HEAD'; |
|
750 | + $url = $this->addQueryString($url, $params, ['flat_settings', 'master_timeout', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
751 | + $headers = ['Accept' => 'application/json']; |
|
752 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
753 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.exists_template'); |
|
754 | + return $this->client->sendRequest($request); |
|
755 | + } |
|
756 | + /** |
|
757 | + * Retrieves information about the index's current data stream lifecycle, such as any potential encountered error, time since creation etc. |
|
758 | + * |
|
759 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams-explain-lifecycle.html |
|
760 | + * |
|
761 | + * @param array{ |
|
762 | + * index: string, // (REQUIRED) The name of the index to explain |
|
763 | + * include_defaults: boolean, // indicates if the API should return the default values the system uses for the index's lifecycle |
|
764 | + * master_timeout: time, // Specify timeout for connection to master |
|
765 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
766 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
767 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
768 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
769 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
770 | + * } $params |
|
771 | + * |
|
772 | + * @throws MissingParameterException if a required parameter is missing |
|
773 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
774 | + * @throws ClientResponseException if the status code of response is 4xx |
|
775 | + * @throws ServerResponseException if the status code of response is 5xx |
|
776 | + * |
|
777 | + * @return Elasticsearch|Promise |
|
778 | + */ |
|
779 | + public function explainDataLifecycle(array $params = []) |
|
780 | + { |
|
781 | + $this->checkRequiredParameters(['index'], $params); |
|
782 | + $url = '/' . $this->encode($params['index']) . '/_lifecycle/explain'; |
|
783 | + $method = 'GET'; |
|
784 | + $url = $this->addQueryString($url, $params, ['include_defaults', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
785 | + $headers = ['Accept' => 'application/json']; |
|
786 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
787 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.explain_data_lifecycle'); |
|
788 | + return $this->client->sendRequest($request); |
|
789 | + } |
|
790 | + /** |
|
791 | + * Returns the field usage stats for each field of an index |
|
792 | + * |
|
793 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/field-usage-stats.html |
|
794 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
795 | + * |
|
796 | + * @param array{ |
|
797 | + * index: string, // (REQUIRED) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
798 | + * fields: list, // A comma-separated list of fields to include in the stats if only a subset of fields should be returned (supports wildcards) |
|
799 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
800 | + * 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) |
|
801 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
802 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
803 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
804 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
805 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
806 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
807 | + * } $params |
|
808 | + * |
|
809 | + * @throws MissingParameterException if a required parameter is missing |
|
810 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
811 | + * @throws ClientResponseException if the status code of response is 4xx |
|
812 | + * @throws ServerResponseException if the status code of response is 5xx |
|
813 | + * |
|
814 | + * @return Elasticsearch|Promise |
|
815 | + */ |
|
816 | + public function fieldUsageStats(array $params = []) |
|
817 | + { |
|
818 | + $this->checkRequiredParameters(['index'], $params); |
|
819 | + $url = '/' . $this->encode($params['index']) . '/_field_usage_stats'; |
|
820 | + $method = 'GET'; |
|
821 | + $url = $this->addQueryString($url, $params, ['fields', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
822 | + $headers = ['Accept' => 'application/json']; |
|
823 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
824 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.field_usage_stats'); |
|
825 | + return $this->client->sendRequest($request); |
|
826 | + } |
|
827 | + /** |
|
828 | + * Performs the flush operation on one or more indices. |
|
829 | + * |
|
830 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html |
|
831 | + * |
|
832 | + * @param array{ |
|
833 | + * index: list, // A comma-separated list of index names; use `_all` or empty string for all indices |
|
834 | + * force: boolean, // Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal) |
|
835 | + * wait_if_ongoing: boolean, // If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. The default is true. If set to false the flush will be skipped iff if another flush operation is already running. |
|
836 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
837 | + * 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) |
|
838 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
839 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
840 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
841 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
842 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
843 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
844 | + * } $params |
|
845 | + * |
|
846 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
847 | + * @throws ClientResponseException if the status code of response is 4xx |
|
848 | + * @throws ServerResponseException if the status code of response is 5xx |
|
849 | + * |
|
850 | + * @return Elasticsearch|Promise |
|
851 | + */ |
|
852 | + public function flush(array $params = []) |
|
853 | + { |
|
854 | + if (isset($params['index'])) { |
|
855 | + $url = '/' . $this->encode($params['index']) . '/_flush'; |
|
856 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
857 | + } else { |
|
858 | + $url = '/_flush'; |
|
859 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
860 | + } |
|
861 | + $url = $this->addQueryString($url, $params, ['force', 'wait_if_ongoing', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
862 | + $headers = ['Accept' => 'application/json']; |
|
863 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
864 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.flush'); |
|
865 | + return $this->client->sendRequest($request); |
|
866 | + } |
|
867 | + /** |
|
868 | + * Performs the force merge operation on one or more indices. |
|
869 | + * |
|
870 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html |
|
871 | + * |
|
872 | + * @param array{ |
|
873 | + * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
874 | + * flush: boolean, // Specify whether the index should be flushed after performing the operation (default: true) |
|
875 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
876 | + * 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) |
|
877 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
878 | + * max_num_segments: number, // The number of segments the index should be merged into (default: dynamic) |
|
879 | + * only_expunge_deletes: boolean, // Specify whether the operation should only expunge deleted documents |
|
880 | + * wait_for_completion: boolean, // Should the request wait until the force merge is completed. |
|
881 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
882 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
883 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
884 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
885 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
886 | + * } $params |
|
887 | + * |
|
888 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
889 | + * @throws ClientResponseException if the status code of response is 4xx |
|
890 | + * @throws ServerResponseException if the status code of response is 5xx |
|
891 | + * |
|
892 | + * @return Elasticsearch|Promise |
|
893 | + */ |
|
894 | + public function forcemerge(array $params = []) |
|
895 | + { |
|
896 | + if (isset($params['index'])) { |
|
897 | + $url = '/' . $this->encode($params['index']) . '/_forcemerge'; |
|
898 | + $method = 'POST'; |
|
899 | + } else { |
|
900 | + $url = '/_forcemerge'; |
|
901 | + $method = 'POST'; |
|
902 | + } |
|
903 | + $url = $this->addQueryString($url, $params, ['flush', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'max_num_segments', 'only_expunge_deletes', 'wait_for_completion', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
904 | + $headers = ['Accept' => 'application/json']; |
|
905 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
906 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.forcemerge'); |
|
907 | + return $this->client->sendRequest($request); |
|
908 | + } |
|
909 | + /** |
|
910 | + * Returns information about one or more indices. |
|
911 | + * |
|
912 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html |
|
913 | + * |
|
914 | + * @param array{ |
|
915 | + * index: list, // (REQUIRED) A comma-separated list of index names |
|
916 | + * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
917 | + * ignore_unavailable: boolean, // Ignore unavailable indexes (default: false) |
|
918 | + * allow_no_indices: boolean, // Ignore if a wildcard expression resolves to no concrete indices (default: false) |
|
919 | + * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
920 | + * features: enum, // Return only information on specified index features |
|
921 | + * flat_settings: boolean, // Return settings in flat format (default: false) |
|
922 | + * include_defaults: boolean, // Whether to return all default setting for each of the indices. |
|
923 | + * master_timeout: time, // Specify timeout for connection to master |
|
924 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
925 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
926 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
927 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
928 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
929 | + * } $params |
|
930 | + * |
|
931 | + * @throws MissingParameterException if a required parameter is missing |
|
932 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
933 | + * @throws ClientResponseException if the status code of response is 4xx |
|
934 | + * @throws ServerResponseException if the status code of response is 5xx |
|
935 | + * |
|
936 | + * @return Elasticsearch|Promise |
|
937 | + */ |
|
938 | + public function get(array $params = []) |
|
939 | + { |
|
940 | + $this->checkRequiredParameters(['index'], $params); |
|
941 | + $url = '/' . $this->encode($params['index']); |
|
942 | + $method = 'GET'; |
|
943 | + $url = $this->addQueryString($url, $params, ['local', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'features', 'flat_settings', 'include_defaults', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
944 | + $headers = ['Accept' => 'application/json']; |
|
945 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
946 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.get'); |
|
947 | + return $this->client->sendRequest($request); |
|
948 | + } |
|
949 | + /** |
|
950 | + * Returns an alias. |
|
951 | + * |
|
952 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html |
|
953 | + * |
|
954 | + * @param array{ |
|
955 | + * name: list, // A comma-separated list of alias names to return |
|
956 | + * index: list, // A comma-separated list of index names to filter aliases |
|
957 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
958 | + * 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) |
|
959 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
960 | + * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
961 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
962 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
963 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
964 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
965 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
966 | + * } $params |
|
967 | + * |
|
968 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
969 | + * @throws ClientResponseException if the status code of response is 4xx |
|
970 | + * @throws ServerResponseException if the status code of response is 5xx |
|
971 | + * |
|
972 | + * @return Elasticsearch|Promise |
|
973 | + */ |
|
974 | + public function getAlias(array $params = []) |
|
975 | + { |
|
976 | + if (isset($params['index']) && isset($params['name'])) { |
|
977 | + $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); |
|
978 | + $method = 'GET'; |
|
979 | + } elseif (isset($params['name'])) { |
|
980 | + $url = '/_alias/' . $this->encode($params['name']); |
|
981 | + $method = 'GET'; |
|
982 | + } elseif (isset($params['index'])) { |
|
983 | + $url = '/' . $this->encode($params['index']) . '/_alias'; |
|
984 | + $method = 'GET'; |
|
985 | + } else { |
|
986 | + $url = '/_alias'; |
|
987 | + $method = 'GET'; |
|
988 | + } |
|
989 | + $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
990 | + $headers = ['Accept' => 'application/json']; |
|
991 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
992 | + $request = $this->addOtelAttributes($params, ['name', 'index'], $request, 'indices.get_alias'); |
|
993 | + return $this->client->sendRequest($request); |
|
994 | + } |
|
995 | + /** |
|
996 | + * Returns the data stream lifecycle of the selected data streams. |
|
997 | + * |
|
998 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-get-lifecycle.html |
|
999 | + * |
|
1000 | + * @param array{ |
|
1001 | + * name: list, // (REQUIRED) A comma-separated list of data streams to get; use `*` to get all data streams |
|
1002 | + * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
1003 | + * include_defaults: boolean, // Return all relevant default configurations for the data stream (default: false) |
|
1004 | + * master_timeout: time, // Specify timeout for connection to master |
|
1005 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1006 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1007 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1008 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1009 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1010 | + * } $params |
|
1011 | + * |
|
1012 | + * @throws MissingParameterException if a required parameter is missing |
|
1013 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1014 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1015 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1016 | + * |
|
1017 | + * @return Elasticsearch|Promise |
|
1018 | + */ |
|
1019 | + public function getDataLifecycle(array $params = []) |
|
1020 | + { |
|
1021 | + $this->checkRequiredParameters(['name'], $params); |
|
1022 | + $url = '/_data_stream/' . $this->encode($params['name']) . '/_lifecycle'; |
|
1023 | + $method = 'GET'; |
|
1024 | + $url = $this->addQueryString($url, $params, ['expand_wildcards', 'include_defaults', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1025 | + $headers = ['Accept' => 'application/json']; |
|
1026 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1027 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.get_data_lifecycle'); |
|
1028 | + return $this->client->sendRequest($request); |
|
1029 | + } |
|
1030 | + /** |
|
1031 | + * Returns data streams. |
|
1032 | + * |
|
1033 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html |
|
1034 | + * |
|
1035 | + * @param array{ |
|
1036 | + * name: list, // A comma-separated list of data streams to get; use `*` to get all data streams |
|
1037 | + * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
1038 | + * include_defaults: boolean, // Return all relevant default configurations for the data stream (default: false) |
|
1039 | + * master_timeout: time, // Specify timeout for connection to master |
|
1040 | + * verbose: boolean, // Whether the maximum timestamp for each data stream should be calculated and returned (default: false) |
|
1041 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1042 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1043 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1044 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1045 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1046 | + * } $params |
|
1047 | + * |
|
1048 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1049 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1050 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1051 | + * |
|
1052 | + * @return Elasticsearch|Promise |
|
1053 | + */ |
|
1054 | + public function getDataStream(array $params = []) |
|
1055 | + { |
|
1056 | + if (isset($params['name'])) { |
|
1057 | + $url = '/_data_stream/' . $this->encode($params['name']); |
|
1058 | + $method = 'GET'; |
|
1059 | + } else { |
|
1060 | + $url = '/_data_stream'; |
|
1061 | + $method = 'GET'; |
|
1062 | + } |
|
1063 | + $url = $this->addQueryString($url, $params, ['expand_wildcards', 'include_defaults', 'master_timeout', 'verbose', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1064 | + $headers = ['Accept' => 'application/json']; |
|
1065 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1066 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.get_data_stream'); |
|
1067 | + return $this->client->sendRequest($request); |
|
1068 | + } |
|
1069 | + /** |
|
1070 | + * Returns mapping for one or more fields. |
|
1071 | + * |
|
1072 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html |
|
1073 | + * |
|
1074 | + * @param array{ |
|
1075 | + * fields: list, // (REQUIRED) A comma-separated list of fields |
|
1076 | + * index: list, // A comma-separated list of index names |
|
1077 | + * include_defaults: boolean, // Whether the default mapping values should be returned as well |
|
1078 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1079 | + * 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) |
|
1080 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1081 | + * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
1082 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1083 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1084 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1085 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1086 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1087 | + * } $params |
|
1088 | + * |
|
1089 | + * @throws MissingParameterException if a required parameter is missing |
|
1090 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1091 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1092 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1093 | + * |
|
1094 | + * @return Elasticsearch|Promise |
|
1095 | + */ |
|
1096 | + public function getFieldMapping(array $params = []) |
|
1097 | + { |
|
1098 | + $this->checkRequiredParameters(['fields'], $params); |
|
1099 | + if (isset($params['index'])) { |
|
1100 | + $url = '/' . $this->encode($params['index']) . '/_mapping/field/' . $this->encode($params['fields']); |
|
1101 | + $method = 'GET'; |
|
1102 | + } else { |
|
1103 | + $url = '/_mapping/field/' . $this->encode($params['fields']); |
|
1104 | + $method = 'GET'; |
|
1105 | + } |
|
1106 | + $url = $this->addQueryString($url, $params, ['include_defaults', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1107 | + $headers = ['Accept' => 'application/json']; |
|
1108 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1109 | + $request = $this->addOtelAttributes($params, ['fields', 'index'], $request, 'indices.get_field_mapping'); |
|
1110 | + return $this->client->sendRequest($request); |
|
1111 | + } |
|
1112 | + /** |
|
1113 | + * Returns an index template. |
|
1114 | + * |
|
1115 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template.html |
|
1116 | + * |
|
1117 | + * @param array{ |
|
1118 | + * name: string, // A pattern that returned template names must match |
|
1119 | + * flat_settings: boolean, // Return settings in flat format (default: false) |
|
1120 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
1121 | + * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
1122 | + * include_defaults: boolean, // Return all relevant default configurations for the index template (default: false) |
|
1123 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1124 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1125 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1126 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1127 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1128 | + * } $params |
|
1129 | + * |
|
1130 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1131 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1132 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1133 | + * |
|
1134 | + * @return Elasticsearch|Promise |
|
1135 | + */ |
|
1136 | + public function getIndexTemplate(array $params = []) |
|
1137 | + { |
|
1138 | + if (isset($params['name'])) { |
|
1139 | + $url = '/_index_template/' . $this->encode($params['name']); |
|
1140 | + $method = 'GET'; |
|
1141 | + } else { |
|
1142 | + $url = '/_index_template'; |
|
1143 | + $method = 'GET'; |
|
1144 | + } |
|
1145 | + $url = $this->addQueryString($url, $params, ['flat_settings', 'master_timeout', 'local', 'include_defaults', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1146 | + $headers = ['Accept' => 'application/json']; |
|
1147 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1148 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.get_index_template'); |
|
1149 | + return $this->client->sendRequest($request); |
|
1150 | + } |
|
1151 | + /** |
|
1152 | + * Returns mappings for one or more indices. |
|
1153 | + * |
|
1154 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html |
|
1155 | + * |
|
1156 | + * @param array{ |
|
1157 | + * index: list, // A comma-separated list of index names |
|
1158 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1159 | + * 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) |
|
1160 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1161 | + * master_timeout: time, // Specify timeout for connection to master |
|
1162 | + * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
1163 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1164 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1165 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1166 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1167 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1168 | + * } $params |
|
1169 | + * |
|
1170 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1171 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1172 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1173 | + * |
|
1174 | + * @return Elasticsearch|Promise |
|
1175 | + */ |
|
1176 | + public function getMapping(array $params = []) |
|
1177 | + { |
|
1178 | + if (isset($params['index'])) { |
|
1179 | + $url = '/' . $this->encode($params['index']) . '/_mapping'; |
|
1180 | + $method = 'GET'; |
|
1181 | + } else { |
|
1182 | + $url = '/_mapping'; |
|
1183 | + $method = 'GET'; |
|
1184 | + } |
|
1185 | + $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'master_timeout', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1186 | + $headers = ['Accept' => 'application/json']; |
|
1187 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1188 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.get_mapping'); |
|
1189 | + return $this->client->sendRequest($request); |
|
1190 | + } |
|
1191 | + /** |
|
1192 | + * Returns settings for one or more indices. |
|
1193 | + * |
|
1194 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html |
|
1195 | + * |
|
1196 | + * @param array{ |
|
1197 | + * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
1198 | + * name: list, // The name of the settings that should be included |
|
1199 | + * master_timeout: time, // Specify timeout for connection to master |
|
1200 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1201 | + * 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) |
|
1202 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1203 | + * flat_settings: boolean, // Return settings in flat format (default: false) |
|
1204 | + * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
1205 | + * include_defaults: boolean, // Whether to return all default setting for each of the indices. |
|
1206 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1207 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1208 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1209 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1210 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1211 | + * } $params |
|
1212 | + * |
|
1213 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1214 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1215 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1216 | + * |
|
1217 | + * @return Elasticsearch|Promise |
|
1218 | + */ |
|
1219 | + public function getSettings(array $params = []) |
|
1220 | + { |
|
1221 | + if (isset($params['index']) && isset($params['name'])) { |
|
1222 | + $url = '/' . $this->encode($params['index']) . '/_settings/' . $this->encode($params['name']); |
|
1223 | + $method = 'GET'; |
|
1224 | + } elseif (isset($params['index'])) { |
|
1225 | + $url = '/' . $this->encode($params['index']) . '/_settings'; |
|
1226 | + $method = 'GET'; |
|
1227 | + } elseif (isset($params['name'])) { |
|
1228 | + $url = '/_settings/' . $this->encode($params['name']); |
|
1229 | + $method = 'GET'; |
|
1230 | + } else { |
|
1231 | + $url = '/_settings'; |
|
1232 | + $method = 'GET'; |
|
1233 | + } |
|
1234 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'flat_settings', 'local', 'include_defaults', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1235 | + $headers = ['Accept' => 'application/json']; |
|
1236 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1237 | + $request = $this->addOtelAttributes($params, ['index', 'name'], $request, 'indices.get_settings'); |
|
1238 | + return $this->client->sendRequest($request); |
|
1239 | + } |
|
1240 | + /** |
|
1241 | + * Returns an index template. |
|
1242 | + * |
|
1243 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template-v1.html |
|
1244 | + * |
|
1245 | + * @param array{ |
|
1246 | + * name: list, // The comma separated names of the index templates |
|
1247 | + * flat_settings: boolean, // Return settings in flat format (default: false) |
|
1248 | + * master_timeout: time, // Explicit operation timeout for connection to master node |
|
1249 | + * local: boolean, // Return local information, do not retrieve the state from master node (default: false) |
|
1250 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1251 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1252 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1253 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1254 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1255 | + * } $params |
|
1256 | + * |
|
1257 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1258 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1259 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1260 | + * |
|
1261 | + * @return Elasticsearch|Promise |
|
1262 | + */ |
|
1263 | + public function getTemplate(array $params = []) |
|
1264 | + { |
|
1265 | + if (isset($params['name'])) { |
|
1266 | + $url = '/_template/' . $this->encode($params['name']); |
|
1267 | + $method = 'GET'; |
|
1268 | + } else { |
|
1269 | + $url = '/_template'; |
|
1270 | + $method = 'GET'; |
|
1271 | + } |
|
1272 | + $url = $this->addQueryString($url, $params, ['flat_settings', 'master_timeout', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1273 | + $headers = ['Accept' => 'application/json']; |
|
1274 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1275 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.get_template'); |
|
1276 | + return $this->client->sendRequest($request); |
|
1277 | + } |
|
1278 | + /** |
|
1279 | + * Migrates an alias to a data stream |
|
1280 | + * |
|
1281 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html |
|
1282 | + * |
|
1283 | + * @param array{ |
|
1284 | + * name: string, // (REQUIRED) The name of the alias to migrate |
|
1285 | + * timeout: time, // Specify timeout for acknowledging the cluster state update |
|
1286 | + * master_timeout: time, // Specify timeout for connection to master |
|
1287 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1288 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1289 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1290 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1291 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1292 | + * } $params |
|
1293 | + * |
|
1294 | + * @throws MissingParameterException if a required parameter is missing |
|
1295 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1296 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1297 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1298 | + * |
|
1299 | + * @return Elasticsearch|Promise |
|
1300 | + */ |
|
1301 | + public function migrateToDataStream(array $params = []) |
|
1302 | + { |
|
1303 | + $this->checkRequiredParameters(['name'], $params); |
|
1304 | + $url = '/_data_stream/_migrate/' . $this->encode($params['name']); |
|
1305 | + $method = 'POST'; |
|
1306 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1307 | + $headers = ['Accept' => 'application/json']; |
|
1308 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1309 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.migrate_to_data_stream'); |
|
1310 | + return $this->client->sendRequest($request); |
|
1311 | + } |
|
1312 | + /** |
|
1313 | + * Modifies a data stream |
|
1314 | + * |
|
1315 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html |
|
1316 | + * |
|
1317 | + * @param array{ |
|
1318 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1319 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1320 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1321 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1322 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1323 | + * body: array, // (REQUIRED) The data stream modifications |
|
1324 | + * } $params |
|
1325 | + * |
|
1326 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1327 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1328 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1329 | + * |
|
1330 | + * @return Elasticsearch|Promise |
|
1331 | + */ |
|
1332 | + public function modifyDataStream(array $params = []) |
|
1333 | + { |
|
1334 | + $this->checkRequiredParameters(['body'], $params); |
|
1335 | + $url = '/_data_stream/_modify'; |
|
1336 | + $method = 'POST'; |
|
1337 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1338 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1339 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1340 | + $request = $this->addOtelAttributes($params, [], $request, 'indices.modify_data_stream'); |
|
1341 | + return $this->client->sendRequest($request); |
|
1342 | + } |
|
1343 | + /** |
|
1344 | + * Opens an index. |
|
1345 | + * |
|
1346 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html |
|
1347 | + * |
|
1348 | + * @param array{ |
|
1349 | + * index: list, // (REQUIRED) A comma separated list of indices to open |
|
1350 | + * timeout: time, // Explicit operation timeout |
|
1351 | + * master_timeout: time, // Specify timeout for connection to master |
|
1352 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1353 | + * 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) |
|
1354 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1355 | + * wait_for_active_shards: string, // Sets the number of active shards to wait for before the operation returns. |
|
1356 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1357 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1358 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1359 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1360 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1361 | + * } $params |
|
1362 | + * |
|
1363 | + * @throws MissingParameterException if a required parameter is missing |
|
1364 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1365 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1366 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1367 | + * |
|
1368 | + * @return Elasticsearch|Promise |
|
1369 | + */ |
|
1370 | + public function open(array $params = []) |
|
1371 | + { |
|
1372 | + $this->checkRequiredParameters(['index'], $params); |
|
1373 | + $url = '/' . $this->encode($params['index']) . '/_open'; |
|
1374 | + $method = 'POST'; |
|
1375 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1376 | + $headers = ['Accept' => 'application/json']; |
|
1377 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1378 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.open'); |
|
1379 | + return $this->client->sendRequest($request); |
|
1380 | + } |
|
1381 | + /** |
|
1382 | + * Promotes a data stream from a replicated data stream managed by CCR to a regular data stream |
|
1383 | + * |
|
1384 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html |
|
1385 | + * |
|
1386 | + * @param array{ |
|
1387 | + * name: string, // (REQUIRED) The name of the data stream |
|
1388 | + * master_timeout: time, // Specify timeout for connection to master |
|
1389 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1390 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1391 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1392 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1393 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1394 | + * } $params |
|
1395 | + * |
|
1396 | + * @throws MissingParameterException if a required parameter is missing |
|
1397 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1398 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1399 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1400 | + * |
|
1401 | + * @return Elasticsearch|Promise |
|
1402 | + */ |
|
1403 | + public function promoteDataStream(array $params = []) |
|
1404 | + { |
|
1405 | + $this->checkRequiredParameters(['name'], $params); |
|
1406 | + $url = '/_data_stream/_promote/' . $this->encode($params['name']); |
|
1407 | + $method = 'POST'; |
|
1408 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1409 | + $headers = ['Accept' => 'application/json']; |
|
1410 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1411 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.promote_data_stream'); |
|
1412 | + return $this->client->sendRequest($request); |
|
1413 | + } |
|
1414 | + /** |
|
1415 | + * Creates or updates an alias. |
|
1416 | + * |
|
1417 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html |
|
1418 | + * |
|
1419 | + * @param array{ |
|
1420 | + * index: list, // (REQUIRED) A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices. |
|
1421 | + * name: string, // (REQUIRED) The name of the alias to be created or updated |
|
1422 | + * timeout: time, // Explicit timestamp for the document |
|
1423 | + * master_timeout: time, // Specify timeout for connection to master |
|
1424 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1425 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1426 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1427 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1428 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1429 | + * body: array, // The settings for the alias, such as `routing` or `filter` |
|
1430 | + * } $params |
|
1431 | + * |
|
1432 | + * @throws MissingParameterException if a required parameter is missing |
|
1433 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1434 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1435 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1436 | + * |
|
1437 | + * @return Elasticsearch|Promise |
|
1438 | + */ |
|
1439 | + public function putAlias(array $params = []) |
|
1440 | + { |
|
1441 | + $this->checkRequiredParameters(['index', 'name'], $params); |
|
1442 | + $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); |
|
1443 | + $method = 'PUT'; |
|
1444 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1445 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1446 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1447 | + $request = $this->addOtelAttributes($params, ['index', 'name'], $request, 'indices.put_alias'); |
|
1448 | + return $this->client->sendRequest($request); |
|
1449 | + } |
|
1450 | + /** |
|
1451 | + * Updates the data stream lifecycle of the selected data streams. |
|
1452 | + * |
|
1453 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-put-lifecycle.html |
|
1454 | + * |
|
1455 | + * @param array{ |
|
1456 | + * name: list, // (REQUIRED) A comma-separated list of data streams whose lifecycle will be updated; use `*` to set the lifecycle to all data streams |
|
1457 | + * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
1458 | + * timeout: time, // Explicit timestamp for the document |
|
1459 | + * master_timeout: time, // Specify timeout for connection to master |
|
1460 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1461 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1462 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1463 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1464 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1465 | + * body: array, // The data stream lifecycle configuration that consist of the data retention |
|
1466 | + * } $params |
|
1467 | + * |
|
1468 | + * @throws MissingParameterException if a required parameter is missing |
|
1469 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1470 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1471 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1472 | + * |
|
1473 | + * @return Elasticsearch|Promise |
|
1474 | + */ |
|
1475 | + public function putDataLifecycle(array $params = []) |
|
1476 | + { |
|
1477 | + $this->checkRequiredParameters(['name'], $params); |
|
1478 | + $url = '/_data_stream/' . $this->encode($params['name']) . '/_lifecycle'; |
|
1479 | + $method = 'PUT'; |
|
1480 | + $url = $this->addQueryString($url, $params, ['expand_wildcards', 'timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1481 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1482 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1483 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.put_data_lifecycle'); |
|
1484 | + return $this->client->sendRequest($request); |
|
1485 | + } |
|
1486 | + /** |
|
1487 | + * Creates or updates an index template. |
|
1488 | + * |
|
1489 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-template.html |
|
1490 | + * |
|
1491 | + * @param array{ |
|
1492 | + * name: string, // (REQUIRED) The name of the template |
|
1493 | + * create: boolean, // Whether the index template should only be added if new or can also replace an existing one |
|
1494 | + * cause: string, // User defined reason for creating/updating the index template |
|
1495 | + * master_timeout: time, // Specify timeout for connection to master |
|
1496 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1497 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1498 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1499 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1500 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1501 | + * body: array, // (REQUIRED) The template definition |
|
1502 | + * } $params |
|
1503 | + * |
|
1504 | + * @throws MissingParameterException if a required parameter is missing |
|
1505 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1506 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1507 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1508 | + * |
|
1509 | + * @return Elasticsearch|Promise |
|
1510 | + */ |
|
1511 | + public function putIndexTemplate(array $params = []) |
|
1512 | + { |
|
1513 | + $this->checkRequiredParameters(['name', 'body'], $params); |
|
1514 | + $url = '/_index_template/' . $this->encode($params['name']); |
|
1515 | + $method = 'PUT'; |
|
1516 | + $url = $this->addQueryString($url, $params, ['create', 'cause', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1517 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1518 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1519 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.put_index_template'); |
|
1520 | + return $this->client->sendRequest($request); |
|
1521 | + } |
|
1522 | + /** |
|
1523 | + * Updates the index mappings. |
|
1524 | + * |
|
1525 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html |
|
1526 | + * |
|
1527 | + * @param array{ |
|
1528 | + * index: list, // (REQUIRED) A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. |
|
1529 | + * timeout: time, // Explicit operation timeout |
|
1530 | + * master_timeout: time, // Specify timeout for connection to master |
|
1531 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1532 | + * 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) |
|
1533 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1534 | + * write_index_only: boolean, // When true, applies mappings only to the write index of an alias or data stream |
|
1535 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1536 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1537 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1538 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1539 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1540 | + * body: array, // (REQUIRED) The mapping definition |
|
1541 | + * } $params |
|
1542 | + * |
|
1543 | + * @throws MissingParameterException if a required parameter is missing |
|
1544 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1545 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1546 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1547 | + * |
|
1548 | + * @return Elasticsearch|Promise |
|
1549 | + */ |
|
1550 | + public function putMapping(array $params = []) |
|
1551 | + { |
|
1552 | + $this->checkRequiredParameters(['index', 'body'], $params); |
|
1553 | + $url = '/' . $this->encode($params['index']) . '/_mapping'; |
|
1554 | + $method = 'PUT'; |
|
1555 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'write_index_only', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1556 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1557 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1558 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.put_mapping'); |
|
1559 | + return $this->client->sendRequest($request); |
|
1560 | + } |
|
1561 | + /** |
|
1562 | + * Updates the index settings. |
|
1563 | + * |
|
1564 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html |
|
1565 | + * |
|
1566 | + * @param array{ |
|
1567 | + * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
1568 | + * master_timeout: time, // Specify timeout for connection to master |
|
1569 | + * timeout: time, // Explicit operation timeout |
|
1570 | + * preserve_existing: boolean, // Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false` |
|
1571 | + * reopen: boolean, // Whether to close and reopen the index to apply non-dynamic settings. If set to `true` the indices to which the settings are being applied will be closed temporarily and then reopened in order to apply the changes. The default is `false` |
|
1572 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1573 | + * 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) |
|
1574 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1575 | + * flat_settings: boolean, // Return settings in flat format (default: false) |
|
1576 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1577 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1578 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1579 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1580 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1581 | + * body: array, // (REQUIRED) The index settings to be updated |
|
1582 | + * } $params |
|
1583 | + * |
|
1584 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1585 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1586 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1587 | + * |
|
1588 | + * @return Elasticsearch|Promise |
|
1589 | + */ |
|
1590 | + public function putSettings(array $params = []) |
|
1591 | + { |
|
1592 | + $this->checkRequiredParameters(['body'], $params); |
|
1593 | + if (isset($params['index'])) { |
|
1594 | + $url = '/' . $this->encode($params['index']) . '/_settings'; |
|
1595 | + $method = 'PUT'; |
|
1596 | + } else { |
|
1597 | + $url = '/_settings'; |
|
1598 | + $method = 'PUT'; |
|
1599 | + } |
|
1600 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'timeout', 'preserve_existing', 'reopen', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'flat_settings', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1601 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1602 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1603 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.put_settings'); |
|
1604 | + return $this->client->sendRequest($request); |
|
1605 | + } |
|
1606 | + /** |
|
1607 | + * Creates or updates an index template. |
|
1608 | + * |
|
1609 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates-v1.html |
|
1610 | + * |
|
1611 | + * @param array{ |
|
1612 | + * name: string, // (REQUIRED) The name of the template |
|
1613 | + * order: number, // The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers) |
|
1614 | + * create: boolean, // Whether the index template should only be added if new or can also replace an existing one |
|
1615 | + * master_timeout: time, // Specify timeout for connection to master |
|
1616 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1617 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1618 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1619 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1620 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1621 | + * body: array, // (REQUIRED) The template definition |
|
1622 | + * } $params |
|
1623 | + * |
|
1624 | + * @throws MissingParameterException if a required parameter is missing |
|
1625 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1626 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1627 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1628 | + * |
|
1629 | + * @return Elasticsearch|Promise |
|
1630 | + */ |
|
1631 | + public function putTemplate(array $params = []) |
|
1632 | + { |
|
1633 | + $this->checkRequiredParameters(['name', 'body'], $params); |
|
1634 | + $url = '/_template/' . $this->encode($params['name']); |
|
1635 | + $method = 'PUT'; |
|
1636 | + $url = $this->addQueryString($url, $params, ['order', 'create', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1637 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1638 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1639 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.put_template'); |
|
1640 | + return $this->client->sendRequest($request); |
|
1641 | + } |
|
1642 | + /** |
|
1643 | + * Returns information about ongoing index shard recoveries. |
|
1644 | + * |
|
1645 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html |
|
1646 | + * |
|
1647 | + * @param array{ |
|
1648 | + * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
1649 | + * detailed: boolean, // Whether to display detailed information about shard recovery |
|
1650 | + * active_only: boolean, // Display only those recoveries that are currently on-going |
|
1651 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1652 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1653 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1654 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1655 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1656 | + * } $params |
|
1657 | + * |
|
1658 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1659 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1660 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1661 | + * |
|
1662 | + * @return Elasticsearch|Promise |
|
1663 | + */ |
|
1664 | + public function recovery(array $params = []) |
|
1665 | + { |
|
1666 | + if (isset($params['index'])) { |
|
1667 | + $url = '/' . $this->encode($params['index']) . '/_recovery'; |
|
1668 | + $method = 'GET'; |
|
1669 | + } else { |
|
1670 | + $url = '/_recovery'; |
|
1671 | + $method = 'GET'; |
|
1672 | + } |
|
1673 | + $url = $this->addQueryString($url, $params, ['detailed', 'active_only', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1674 | + $headers = ['Accept' => 'application/json']; |
|
1675 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1676 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.recovery'); |
|
1677 | + return $this->client->sendRequest($request); |
|
1678 | + } |
|
1679 | + /** |
|
1680 | + * Performs the refresh operation in one or more indices. |
|
1681 | + * |
|
1682 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html |
|
1683 | + * |
|
1684 | + * @param array{ |
|
1685 | + * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
1686 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1687 | + * 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) |
|
1688 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1689 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1690 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1691 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1692 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1693 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1694 | + * } $params |
|
1695 | + * |
|
1696 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1697 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1698 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1699 | + * |
|
1700 | + * @return Elasticsearch|Promise |
|
1701 | + */ |
|
1702 | + public function refresh(array $params = []) |
|
1703 | + { |
|
1704 | + if (isset($params['index'])) { |
|
1705 | + $url = '/' . $this->encode($params['index']) . '/_refresh'; |
|
1706 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1707 | + } else { |
|
1708 | + $url = '/_refresh'; |
|
1709 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1710 | + } |
|
1711 | + $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1712 | + $headers = ['Accept' => 'application/json']; |
|
1713 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1714 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.refresh'); |
|
1715 | + return $this->client->sendRequest($request); |
|
1716 | + } |
|
1717 | + /** |
|
1718 | + * Reloads an index's search analyzers and their resources. |
|
1719 | + * |
|
1720 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-reload-analyzers.html |
|
1721 | + * |
|
1722 | + * @param array{ |
|
1723 | + * index: list, // (REQUIRED) A comma-separated list of index names to reload analyzers for |
|
1724 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1725 | + * 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) |
|
1726 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1727 | + * resource: string, // changed resource to reload analyzers from if applicable |
|
1728 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1729 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1730 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1731 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1732 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1733 | + * } $params |
|
1734 | + * |
|
1735 | + * @throws MissingParameterException if a required parameter is missing |
|
1736 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1737 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1738 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1739 | + * |
|
1740 | + * @return Elasticsearch|Promise |
|
1741 | + */ |
|
1742 | + public function reloadSearchAnalyzers(array $params = []) |
|
1743 | + { |
|
1744 | + $this->checkRequiredParameters(['index'], $params); |
|
1745 | + $url = '/' . $this->encode($params['index']) . '/_reload_search_analyzers'; |
|
1746 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
1747 | + $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'resource', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1748 | + $headers = ['Accept' => 'application/json']; |
|
1749 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1750 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.reload_search_analyzers'); |
|
1751 | + return $this->client->sendRequest($request); |
|
1752 | + } |
|
1753 | + /** |
|
1754 | + * Resolves the specified index expressions to return information about each cluster, including the local cluster, if included. |
|
1755 | + * |
|
1756 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-cluster-api.html |
|
1757 | + * |
|
1758 | + * @param array{ |
|
1759 | + * name: list, // (REQUIRED) A comma-separated list of cluster:index names or wildcard expressions |
|
1760 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1761 | + * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled |
|
1762 | + * 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) |
|
1763 | + * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
1764 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1765 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1766 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1767 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1768 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1769 | + * } $params |
|
1770 | + * |
|
1771 | + * @throws MissingParameterException if a required parameter is missing |
|
1772 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1773 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1774 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1775 | + * |
|
1776 | + * @return Elasticsearch|Promise |
|
1777 | + */ |
|
1778 | + public function resolveCluster(array $params = []) |
|
1779 | + { |
|
1780 | + $this->checkRequiredParameters(['name'], $params); |
|
1781 | + $url = '/_resolve/cluster/' . $this->encode($params['name']); |
|
1782 | + $method = 'GET'; |
|
1783 | + $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1784 | + $headers = ['Accept' => 'application/json']; |
|
1785 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1786 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.resolve_cluster'); |
|
1787 | + return $this->client->sendRequest($request); |
|
1788 | + } |
|
1789 | + /** |
|
1790 | + * Returns information about any matching indices, aliases, and data streams |
|
1791 | + * |
|
1792 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-index-api.html |
|
1793 | + * |
|
1794 | + * @param array{ |
|
1795 | + * name: list, // (REQUIRED) A comma-separated list of names or wildcard expressions |
|
1796 | + * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) |
|
1797 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1798 | + * 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) |
|
1799 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1800 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1801 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1802 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1803 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1804 | + * } $params |
|
1805 | + * |
|
1806 | + * @throws MissingParameterException if a required parameter is missing |
|
1807 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1808 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1809 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1810 | + * |
|
1811 | + * @return Elasticsearch|Promise |
|
1812 | + */ |
|
1813 | + public function resolveIndex(array $params = []) |
|
1814 | + { |
|
1815 | + $this->checkRequiredParameters(['name'], $params); |
|
1816 | + $url = '/_resolve/index/' . $this->encode($params['name']); |
|
1817 | + $method = 'GET'; |
|
1818 | + $url = $this->addQueryString($url, $params, ['expand_wildcards', 'ignore_unavailable', 'allow_no_indices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1819 | + $headers = ['Accept' => 'application/json']; |
|
1820 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1821 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.resolve_index'); |
|
1822 | + return $this->client->sendRequest($request); |
|
1823 | + } |
|
1824 | + /** |
|
1825 | + * Updates an alias to point to a new index when the existing index |
|
1826 | + * is considered to be too large or too old. |
|
1827 | + * |
|
1828 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html |
|
1829 | + * |
|
1830 | + * @param array{ |
|
1831 | + * alias: string, // (REQUIRED) The name of the alias to rollover |
|
1832 | + * new_index: string, // The name of the rollover index |
|
1833 | + * timeout: time, // Explicit operation timeout |
|
1834 | + * dry_run: boolean, // If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false |
|
1835 | + * master_timeout: time, // Specify timeout for connection to master |
|
1836 | + * wait_for_active_shards: string, // Set the number of active shards to wait for on the newly created rollover index before the operation returns. |
|
1837 | + * lazy: boolean, // If set to true, the rollover action will only mark a data stream to signal that it needs to be rolled over at the next write. Only allowed on data streams. |
|
1838 | + * target_failure_store: boolean, // If set to true, the rollover action will be applied on the failure store of the data stream. |
|
1839 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1840 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1841 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1842 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1843 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1844 | + * body: array, // The conditions that needs to be met for executing rollover |
|
1845 | + * } $params |
|
1846 | + * |
|
1847 | + * @throws MissingParameterException if a required parameter is missing |
|
1848 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1849 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1850 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1851 | + * |
|
1852 | + * @return Elasticsearch|Promise |
|
1853 | + */ |
|
1854 | + public function rollover(array $params = []) |
|
1855 | + { |
|
1856 | + $this->checkRequiredParameters(['alias'], $params); |
|
1857 | + if (isset($params['new_index'])) { |
|
1858 | + $url = '/' . $this->encode($params['alias']) . '/_rollover/' . $this->encode($params['new_index']); |
|
1859 | + $method = 'POST'; |
|
1860 | + } else { |
|
1861 | + $url = '/' . $this->encode($params['alias']) . '/_rollover'; |
|
1862 | + $method = 'POST'; |
|
1863 | + } |
|
1864 | + $url = $this->addQueryString($url, $params, ['timeout', 'dry_run', 'master_timeout', 'wait_for_active_shards', 'lazy', 'target_failure_store', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1865 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1866 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1867 | + $request = $this->addOtelAttributes($params, ['alias', 'new_index'], $request, 'indices.rollover'); |
|
1868 | + return $this->client->sendRequest($request); |
|
1869 | + } |
|
1870 | + /** |
|
1871 | + * Provides low-level information about segments in a Lucene index. |
|
1872 | + * |
|
1873 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html |
|
1874 | + * |
|
1875 | + * @param array{ |
|
1876 | + * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
1877 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1878 | + * 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) |
|
1879 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1880 | + * verbose: boolean, // Includes detailed memory usage by Lucene. |
|
1881 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1882 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1883 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1884 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1885 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1886 | + * } $params |
|
1887 | + * |
|
1888 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1889 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1890 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1891 | + * |
|
1892 | + * @return Elasticsearch|Promise |
|
1893 | + */ |
|
1894 | + public function segments(array $params = []) |
|
1895 | + { |
|
1896 | + if (isset($params['index'])) { |
|
1897 | + $url = '/' . $this->encode($params['index']) . '/_segments'; |
|
1898 | + $method = 'GET'; |
|
1899 | + } else { |
|
1900 | + $url = '/_segments'; |
|
1901 | + $method = 'GET'; |
|
1902 | + } |
|
1903 | + $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'verbose', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1904 | + $headers = ['Accept' => 'application/json']; |
|
1905 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1906 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.segments'); |
|
1907 | + return $this->client->sendRequest($request); |
|
1908 | + } |
|
1909 | + /** |
|
1910 | + * Provides store information for shard copies of indices. |
|
1911 | + * |
|
1912 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.html |
|
1913 | + * |
|
1914 | + * @param array{ |
|
1915 | + * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
1916 | + * status: list, // A comma-separated list of statuses used to filter on shards to get store information for |
|
1917 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
1918 | + * 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) |
|
1919 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
1920 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1921 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1922 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1923 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1924 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1925 | + * } $params |
|
1926 | + * |
|
1927 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1928 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1929 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1930 | + * |
|
1931 | + * @return Elasticsearch|Promise |
|
1932 | + */ |
|
1933 | + public function shardStores(array $params = []) |
|
1934 | + { |
|
1935 | + if (isset($params['index'])) { |
|
1936 | + $url = '/' . $this->encode($params['index']) . '/_shard_stores'; |
|
1937 | + $method = 'GET'; |
|
1938 | + } else { |
|
1939 | + $url = '/_shard_stores'; |
|
1940 | + $method = 'GET'; |
|
1941 | + } |
|
1942 | + $url = $this->addQueryString($url, $params, ['status', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1943 | + $headers = ['Accept' => 'application/json']; |
|
1944 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1945 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.shard_stores'); |
|
1946 | + return $this->client->sendRequest($request); |
|
1947 | + } |
|
1948 | + /** |
|
1949 | + * Allow to shrink an existing index into a new index with fewer primary shards. |
|
1950 | + * |
|
1951 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html |
|
1952 | + * |
|
1953 | + * @param array{ |
|
1954 | + * index: string, // (REQUIRED) The name of the source index to shrink |
|
1955 | + * target: string, // (REQUIRED) The name of the target index to shrink into |
|
1956 | + * timeout: time, // Explicit operation timeout |
|
1957 | + * master_timeout: time, // Specify timeout for connection to master |
|
1958 | + * wait_for_active_shards: string, // Set the number of active shards to wait for on the shrunken index before the operation returns. |
|
1959 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1960 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1961 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1962 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
1963 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
1964 | + * body: array, // The configuration for the target index (`settings` and `aliases`) |
|
1965 | + * } $params |
|
1966 | + * |
|
1967 | + * @throws MissingParameterException if a required parameter is missing |
|
1968 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
1969 | + * @throws ClientResponseException if the status code of response is 4xx |
|
1970 | + * @throws ServerResponseException if the status code of response is 5xx |
|
1971 | + * |
|
1972 | + * @return Elasticsearch|Promise |
|
1973 | + */ |
|
1974 | + public function shrink(array $params = []) |
|
1975 | + { |
|
1976 | + $this->checkRequiredParameters(['index', 'target'], $params); |
|
1977 | + $url = '/' . $this->encode($params['index']) . '/_shrink/' . $this->encode($params['target']); |
|
1978 | + $method = 'PUT'; |
|
1979 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
1980 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
1981 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
1982 | + $request = $this->addOtelAttributes($params, ['index', 'target'], $request, 'indices.shrink'); |
|
1983 | + return $this->client->sendRequest($request); |
|
1984 | + } |
|
1985 | + /** |
|
1986 | + * Simulate matching the given index name against the index templates in the system |
|
1987 | + * |
|
1988 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-index.html |
|
1989 | + * |
|
1990 | + * @param array{ |
|
1991 | + * name: string, // (REQUIRED) The name of the index (it must be a concrete index name) |
|
1992 | + * create: boolean, // Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one |
|
1993 | + * cause: string, // User defined reason for dry-run creating the new template for simulation purposes |
|
1994 | + * master_timeout: time, // Specify timeout for connection to master |
|
1995 | + * include_defaults: boolean, // Return all relevant default configurations for this index template simulation (default: false) |
|
1996 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
1997 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
1998 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
1999 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
2000 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
2001 | + * body: array, // New index template definition, which will be included in the simulation, as if it already exists in the system |
|
2002 | + * } $params |
|
2003 | + * |
|
2004 | + * @throws MissingParameterException if a required parameter is missing |
|
2005 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
2006 | + * @throws ClientResponseException if the status code of response is 4xx |
|
2007 | + * @throws ServerResponseException if the status code of response is 5xx |
|
2008 | + * |
|
2009 | + * @return Elasticsearch|Promise |
|
2010 | + */ |
|
2011 | + public function simulateIndexTemplate(array $params = []) |
|
2012 | + { |
|
2013 | + $this->checkRequiredParameters(['name'], $params); |
|
2014 | + $url = '/_index_template/_simulate_index/' . $this->encode($params['name']); |
|
2015 | + $method = 'POST'; |
|
2016 | + $url = $this->addQueryString($url, $params, ['create', 'cause', 'master_timeout', 'include_defaults', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
2017 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
2018 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
2019 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.simulate_index_template'); |
|
2020 | + return $this->client->sendRequest($request); |
|
2021 | + } |
|
2022 | + /** |
|
2023 | + * Simulate resolving the given template name or body |
|
2024 | + * |
|
2025 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-template.html |
|
2026 | + * |
|
2027 | + * @param array{ |
|
2028 | + * name: string, // The name of the index template |
|
2029 | + * create: boolean, // Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one |
|
2030 | + * cause: string, // User defined reason for dry-run creating the new template for simulation purposes |
|
2031 | + * master_timeout: time, // Specify timeout for connection to master |
|
2032 | + * include_defaults: boolean, // Return all relevant default configurations for this template simulation (default: false) |
|
2033 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
2034 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
2035 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
2036 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
2037 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
2038 | + * body: array, // New index template definition to be simulated, if no index template name is specified |
|
2039 | + * } $params |
|
2040 | + * |
|
2041 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
2042 | + * @throws ClientResponseException if the status code of response is 4xx |
|
2043 | + * @throws ServerResponseException if the status code of response is 5xx |
|
2044 | + * |
|
2045 | + * @return Elasticsearch|Promise |
|
2046 | + */ |
|
2047 | + public function simulateTemplate(array $params = []) |
|
2048 | + { |
|
2049 | + if (isset($params['name'])) { |
|
2050 | + $url = '/_index_template/_simulate/' . $this->encode($params['name']); |
|
2051 | + $method = 'POST'; |
|
2052 | + } else { |
|
2053 | + $url = '/_index_template/_simulate'; |
|
2054 | + $method = 'POST'; |
|
2055 | + } |
|
2056 | + $url = $this->addQueryString($url, $params, ['create', 'cause', 'master_timeout', 'include_defaults', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
2057 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
2058 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
2059 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.simulate_template'); |
|
2060 | + return $this->client->sendRequest($request); |
|
2061 | + } |
|
2062 | + /** |
|
2063 | + * Allows you to split an existing index into a new index with more primary shards. |
|
2064 | + * |
|
2065 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-index.html |
|
2066 | + * |
|
2067 | + * @param array{ |
|
2068 | + * index: string, // (REQUIRED) The name of the source index to split |
|
2069 | + * target: string, // (REQUIRED) The name of the target index to split into |
|
2070 | + * timeout: time, // Explicit operation timeout |
|
2071 | + * master_timeout: time, // Specify timeout for connection to master |
|
2072 | + * wait_for_active_shards: string, // Set the number of active shards to wait for on the shrunken index before the operation returns. |
|
2073 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
2074 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
2075 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
2076 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
2077 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
2078 | + * body: array, // The configuration for the target index (`settings` and `aliases`) |
|
2079 | + * } $params |
|
2080 | + * |
|
2081 | + * @throws MissingParameterException if a required parameter is missing |
|
2082 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
2083 | + * @throws ClientResponseException if the status code of response is 4xx |
|
2084 | + * @throws ServerResponseException if the status code of response is 5xx |
|
2085 | + * |
|
2086 | + * @return Elasticsearch|Promise |
|
2087 | + */ |
|
2088 | + public function split(array $params = []) |
|
2089 | + { |
|
2090 | + $this->checkRequiredParameters(['index', 'target'], $params); |
|
2091 | + $url = '/' . $this->encode($params['index']) . '/_split/' . $this->encode($params['target']); |
|
2092 | + $method = 'PUT'; |
|
2093 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
2094 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
2095 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
2096 | + $request = $this->addOtelAttributes($params, ['index', 'target'], $request, 'indices.split'); |
|
2097 | + return $this->client->sendRequest($request); |
|
2098 | + } |
|
2099 | + /** |
|
2100 | + * Provides statistics on operations happening in an index. |
|
2101 | + * |
|
2102 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html |
|
2103 | + * |
|
2104 | + * @param array{ |
|
2105 | + * metric: list, // Limit the information returned the specific metrics. |
|
2106 | + * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices |
|
2107 | + * completion_fields: list, // A comma-separated list of fields for the `completion` index metric (supports wildcards) |
|
2108 | + * fielddata_fields: list, // A comma-separated list of fields for the `fielddata` index metric (supports wildcards) |
|
2109 | + * fields: list, // A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) |
|
2110 | + * groups: list, // A comma-separated list of search groups for `search` index metric |
|
2111 | + * level: enum, // Return stats aggregated at cluster, index or shard level |
|
2112 | + * include_segment_file_sizes: boolean, // Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) |
|
2113 | + * include_unloaded_segments: boolean, // If set to true segment stats will include stats for segments that are not currently loaded into memory |
|
2114 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
2115 | + * forbid_closed_indices: boolean, // If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices |
|
2116 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
2117 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
2118 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
2119 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
2120 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
2121 | + * } $params |
|
2122 | + * |
|
2123 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
2124 | + * @throws ClientResponseException if the status code of response is 4xx |
|
2125 | + * @throws ServerResponseException if the status code of response is 5xx |
|
2126 | + * |
|
2127 | + * @return Elasticsearch|Promise |
|
2128 | + */ |
|
2129 | + public function stats(array $params = []) |
|
2130 | + { |
|
2131 | + if (isset($params['index']) && isset($params['metric'])) { |
|
2132 | + $url = '/' . $this->encode($params['index']) . '/_stats/' . $this->encode($params['metric']); |
|
2133 | + $method = 'GET'; |
|
2134 | + } elseif (isset($params['metric'])) { |
|
2135 | + $url = '/_stats/' . $this->encode($params['metric']); |
|
2136 | + $method = 'GET'; |
|
2137 | + } elseif (isset($params['index'])) { |
|
2138 | + $url = '/' . $this->encode($params['index']) . '/_stats'; |
|
2139 | + $method = 'GET'; |
|
2140 | + } else { |
|
2141 | + $url = '/_stats'; |
|
2142 | + $method = 'GET'; |
|
2143 | + } |
|
2144 | + $url = $this->addQueryString($url, $params, ['completion_fields', 'fielddata_fields', 'fields', 'groups', 'level', 'include_segment_file_sizes', 'include_unloaded_segments', 'expand_wildcards', 'forbid_closed_indices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
2145 | + $headers = ['Accept' => 'application/json']; |
|
2146 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
2147 | + $request = $this->addOtelAttributes($params, ['metric', 'index'], $request, 'indices.stats'); |
|
2148 | + return $this->client->sendRequest($request); |
|
2149 | + } |
|
2150 | + /** |
|
2151 | + * Unfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again. |
|
2152 | + * |
|
2153 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/unfreeze-index-api.html |
|
2154 | + * |
|
2155 | + * @param array{ |
|
2156 | + * index: string, // (REQUIRED) The name of the index to unfreeze |
|
2157 | + * timeout: time, // Explicit operation timeout |
|
2158 | + * master_timeout: time, // Specify timeout for connection to master |
|
2159 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
2160 | + * 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) |
|
2161 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
2162 | + * wait_for_active_shards: string, // Sets the number of active shards to wait for before the operation returns. |
|
2163 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
2164 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
2165 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
2166 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
2167 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
2168 | + * } $params |
|
2169 | + * |
|
2170 | + * @throws MissingParameterException if a required parameter is missing |
|
2171 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
2172 | + * @throws ClientResponseException if the status code of response is 4xx |
|
2173 | + * @throws ServerResponseException if the status code of response is 5xx |
|
2174 | + * |
|
2175 | + * @return Elasticsearch|Promise |
|
2176 | + */ |
|
2177 | + public function unfreeze(array $params = []) |
|
2178 | + { |
|
2179 | + $this->checkRequiredParameters(['index'], $params); |
|
2180 | + $url = '/' . $this->encode($params['index']) . '/_unfreeze'; |
|
2181 | + $method = 'POST'; |
|
2182 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
2183 | + $headers = ['Accept' => 'application/json']; |
|
2184 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
2185 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.unfreeze'); |
|
2186 | + return $this->client->sendRequest($request); |
|
2187 | + } |
|
2188 | + /** |
|
2189 | + * Updates index aliases. |
|
2190 | + * |
|
2191 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html |
|
2192 | + * |
|
2193 | + * @param array{ |
|
2194 | + * timeout: time, // Request timeout |
|
2195 | + * master_timeout: time, // Specify timeout for connection to master |
|
2196 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
2197 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
2198 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
2199 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
2200 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
2201 | + * body: array, // (REQUIRED) The definition of `actions` to perform |
|
2202 | + * } $params |
|
2203 | + * |
|
2204 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
2205 | + * @throws ClientResponseException if the status code of response is 4xx |
|
2206 | + * @throws ServerResponseException if the status code of response is 5xx |
|
2207 | + * |
|
2208 | + * @return Elasticsearch|Promise |
|
2209 | + */ |
|
2210 | + public function updateAliases(array $params = []) |
|
2211 | + { |
|
2212 | + $this->checkRequiredParameters(['body'], $params); |
|
2213 | + $url = '/_aliases'; |
|
2214 | + $method = 'POST'; |
|
2215 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
2216 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
2217 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
2218 | + $request = $this->addOtelAttributes($params, [], $request, 'indices.update_aliases'); |
|
2219 | + return $this->client->sendRequest($request); |
|
2220 | + } |
|
2221 | + /** |
|
2222 | + * Allows a user to validate a potentially expensive query without executing it. |
|
2223 | + * |
|
2224 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.html |
|
2225 | + * |
|
2226 | + * @param array{ |
|
2227 | + * index: list, // A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices |
|
2228 | + * explain: boolean, // Return detailed information about the error |
|
2229 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
2230 | + * 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) |
|
2231 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
2232 | + * q: string, // Query in the Lucene query string syntax |
|
2233 | + * analyzer: string, // The analyzer to use for the query string |
|
2234 | + * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) |
|
2235 | + * default_operator: enum, // The default operator for query string query (AND or OR) |
|
2236 | + * df: string, // The field to use as default where no field prefix is given in the query string |
|
2237 | + * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
2238 | + * rewrite: boolean, // Provide a more detailed explanation showing the actual Lucene query that will be executed. |
|
2239 | + * all_shards: boolean, // Execute validation on all shards instead of one random shard per index |
|
2240 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
2241 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
2242 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
2243 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
2244 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
2245 | + * body: array, // The query definition specified with the Query DSL |
|
2246 | + * } $params |
|
2247 | + * |
|
2248 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
2249 | + * @throws ClientResponseException if the status code of response is 4xx |
|
2250 | + * @throws ServerResponseException if the status code of response is 5xx |
|
2251 | + * |
|
2252 | + * @return Elasticsearch|Promise |
|
2253 | + */ |
|
2254 | + public function validateQuery(array $params = []) |
|
2255 | + { |
|
2256 | + if (isset($params['index'])) { |
|
2257 | + $url = '/' . $this->encode($params['index']) . '/_validate/query'; |
|
2258 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
2259 | + } else { |
|
2260 | + $url = '/_validate/query'; |
|
2261 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
2262 | + } |
|
2263 | + $url = $this->addQueryString($url, $params, ['explain', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'q', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'rewrite', 'all_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
2264 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
2265 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
2266 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'indices.validate_query'); |
|
2267 | + return $this->client->sendRequest($request); |
|
2268 | + } |
|
2269 | 2269 | } |
@@ -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\Endpoints; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Exception\ClientResponseException; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function addBlock(array $params = []) |
56 | 56 | { |
57 | 57 | $this->checkRequiredParameters(['index', 'block'], $params); |
58 | - $url = '/' . $this->encode($params['index']) . '/_block/' . $this->encode($params['block']); |
|
58 | + $url = '/'.$this->encode($params['index']).'/_block/'.$this->encode($params['block']); |
|
59 | 59 | $method = 'PUT'; |
60 | 60 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
61 | 61 | $headers = ['Accept' => 'application/json']; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public function analyze(array $params = []) |
88 | 88 | { |
89 | 89 | if (isset($params['index'])) { |
90 | - $url = '/' . $this->encode($params['index']) . '/_analyze'; |
|
90 | + $url = '/'.$this->encode($params['index']).'/_analyze'; |
|
91 | 91 | $method = empty($params['body']) ? 'GET' : 'POST'; |
92 | 92 | } else { |
93 | 93 | $url = '/_analyze'; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function clearCache(array $params = []) |
130 | 130 | { |
131 | 131 | if (isset($params['index'])) { |
132 | - $url = '/' . $this->encode($params['index']) . '/_cache/clear'; |
|
132 | + $url = '/'.$this->encode($params['index']).'/_cache/clear'; |
|
133 | 133 | $method = 'POST'; |
134 | 134 | } else { |
135 | 135 | $url = '/_cache/clear'; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | public function clone(array $params = []) |
171 | 171 | { |
172 | 172 | $this->checkRequiredParameters(['index', 'target'], $params); |
173 | - $url = '/' . $this->encode($params['index']) . '/_clone/' . $this->encode($params['target']); |
|
173 | + $url = '/'.$this->encode($params['index']).'/_clone/'.$this->encode($params['target']); |
|
174 | 174 | $method = 'PUT'; |
175 | 175 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
176 | 176 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | public function close(array $params = []) |
209 | 209 | { |
210 | 210 | $this->checkRequiredParameters(['index'], $params); |
211 | - $url = '/' . $this->encode($params['index']) . '/_close'; |
|
211 | + $url = '/'.$this->encode($params['index']).'/_close'; |
|
212 | 212 | $method = 'POST'; |
213 | 213 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
214 | 214 | $headers = ['Accept' => 'application/json']; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | public function create(array $params = []) |
245 | 245 | { |
246 | 246 | $this->checkRequiredParameters(['index'], $params); |
247 | - $url = '/' . $this->encode($params['index']); |
|
247 | + $url = '/'.$this->encode($params['index']); |
|
248 | 248 | $method = 'PUT'; |
249 | 249 | $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
250 | 250 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | public function createDataStream(array $params = []) |
279 | 279 | { |
280 | 280 | $this->checkRequiredParameters(['name'], $params); |
281 | - $url = '/_data_stream/' . $this->encode($params['name']); |
|
281 | + $url = '/_data_stream/'.$this->encode($params['name']); |
|
282 | 282 | $method = 'PUT'; |
283 | 283 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
284 | 284 | $headers = ['Accept' => 'application/json']; |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | public function dataStreamsStats(array $params = []) |
310 | 310 | { |
311 | 311 | if (isset($params['name'])) { |
312 | - $url = '/_data_stream/' . $this->encode($params['name']) . '/_stats'; |
|
312 | + $url = '/_data_stream/'.$this->encode($params['name']).'/_stats'; |
|
313 | 313 | $method = 'GET'; |
314 | 314 | } else { |
315 | 315 | $url = '/_data_stream/_stats'; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | public function delete(array $params = []) |
351 | 351 | { |
352 | 352 | $this->checkRequiredParameters(['index'], $params); |
353 | - $url = '/' . $this->encode($params['index']); |
|
353 | + $url = '/'.$this->encode($params['index']); |
|
354 | 354 | $method = 'DELETE'; |
355 | 355 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
356 | 356 | $headers = ['Accept' => 'application/json']; |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | public function deleteAlias(array $params = []) |
386 | 386 | { |
387 | 387 | $this->checkRequiredParameters(['index', 'name'], $params); |
388 | - $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); |
|
388 | + $url = '/'.$this->encode($params['index']).'/_alias/'.$this->encode($params['name']); |
|
389 | 389 | $method = 'DELETE'; |
390 | 390 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
391 | 391 | $headers = ['Accept' => 'application/json']; |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | public function deleteDataLifecycle(array $params = []) |
421 | 421 | { |
422 | 422 | $this->checkRequiredParameters(['name'], $params); |
423 | - $url = '/_data_stream/' . $this->encode($params['name']) . '/_lifecycle'; |
|
423 | + $url = '/_data_stream/'.$this->encode($params['name']).'/_lifecycle'; |
|
424 | 424 | $method = 'DELETE'; |
425 | 425 | $url = $this->addQueryString($url, $params, ['expand_wildcards', 'timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
426 | 426 | $headers = ['Accept' => 'application/json']; |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | public function deleteDataStream(array $params = []) |
455 | 455 | { |
456 | 456 | $this->checkRequiredParameters(['name'], $params); |
457 | - $url = '/_data_stream/' . $this->encode($params['name']); |
|
457 | + $url = '/_data_stream/'.$this->encode($params['name']); |
|
458 | 458 | $method = 'DELETE'; |
459 | 459 | $url = $this->addQueryString($url, $params, ['expand_wildcards', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
460 | 460 | $headers = ['Accept' => 'application/json']; |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | public function deleteIndexTemplate(array $params = []) |
489 | 489 | { |
490 | 490 | $this->checkRequiredParameters(['name'], $params); |
491 | - $url = '/_index_template/' . $this->encode($params['name']); |
|
491 | + $url = '/_index_template/'.$this->encode($params['name']); |
|
492 | 492 | $method = 'DELETE'; |
493 | 493 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
494 | 494 | $headers = ['Accept' => 'application/json']; |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | public function deleteTemplate(array $params = []) |
523 | 523 | { |
524 | 524 | $this->checkRequiredParameters(['name'], $params); |
525 | - $url = '/_template/' . $this->encode($params['name']); |
|
525 | + $url = '/_template/'.$this->encode($params['name']); |
|
526 | 526 | $method = 'DELETE'; |
527 | 527 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
528 | 528 | $headers = ['Accept' => 'application/json']; |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | public function diskUsage(array $params = []) |
561 | 561 | { |
562 | 562 | $this->checkRequiredParameters(['index'], $params); |
563 | - $url = '/' . $this->encode($params['index']) . '/_disk_usage'; |
|
563 | + $url = '/'.$this->encode($params['index']).'/_disk_usage'; |
|
564 | 564 | $method = 'POST'; |
565 | 565 | $url = $this->addQueryString($url, $params, ['run_expensive_tasks', 'flush', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
566 | 566 | $headers = ['Accept' => 'application/json']; |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | public function downsample(array $params = []) |
596 | 596 | { |
597 | 597 | $this->checkRequiredParameters(['index', 'target_index', 'body'], $params); |
598 | - $url = '/' . $this->encode($params['index']) . '/_downsample/' . $this->encode($params['target_index']); |
|
598 | + $url = '/'.$this->encode($params['index']).'/_downsample/'.$this->encode($params['target_index']); |
|
599 | 599 | $method = 'POST'; |
600 | 600 | $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
601 | 601 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | public function exists(array $params = []) |
634 | 634 | { |
635 | 635 | $this->checkRequiredParameters(['index'], $params); |
636 | - $url = '/' . $this->encode($params['index']); |
|
636 | + $url = '/'.$this->encode($params['index']); |
|
637 | 637 | $method = 'HEAD'; |
638 | 638 | $url = $this->addQueryString($url, $params, ['local', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'flat_settings', 'include_defaults', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
639 | 639 | $headers = ['Accept' => 'application/json']; |
@@ -671,10 +671,10 @@ discard block |
||
671 | 671 | { |
672 | 672 | $this->checkRequiredParameters(['name'], $params); |
673 | 673 | if (isset($params['index'])) { |
674 | - $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); |
|
674 | + $url = '/'.$this->encode($params['index']).'/_alias/'.$this->encode($params['name']); |
|
675 | 675 | $method = 'HEAD'; |
676 | 676 | } else { |
677 | - $url = '/_alias/' . $this->encode($params['name']); |
|
677 | + $url = '/_alias/'.$this->encode($params['name']); |
|
678 | 678 | $method = 'HEAD'; |
679 | 679 | } |
680 | 680 | $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | public function existsIndexTemplate(array $params = []) |
711 | 711 | { |
712 | 712 | $this->checkRequiredParameters(['name'], $params); |
713 | - $url = '/_index_template/' . $this->encode($params['name']); |
|
713 | + $url = '/_index_template/'.$this->encode($params['name']); |
|
714 | 714 | $method = 'HEAD'; |
715 | 715 | $url = $this->addQueryString($url, $params, ['flat_settings', 'master_timeout', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
716 | 716 | $headers = ['Accept' => 'application/json']; |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | public function existsTemplate(array $params = []) |
746 | 746 | { |
747 | 747 | $this->checkRequiredParameters(['name'], $params); |
748 | - $url = '/_template/' . $this->encode($params['name']); |
|
748 | + $url = '/_template/'.$this->encode($params['name']); |
|
749 | 749 | $method = 'HEAD'; |
750 | 750 | $url = $this->addQueryString($url, $params, ['flat_settings', 'master_timeout', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
751 | 751 | $headers = ['Accept' => 'application/json']; |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | public function explainDataLifecycle(array $params = []) |
780 | 780 | { |
781 | 781 | $this->checkRequiredParameters(['index'], $params); |
782 | - $url = '/' . $this->encode($params['index']) . '/_lifecycle/explain'; |
|
782 | + $url = '/'.$this->encode($params['index']).'/_lifecycle/explain'; |
|
783 | 783 | $method = 'GET'; |
784 | 784 | $url = $this->addQueryString($url, $params, ['include_defaults', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
785 | 785 | $headers = ['Accept' => 'application/json']; |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | public function fieldUsageStats(array $params = []) |
817 | 817 | { |
818 | 818 | $this->checkRequiredParameters(['index'], $params); |
819 | - $url = '/' . $this->encode($params['index']) . '/_field_usage_stats'; |
|
819 | + $url = '/'.$this->encode($params['index']).'/_field_usage_stats'; |
|
820 | 820 | $method = 'GET'; |
821 | 821 | $url = $this->addQueryString($url, $params, ['fields', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
822 | 822 | $headers = ['Accept' => 'application/json']; |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | public function flush(array $params = []) |
853 | 853 | { |
854 | 854 | if (isset($params['index'])) { |
855 | - $url = '/' . $this->encode($params['index']) . '/_flush'; |
|
855 | + $url = '/'.$this->encode($params['index']).'/_flush'; |
|
856 | 856 | $method = empty($params['body']) ? 'GET' : 'POST'; |
857 | 857 | } else { |
858 | 858 | $url = '/_flush'; |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | public function forcemerge(array $params = []) |
895 | 895 | { |
896 | 896 | if (isset($params['index'])) { |
897 | - $url = '/' . $this->encode($params['index']) . '/_forcemerge'; |
|
897 | + $url = '/'.$this->encode($params['index']).'/_forcemerge'; |
|
898 | 898 | $method = 'POST'; |
899 | 899 | } else { |
900 | 900 | $url = '/_forcemerge'; |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | public function get(array $params = []) |
939 | 939 | { |
940 | 940 | $this->checkRequiredParameters(['index'], $params); |
941 | - $url = '/' . $this->encode($params['index']); |
|
941 | + $url = '/'.$this->encode($params['index']); |
|
942 | 942 | $method = 'GET'; |
943 | 943 | $url = $this->addQueryString($url, $params, ['local', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'features', 'flat_settings', 'include_defaults', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
944 | 944 | $headers = ['Accept' => 'application/json']; |
@@ -974,13 +974,13 @@ discard block |
||
974 | 974 | public function getAlias(array $params = []) |
975 | 975 | { |
976 | 976 | if (isset($params['index']) && isset($params['name'])) { |
977 | - $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); |
|
977 | + $url = '/'.$this->encode($params['index']).'/_alias/'.$this->encode($params['name']); |
|
978 | 978 | $method = 'GET'; |
979 | 979 | } elseif (isset($params['name'])) { |
980 | - $url = '/_alias/' . $this->encode($params['name']); |
|
980 | + $url = '/_alias/'.$this->encode($params['name']); |
|
981 | 981 | $method = 'GET'; |
982 | 982 | } elseif (isset($params['index'])) { |
983 | - $url = '/' . $this->encode($params['index']) . '/_alias'; |
|
983 | + $url = '/'.$this->encode($params['index']).'/_alias'; |
|
984 | 984 | $method = 'GET'; |
985 | 985 | } else { |
986 | 986 | $url = '/_alias'; |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | public function getDataLifecycle(array $params = []) |
1020 | 1020 | { |
1021 | 1021 | $this->checkRequiredParameters(['name'], $params); |
1022 | - $url = '/_data_stream/' . $this->encode($params['name']) . '/_lifecycle'; |
|
1022 | + $url = '/_data_stream/'.$this->encode($params['name']).'/_lifecycle'; |
|
1023 | 1023 | $method = 'GET'; |
1024 | 1024 | $url = $this->addQueryString($url, $params, ['expand_wildcards', 'include_defaults', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1025 | 1025 | $headers = ['Accept' => 'application/json']; |
@@ -1054,7 +1054,7 @@ discard block |
||
1054 | 1054 | public function getDataStream(array $params = []) |
1055 | 1055 | { |
1056 | 1056 | if (isset($params['name'])) { |
1057 | - $url = '/_data_stream/' . $this->encode($params['name']); |
|
1057 | + $url = '/_data_stream/'.$this->encode($params['name']); |
|
1058 | 1058 | $method = 'GET'; |
1059 | 1059 | } else { |
1060 | 1060 | $url = '/_data_stream'; |
@@ -1097,10 +1097,10 @@ discard block |
||
1097 | 1097 | { |
1098 | 1098 | $this->checkRequiredParameters(['fields'], $params); |
1099 | 1099 | if (isset($params['index'])) { |
1100 | - $url = '/' . $this->encode($params['index']) . '/_mapping/field/' . $this->encode($params['fields']); |
|
1100 | + $url = '/'.$this->encode($params['index']).'/_mapping/field/'.$this->encode($params['fields']); |
|
1101 | 1101 | $method = 'GET'; |
1102 | 1102 | } else { |
1103 | - $url = '/_mapping/field/' . $this->encode($params['fields']); |
|
1103 | + $url = '/_mapping/field/'.$this->encode($params['fields']); |
|
1104 | 1104 | $method = 'GET'; |
1105 | 1105 | } |
1106 | 1106 | $url = $this->addQueryString($url, $params, ['include_defaults', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'local', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
@@ -1136,7 +1136,7 @@ discard block |
||
1136 | 1136 | public function getIndexTemplate(array $params = []) |
1137 | 1137 | { |
1138 | 1138 | if (isset($params['name'])) { |
1139 | - $url = '/_index_template/' . $this->encode($params['name']); |
|
1139 | + $url = '/_index_template/'.$this->encode($params['name']); |
|
1140 | 1140 | $method = 'GET'; |
1141 | 1141 | } else { |
1142 | 1142 | $url = '/_index_template'; |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | public function getMapping(array $params = []) |
1177 | 1177 | { |
1178 | 1178 | if (isset($params['index'])) { |
1179 | - $url = '/' . $this->encode($params['index']) . '/_mapping'; |
|
1179 | + $url = '/'.$this->encode($params['index']).'/_mapping'; |
|
1180 | 1180 | $method = 'GET'; |
1181 | 1181 | } else { |
1182 | 1182 | $url = '/_mapping'; |
@@ -1219,13 +1219,13 @@ discard block |
||
1219 | 1219 | public function getSettings(array $params = []) |
1220 | 1220 | { |
1221 | 1221 | if (isset($params['index']) && isset($params['name'])) { |
1222 | - $url = '/' . $this->encode($params['index']) . '/_settings/' . $this->encode($params['name']); |
|
1222 | + $url = '/'.$this->encode($params['index']).'/_settings/'.$this->encode($params['name']); |
|
1223 | 1223 | $method = 'GET'; |
1224 | 1224 | } elseif (isset($params['index'])) { |
1225 | - $url = '/' . $this->encode($params['index']) . '/_settings'; |
|
1225 | + $url = '/'.$this->encode($params['index']).'/_settings'; |
|
1226 | 1226 | $method = 'GET'; |
1227 | 1227 | } elseif (isset($params['name'])) { |
1228 | - $url = '/_settings/' . $this->encode($params['name']); |
|
1228 | + $url = '/_settings/'.$this->encode($params['name']); |
|
1229 | 1229 | $method = 'GET'; |
1230 | 1230 | } else { |
1231 | 1231 | $url = '/_settings'; |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | public function getTemplate(array $params = []) |
1264 | 1264 | { |
1265 | 1265 | if (isset($params['name'])) { |
1266 | - $url = '/_template/' . $this->encode($params['name']); |
|
1266 | + $url = '/_template/'.$this->encode($params['name']); |
|
1267 | 1267 | $method = 'GET'; |
1268 | 1268 | } else { |
1269 | 1269 | $url = '/_template'; |
@@ -1301,7 +1301,7 @@ discard block |
||
1301 | 1301 | public function migrateToDataStream(array $params = []) |
1302 | 1302 | { |
1303 | 1303 | $this->checkRequiredParameters(['name'], $params); |
1304 | - $url = '/_data_stream/_migrate/' . $this->encode($params['name']); |
|
1304 | + $url = '/_data_stream/_migrate/'.$this->encode($params['name']); |
|
1305 | 1305 | $method = 'POST'; |
1306 | 1306 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1307 | 1307 | $headers = ['Accept' => 'application/json']; |
@@ -1370,7 +1370,7 @@ discard block |
||
1370 | 1370 | public function open(array $params = []) |
1371 | 1371 | { |
1372 | 1372 | $this->checkRequiredParameters(['index'], $params); |
1373 | - $url = '/' . $this->encode($params['index']) . '/_open'; |
|
1373 | + $url = '/'.$this->encode($params['index']).'/_open'; |
|
1374 | 1374 | $method = 'POST'; |
1375 | 1375 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1376 | 1376 | $headers = ['Accept' => 'application/json']; |
@@ -1403,7 +1403,7 @@ discard block |
||
1403 | 1403 | public function promoteDataStream(array $params = []) |
1404 | 1404 | { |
1405 | 1405 | $this->checkRequiredParameters(['name'], $params); |
1406 | - $url = '/_data_stream/_promote/' . $this->encode($params['name']); |
|
1406 | + $url = '/_data_stream/_promote/'.$this->encode($params['name']); |
|
1407 | 1407 | $method = 'POST'; |
1408 | 1408 | $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1409 | 1409 | $headers = ['Accept' => 'application/json']; |
@@ -1439,7 +1439,7 @@ discard block |
||
1439 | 1439 | public function putAlias(array $params = []) |
1440 | 1440 | { |
1441 | 1441 | $this->checkRequiredParameters(['index', 'name'], $params); |
1442 | - $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); |
|
1442 | + $url = '/'.$this->encode($params['index']).'/_alias/'.$this->encode($params['name']); |
|
1443 | 1443 | $method = 'PUT'; |
1444 | 1444 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1445 | 1445 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -1475,7 +1475,7 @@ discard block |
||
1475 | 1475 | public function putDataLifecycle(array $params = []) |
1476 | 1476 | { |
1477 | 1477 | $this->checkRequiredParameters(['name'], $params); |
1478 | - $url = '/_data_stream/' . $this->encode($params['name']) . '/_lifecycle'; |
|
1478 | + $url = '/_data_stream/'.$this->encode($params['name']).'/_lifecycle'; |
|
1479 | 1479 | $method = 'PUT'; |
1480 | 1480 | $url = $this->addQueryString($url, $params, ['expand_wildcards', 'timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1481 | 1481 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -1511,7 +1511,7 @@ discard block |
||
1511 | 1511 | public function putIndexTemplate(array $params = []) |
1512 | 1512 | { |
1513 | 1513 | $this->checkRequiredParameters(['name', 'body'], $params); |
1514 | - $url = '/_index_template/' . $this->encode($params['name']); |
|
1514 | + $url = '/_index_template/'.$this->encode($params['name']); |
|
1515 | 1515 | $method = 'PUT'; |
1516 | 1516 | $url = $this->addQueryString($url, $params, ['create', 'cause', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1517 | 1517 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -1550,7 +1550,7 @@ discard block |
||
1550 | 1550 | public function putMapping(array $params = []) |
1551 | 1551 | { |
1552 | 1552 | $this->checkRequiredParameters(['index', 'body'], $params); |
1553 | - $url = '/' . $this->encode($params['index']) . '/_mapping'; |
|
1553 | + $url = '/'.$this->encode($params['index']).'/_mapping'; |
|
1554 | 1554 | $method = 'PUT'; |
1555 | 1555 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'write_index_only', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1556 | 1556 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -1591,7 +1591,7 @@ discard block |
||
1591 | 1591 | { |
1592 | 1592 | $this->checkRequiredParameters(['body'], $params); |
1593 | 1593 | if (isset($params['index'])) { |
1594 | - $url = '/' . $this->encode($params['index']) . '/_settings'; |
|
1594 | + $url = '/'.$this->encode($params['index']).'/_settings'; |
|
1595 | 1595 | $method = 'PUT'; |
1596 | 1596 | } else { |
1597 | 1597 | $url = '/_settings'; |
@@ -1631,7 +1631,7 @@ discard block |
||
1631 | 1631 | public function putTemplate(array $params = []) |
1632 | 1632 | { |
1633 | 1633 | $this->checkRequiredParameters(['name', 'body'], $params); |
1634 | - $url = '/_template/' . $this->encode($params['name']); |
|
1634 | + $url = '/_template/'.$this->encode($params['name']); |
|
1635 | 1635 | $method = 'PUT'; |
1636 | 1636 | $url = $this->addQueryString($url, $params, ['order', 'create', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1637 | 1637 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -1664,7 +1664,7 @@ discard block |
||
1664 | 1664 | public function recovery(array $params = []) |
1665 | 1665 | { |
1666 | 1666 | if (isset($params['index'])) { |
1667 | - $url = '/' . $this->encode($params['index']) . '/_recovery'; |
|
1667 | + $url = '/'.$this->encode($params['index']).'/_recovery'; |
|
1668 | 1668 | $method = 'GET'; |
1669 | 1669 | } else { |
1670 | 1670 | $url = '/_recovery'; |
@@ -1702,7 +1702,7 @@ discard block |
||
1702 | 1702 | public function refresh(array $params = []) |
1703 | 1703 | { |
1704 | 1704 | if (isset($params['index'])) { |
1705 | - $url = '/' . $this->encode($params['index']) . '/_refresh'; |
|
1705 | + $url = '/'.$this->encode($params['index']).'/_refresh'; |
|
1706 | 1706 | $method = empty($params['body']) ? 'GET' : 'POST'; |
1707 | 1707 | } else { |
1708 | 1708 | $url = '/_refresh'; |
@@ -1742,7 +1742,7 @@ discard block |
||
1742 | 1742 | public function reloadSearchAnalyzers(array $params = []) |
1743 | 1743 | { |
1744 | 1744 | $this->checkRequiredParameters(['index'], $params); |
1745 | - $url = '/' . $this->encode($params['index']) . '/_reload_search_analyzers'; |
|
1745 | + $url = '/'.$this->encode($params['index']).'/_reload_search_analyzers'; |
|
1746 | 1746 | $method = empty($params['body']) ? 'GET' : 'POST'; |
1747 | 1747 | $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'resource', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1748 | 1748 | $headers = ['Accept' => 'application/json']; |
@@ -1778,7 +1778,7 @@ discard block |
||
1778 | 1778 | public function resolveCluster(array $params = []) |
1779 | 1779 | { |
1780 | 1780 | $this->checkRequiredParameters(['name'], $params); |
1781 | - $url = '/_resolve/cluster/' . $this->encode($params['name']); |
|
1781 | + $url = '/_resolve/cluster/'.$this->encode($params['name']); |
|
1782 | 1782 | $method = 'GET'; |
1783 | 1783 | $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1784 | 1784 | $headers = ['Accept' => 'application/json']; |
@@ -1813,7 +1813,7 @@ discard block |
||
1813 | 1813 | public function resolveIndex(array $params = []) |
1814 | 1814 | { |
1815 | 1815 | $this->checkRequiredParameters(['name'], $params); |
1816 | - $url = '/_resolve/index/' . $this->encode($params['name']); |
|
1816 | + $url = '/_resolve/index/'.$this->encode($params['name']); |
|
1817 | 1817 | $method = 'GET'; |
1818 | 1818 | $url = $this->addQueryString($url, $params, ['expand_wildcards', 'ignore_unavailable', 'allow_no_indices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1819 | 1819 | $headers = ['Accept' => 'application/json']; |
@@ -1855,10 +1855,10 @@ discard block |
||
1855 | 1855 | { |
1856 | 1856 | $this->checkRequiredParameters(['alias'], $params); |
1857 | 1857 | if (isset($params['new_index'])) { |
1858 | - $url = '/' . $this->encode($params['alias']) . '/_rollover/' . $this->encode($params['new_index']); |
|
1858 | + $url = '/'.$this->encode($params['alias']).'/_rollover/'.$this->encode($params['new_index']); |
|
1859 | 1859 | $method = 'POST'; |
1860 | 1860 | } else { |
1861 | - $url = '/' . $this->encode($params['alias']) . '/_rollover'; |
|
1861 | + $url = '/'.$this->encode($params['alias']).'/_rollover'; |
|
1862 | 1862 | $method = 'POST'; |
1863 | 1863 | } |
1864 | 1864 | $url = $this->addQueryString($url, $params, ['timeout', 'dry_run', 'master_timeout', 'wait_for_active_shards', 'lazy', 'target_failure_store', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
@@ -1894,7 +1894,7 @@ discard block |
||
1894 | 1894 | public function segments(array $params = []) |
1895 | 1895 | { |
1896 | 1896 | if (isset($params['index'])) { |
1897 | - $url = '/' . $this->encode($params['index']) . '/_segments'; |
|
1897 | + $url = '/'.$this->encode($params['index']).'/_segments'; |
|
1898 | 1898 | $method = 'GET'; |
1899 | 1899 | } else { |
1900 | 1900 | $url = '/_segments'; |
@@ -1933,7 +1933,7 @@ discard block |
||
1933 | 1933 | public function shardStores(array $params = []) |
1934 | 1934 | { |
1935 | 1935 | if (isset($params['index'])) { |
1936 | - $url = '/' . $this->encode($params['index']) . '/_shard_stores'; |
|
1936 | + $url = '/'.$this->encode($params['index']).'/_shard_stores'; |
|
1937 | 1937 | $method = 'GET'; |
1938 | 1938 | } else { |
1939 | 1939 | $url = '/_shard_stores'; |
@@ -1974,7 +1974,7 @@ discard block |
||
1974 | 1974 | public function shrink(array $params = []) |
1975 | 1975 | { |
1976 | 1976 | $this->checkRequiredParameters(['index', 'target'], $params); |
1977 | - $url = '/' . $this->encode($params['index']) . '/_shrink/' . $this->encode($params['target']); |
|
1977 | + $url = '/'.$this->encode($params['index']).'/_shrink/'.$this->encode($params['target']); |
|
1978 | 1978 | $method = 'PUT'; |
1979 | 1979 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
1980 | 1980 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -2011,7 +2011,7 @@ discard block |
||
2011 | 2011 | public function simulateIndexTemplate(array $params = []) |
2012 | 2012 | { |
2013 | 2013 | $this->checkRequiredParameters(['name'], $params); |
2014 | - $url = '/_index_template/_simulate_index/' . $this->encode($params['name']); |
|
2014 | + $url = '/_index_template/_simulate_index/'.$this->encode($params['name']); |
|
2015 | 2015 | $method = 'POST'; |
2016 | 2016 | $url = $this->addQueryString($url, $params, ['create', 'cause', 'master_timeout', 'include_defaults', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
2017 | 2017 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -2047,7 +2047,7 @@ discard block |
||
2047 | 2047 | public function simulateTemplate(array $params = []) |
2048 | 2048 | { |
2049 | 2049 | if (isset($params['name'])) { |
2050 | - $url = '/_index_template/_simulate/' . $this->encode($params['name']); |
|
2050 | + $url = '/_index_template/_simulate/'.$this->encode($params['name']); |
|
2051 | 2051 | $method = 'POST'; |
2052 | 2052 | } else { |
2053 | 2053 | $url = '/_index_template/_simulate'; |
@@ -2088,7 +2088,7 @@ discard block |
||
2088 | 2088 | public function split(array $params = []) |
2089 | 2089 | { |
2090 | 2090 | $this->checkRequiredParameters(['index', 'target'], $params); |
2091 | - $url = '/' . $this->encode($params['index']) . '/_split/' . $this->encode($params['target']); |
|
2091 | + $url = '/'.$this->encode($params['index']).'/_split/'.$this->encode($params['target']); |
|
2092 | 2092 | $method = 'PUT'; |
2093 | 2093 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
2094 | 2094 | $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
@@ -2129,13 +2129,13 @@ discard block |
||
2129 | 2129 | public function stats(array $params = []) |
2130 | 2130 | { |
2131 | 2131 | if (isset($params['index']) && isset($params['metric'])) { |
2132 | - $url = '/' . $this->encode($params['index']) . '/_stats/' . $this->encode($params['metric']); |
|
2132 | + $url = '/'.$this->encode($params['index']).'/_stats/'.$this->encode($params['metric']); |
|
2133 | 2133 | $method = 'GET'; |
2134 | 2134 | } elseif (isset($params['metric'])) { |
2135 | - $url = '/_stats/' . $this->encode($params['metric']); |
|
2135 | + $url = '/_stats/'.$this->encode($params['metric']); |
|
2136 | 2136 | $method = 'GET'; |
2137 | 2137 | } elseif (isset($params['index'])) { |
2138 | - $url = '/' . $this->encode($params['index']) . '/_stats'; |
|
2138 | + $url = '/'.$this->encode($params['index']).'/_stats'; |
|
2139 | 2139 | $method = 'GET'; |
2140 | 2140 | } else { |
2141 | 2141 | $url = '/_stats'; |
@@ -2177,7 +2177,7 @@ discard block |
||
2177 | 2177 | public function unfreeze(array $params = []) |
2178 | 2178 | { |
2179 | 2179 | $this->checkRequiredParameters(['index'], $params); |
2180 | - $url = '/' . $this->encode($params['index']) . '/_unfreeze'; |
|
2180 | + $url = '/'.$this->encode($params['index']).'/_unfreeze'; |
|
2181 | 2181 | $method = 'POST'; |
2182 | 2182 | $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'wait_for_active_shards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
2183 | 2183 | $headers = ['Accept' => 'application/json']; |
@@ -2254,7 +2254,7 @@ discard block |
||
2254 | 2254 | public function validateQuery(array $params = []) |
2255 | 2255 | { |
2256 | 2256 | if (isset($params['index'])) { |
2257 | - $url = '/' . $this->encode($params['index']) . '/_validate/query'; |
|
2257 | + $url = '/'.$this->encode($params['index']).'/_validate/query'; |
|
2258 | 2258 | $method = empty($params['body']) ? 'GET' : 'POST'; |
2259 | 2259 | } else { |
2260 | 2260 | $url = '/_validate/query'; |
@@ -25,39 +25,39 @@ |
||
25 | 25 | */ |
26 | 26 | class Graph extends AbstractEndpoint |
27 | 27 | { |
28 | - /** |
|
29 | - * Explore extracted and summarized information about the documents and terms in an index. |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html |
|
32 | - * |
|
33 | - * @param array{ |
|
34 | - * index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
35 | - * routing: string, // Specific routing value |
|
36 | - * timeout: time, // Explicit operation timeout |
|
37 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
38 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
39 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
40 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
41 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
42 | - * body: array, // Graph Query DSL |
|
43 | - * } $params |
|
44 | - * |
|
45 | - * @throws MissingParameterException if a required parameter is missing |
|
46 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
47 | - * @throws ClientResponseException if the status code of response is 4xx |
|
48 | - * @throws ServerResponseException if the status code of response is 5xx |
|
49 | - * |
|
50 | - * @return Elasticsearch|Promise |
|
51 | - */ |
|
52 | - public function explore(array $params = []) |
|
53 | - { |
|
54 | - $this->checkRequiredParameters(['index'], $params); |
|
55 | - $url = '/' . $this->encode($params['index']) . '/_graph/explore'; |
|
56 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
57 | - $url = $this->addQueryString($url, $params, ['routing', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
58 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
59 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
60 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'graph.explore'); |
|
61 | - return $this->client->sendRequest($request); |
|
62 | - } |
|
28 | + /** |
|
29 | + * Explore extracted and summarized information about the documents and terms in an index. |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html |
|
32 | + * |
|
33 | + * @param array{ |
|
34 | + * index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
35 | + * routing: string, // Specific routing value |
|
36 | + * timeout: time, // Explicit operation timeout |
|
37 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
38 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
39 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
40 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
41 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
42 | + * body: array, // Graph Query DSL |
|
43 | + * } $params |
|
44 | + * |
|
45 | + * @throws MissingParameterException if a required parameter is missing |
|
46 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
47 | + * @throws ClientResponseException if the status code of response is 4xx |
|
48 | + * @throws ServerResponseException if the status code of response is 5xx |
|
49 | + * |
|
50 | + * @return Elasticsearch|Promise |
|
51 | + */ |
|
52 | + public function explore(array $params = []) |
|
53 | + { |
|
54 | + $this->checkRequiredParameters(['index'], $params); |
|
55 | + $url = '/' . $this->encode($params['index']) . '/_graph/explore'; |
|
56 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
57 | + $url = $this->addQueryString($url, $params, ['routing', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
58 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
59 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
60 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'graph.explore'); |
|
61 | + return $this->client->sendRequest($request); |
|
62 | + } |
|
63 | 63 | } |
@@ -25,104 +25,104 @@ |
||
25 | 25 | */ |
26 | 26 | class Logstash extends AbstractEndpoint |
27 | 27 | { |
28 | - /** |
|
29 | - * Deletes Logstash Pipelines used by Central Management |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/logstash-api-delete-pipeline.html |
|
32 | - * |
|
33 | - * @param array{ |
|
34 | - * id: string, // (REQUIRED) The ID of the Pipeline |
|
35 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
36 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
37 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
38 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
39 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
40 | - * } $params |
|
41 | - * |
|
42 | - * @throws MissingParameterException if a required parameter is missing |
|
43 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
44 | - * @throws ClientResponseException if the status code of response is 4xx |
|
45 | - * @throws ServerResponseException if the status code of response is 5xx |
|
46 | - * |
|
47 | - * @return Elasticsearch|Promise |
|
48 | - */ |
|
49 | - public function deletePipeline(array $params = []) |
|
50 | - { |
|
51 | - $this->checkRequiredParameters(['id'], $params); |
|
52 | - $url = '/_logstash/pipeline/' . $this->encode($params['id']); |
|
53 | - $method = 'DELETE'; |
|
54 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
55 | - $headers = ['Accept' => 'application/json']; |
|
56 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
57 | - $request = $this->addOtelAttributes($params, ['id'], $request, 'logstash.delete_pipeline'); |
|
58 | - return $this->client->sendRequest($request); |
|
59 | - } |
|
60 | - /** |
|
61 | - * Retrieves Logstash Pipelines used by Central Management |
|
62 | - * |
|
63 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/logstash-api-get-pipeline.html |
|
64 | - * |
|
65 | - * @param array{ |
|
66 | - * id: string, // A comma-separated list of Pipeline IDs |
|
67 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
68 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
69 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
70 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
71 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
72 | - * } $params |
|
73 | - * |
|
74 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
75 | - * @throws ClientResponseException if the status code of response is 4xx |
|
76 | - * @throws ServerResponseException if the status code of response is 5xx |
|
77 | - * |
|
78 | - * @return Elasticsearch|Promise |
|
79 | - */ |
|
80 | - public function getPipeline(array $params = []) |
|
81 | - { |
|
82 | - if (isset($params['id'])) { |
|
83 | - $url = '/_logstash/pipeline/' . $this->encode($params['id']); |
|
84 | - $method = 'GET'; |
|
85 | - } else { |
|
86 | - $url = '/_logstash/pipeline'; |
|
87 | - $method = 'GET'; |
|
88 | - } |
|
89 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
90 | - $headers = ['Accept' => 'application/json']; |
|
91 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
92 | - $request = $this->addOtelAttributes($params, ['id'], $request, 'logstash.get_pipeline'); |
|
93 | - return $this->client->sendRequest($request); |
|
94 | - } |
|
95 | - /** |
|
96 | - * Adds and updates Logstash Pipelines used for Central Management |
|
97 | - * |
|
98 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/logstash-api-put-pipeline.html |
|
99 | - * |
|
100 | - * @param array{ |
|
101 | - * id: string, // (REQUIRED) The ID of the Pipeline |
|
102 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
103 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
104 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
105 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
106 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
107 | - * body: array, // (REQUIRED) The Pipeline to add or update |
|
108 | - * } $params |
|
109 | - * |
|
110 | - * @throws MissingParameterException if a required parameter is missing |
|
111 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
112 | - * @throws ClientResponseException if the status code of response is 4xx |
|
113 | - * @throws ServerResponseException if the status code of response is 5xx |
|
114 | - * |
|
115 | - * @return Elasticsearch|Promise |
|
116 | - */ |
|
117 | - public function putPipeline(array $params = []) |
|
118 | - { |
|
119 | - $this->checkRequiredParameters(['id', 'body'], $params); |
|
120 | - $url = '/_logstash/pipeline/' . $this->encode($params['id']); |
|
121 | - $method = 'PUT'; |
|
122 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
123 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
124 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
125 | - $request = $this->addOtelAttributes($params, ['id'], $request, 'logstash.put_pipeline'); |
|
126 | - return $this->client->sendRequest($request); |
|
127 | - } |
|
28 | + /** |
|
29 | + * Deletes Logstash Pipelines used by Central Management |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/logstash-api-delete-pipeline.html |
|
32 | + * |
|
33 | + * @param array{ |
|
34 | + * id: string, // (REQUIRED) The ID of the Pipeline |
|
35 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
36 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
37 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
38 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
39 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
40 | + * } $params |
|
41 | + * |
|
42 | + * @throws MissingParameterException if a required parameter is missing |
|
43 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
44 | + * @throws ClientResponseException if the status code of response is 4xx |
|
45 | + * @throws ServerResponseException if the status code of response is 5xx |
|
46 | + * |
|
47 | + * @return Elasticsearch|Promise |
|
48 | + */ |
|
49 | + public function deletePipeline(array $params = []) |
|
50 | + { |
|
51 | + $this->checkRequiredParameters(['id'], $params); |
|
52 | + $url = '/_logstash/pipeline/' . $this->encode($params['id']); |
|
53 | + $method = 'DELETE'; |
|
54 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
55 | + $headers = ['Accept' => 'application/json']; |
|
56 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
57 | + $request = $this->addOtelAttributes($params, ['id'], $request, 'logstash.delete_pipeline'); |
|
58 | + return $this->client->sendRequest($request); |
|
59 | + } |
|
60 | + /** |
|
61 | + * Retrieves Logstash Pipelines used by Central Management |
|
62 | + * |
|
63 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/logstash-api-get-pipeline.html |
|
64 | + * |
|
65 | + * @param array{ |
|
66 | + * id: string, // A comma-separated list of Pipeline IDs |
|
67 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
68 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
69 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
70 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
71 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
72 | + * } $params |
|
73 | + * |
|
74 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
75 | + * @throws ClientResponseException if the status code of response is 4xx |
|
76 | + * @throws ServerResponseException if the status code of response is 5xx |
|
77 | + * |
|
78 | + * @return Elasticsearch|Promise |
|
79 | + */ |
|
80 | + public function getPipeline(array $params = []) |
|
81 | + { |
|
82 | + if (isset($params['id'])) { |
|
83 | + $url = '/_logstash/pipeline/' . $this->encode($params['id']); |
|
84 | + $method = 'GET'; |
|
85 | + } else { |
|
86 | + $url = '/_logstash/pipeline'; |
|
87 | + $method = 'GET'; |
|
88 | + } |
|
89 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
90 | + $headers = ['Accept' => 'application/json']; |
|
91 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
92 | + $request = $this->addOtelAttributes($params, ['id'], $request, 'logstash.get_pipeline'); |
|
93 | + return $this->client->sendRequest($request); |
|
94 | + } |
|
95 | + /** |
|
96 | + * Adds and updates Logstash Pipelines used for Central Management |
|
97 | + * |
|
98 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/logstash-api-put-pipeline.html |
|
99 | + * |
|
100 | + * @param array{ |
|
101 | + * id: string, // (REQUIRED) The ID of the Pipeline |
|
102 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
103 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
104 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
105 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
106 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
107 | + * body: array, // (REQUIRED) The Pipeline to add or update |
|
108 | + * } $params |
|
109 | + * |
|
110 | + * @throws MissingParameterException if a required parameter is missing |
|
111 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
112 | + * @throws ClientResponseException if the status code of response is 4xx |
|
113 | + * @throws ServerResponseException if the status code of response is 5xx |
|
114 | + * |
|
115 | + * @return Elasticsearch|Promise |
|
116 | + */ |
|
117 | + public function putPipeline(array $params = []) |
|
118 | + { |
|
119 | + $this->checkRequiredParameters(['id', 'body'], $params); |
|
120 | + $url = '/_logstash/pipeline/' . $this->encode($params['id']); |
|
121 | + $method = 'PUT'; |
|
122 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
123 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
124 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
125 | + $request = $this->addOtelAttributes($params, ['id'], $request, 'logstash.put_pipeline'); |
|
126 | + return $this->client->sendRequest($request); |
|
127 | + } |
|
128 | 128 | } |
@@ -25,419 +25,419 @@ |
||
25 | 25 | */ |
26 | 26 | class Transform extends AbstractEndpoint |
27 | 27 | { |
28 | - /** |
|
29 | - * Deletes an existing transform. |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-transform.html |
|
32 | - * |
|
33 | - * @param array{ |
|
34 | - * transform_id: string, // (REQUIRED) The id of the transform to delete |
|
35 | - * force: boolean, // When `true`, the transform is deleted regardless of its current state. The default value is `false`, meaning that the transform must be `stopped` before it can be deleted. |
|
36 | - * delete_dest_index: boolean, // When `true`, the destination index is deleted together with the transform. The default value is `false`, meaning that the destination index will not be deleted. |
|
37 | - * timeout: time, // Controls the time to wait for the transform deletion |
|
38 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
39 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
40 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
41 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
42 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
43 | - * } $params |
|
44 | - * |
|
45 | - * @throws MissingParameterException if a required parameter is missing |
|
46 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
47 | - * @throws ClientResponseException if the status code of response is 4xx |
|
48 | - * @throws ServerResponseException if the status code of response is 5xx |
|
49 | - * |
|
50 | - * @return Elasticsearch|Promise |
|
51 | - */ |
|
52 | - public function deleteTransform(array $params = []) |
|
53 | - { |
|
54 | - $this->checkRequiredParameters(['transform_id'], $params); |
|
55 | - $url = '/_transform/' . $this->encode($params['transform_id']); |
|
56 | - $method = 'DELETE'; |
|
57 | - $url = $this->addQueryString($url, $params, ['force', 'delete_dest_index', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
58 | - $headers = ['Accept' => 'application/json']; |
|
59 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
60 | - $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.delete_transform'); |
|
61 | - return $this->client->sendRequest($request); |
|
62 | - } |
|
63 | - /** |
|
64 | - * Retrieves transform usage information for transform nodes. |
|
65 | - * |
|
66 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform-node-stats.html |
|
67 | - * |
|
68 | - * @param array{ |
|
69 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
70 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
71 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
72 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
73 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
74 | - * } $params |
|
75 | - * |
|
76 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
77 | - * @throws ClientResponseException if the status code of response is 4xx |
|
78 | - * @throws ServerResponseException if the status code of response is 5xx |
|
79 | - * |
|
80 | - * @return Elasticsearch|Promise |
|
81 | - */ |
|
82 | - public function getNodeStats(array $params = []) |
|
83 | - { |
|
84 | - $url = '/_transform/_node_stats'; |
|
85 | - $method = 'GET'; |
|
86 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
87 | - $headers = ['Accept' => 'application/json']; |
|
88 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
89 | - $request = $this->addOtelAttributes($params, [], $request, 'transform.get_node_stats'); |
|
90 | - return $this->client->sendRequest($request); |
|
91 | - } |
|
92 | - /** |
|
93 | - * Retrieves configuration information for transforms. |
|
94 | - * |
|
95 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform.html |
|
96 | - * |
|
97 | - * @param array{ |
|
98 | - * transform_id: string, // The id or comma delimited list of id expressions of the transforms to get, '_all' or '*' implies get all transforms |
|
99 | - * from: int, // skips a number of transform configs, defaults to 0 |
|
100 | - * size: int, // specifies a max number of transforms to get, defaults to 100 |
|
101 | - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) |
|
102 | - * exclude_generated: boolean, // Omits fields that are illegal to set on transform PUT |
|
103 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
104 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
105 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
106 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
107 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
108 | - * } $params |
|
109 | - * |
|
110 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
111 | - * @throws ClientResponseException if the status code of response is 4xx |
|
112 | - * @throws ServerResponseException if the status code of response is 5xx |
|
113 | - * |
|
114 | - * @return Elasticsearch|Promise |
|
115 | - */ |
|
116 | - public function getTransform(array $params = []) |
|
117 | - { |
|
118 | - if (isset($params['transform_id'])) { |
|
119 | - $url = '/_transform/' . $this->encode($params['transform_id']); |
|
120 | - $method = 'GET'; |
|
121 | - } else { |
|
122 | - $url = '/_transform'; |
|
123 | - $method = 'GET'; |
|
124 | - } |
|
125 | - $url = $this->addQueryString($url, $params, ['from', 'size', 'allow_no_match', 'exclude_generated', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
126 | - $headers = ['Accept' => 'application/json']; |
|
127 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
128 | - $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.get_transform'); |
|
129 | - return $this->client->sendRequest($request); |
|
130 | - } |
|
131 | - /** |
|
132 | - * Retrieves usage information for transforms. |
|
133 | - * |
|
134 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform-stats.html |
|
135 | - * |
|
136 | - * @param array{ |
|
137 | - * transform_id: string, // (REQUIRED) The id of the transform for which to get stats. '_all' or '*' implies all transforms |
|
138 | - * from: number, // skips a number of transform stats, defaults to 0 |
|
139 | - * size: number, // specifies a max number of transform stats to get, defaults to 100 |
|
140 | - * timeout: time, // Controls the time to wait for the stats |
|
141 | - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) |
|
142 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
143 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
144 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
145 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
146 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
147 | - * } $params |
|
148 | - * |
|
149 | - * @throws MissingParameterException if a required parameter is missing |
|
150 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
151 | - * @throws ClientResponseException if the status code of response is 4xx |
|
152 | - * @throws ServerResponseException if the status code of response is 5xx |
|
153 | - * |
|
154 | - * @return Elasticsearch|Promise |
|
155 | - */ |
|
156 | - public function getTransformStats(array $params = []) |
|
157 | - { |
|
158 | - $this->checkRequiredParameters(['transform_id'], $params); |
|
159 | - $url = '/_transform/' . $this->encode($params['transform_id']) . '/_stats'; |
|
160 | - $method = 'GET'; |
|
161 | - $url = $this->addQueryString($url, $params, ['from', 'size', 'timeout', 'allow_no_match', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
162 | - $headers = ['Accept' => 'application/json']; |
|
163 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
164 | - $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.get_transform_stats'); |
|
165 | - return $this->client->sendRequest($request); |
|
166 | - } |
|
167 | - /** |
|
168 | - * Previews a transform. |
|
169 | - * |
|
170 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-transform.html |
|
171 | - * |
|
172 | - * @param array{ |
|
173 | - * transform_id: string, // The id of the transform to preview. |
|
174 | - * timeout: time, // Controls the time to wait for the preview |
|
175 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
176 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
177 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
178 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
179 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
180 | - * body: array, // The definition for the transform to preview |
|
181 | - * } $params |
|
182 | - * |
|
183 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
184 | - * @throws ClientResponseException if the status code of response is 4xx |
|
185 | - * @throws ServerResponseException if the status code of response is 5xx |
|
186 | - * |
|
187 | - * @return Elasticsearch|Promise |
|
188 | - */ |
|
189 | - public function previewTransform(array $params = []) |
|
190 | - { |
|
191 | - if (isset($params['transform_id'])) { |
|
192 | - $url = '/_transform/' . $this->encode($params['transform_id']) . '/_preview'; |
|
193 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
194 | - } else { |
|
195 | - $url = '/_transform/_preview'; |
|
196 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
197 | - } |
|
198 | - $url = $this->addQueryString($url, $params, ['timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
199 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
200 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
201 | - $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.preview_transform'); |
|
202 | - return $this->client->sendRequest($request); |
|
203 | - } |
|
204 | - /** |
|
205 | - * Instantiates a transform. |
|
206 | - * |
|
207 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/put-transform.html |
|
208 | - * |
|
209 | - * @param array{ |
|
210 | - * transform_id: string, // (REQUIRED) The id of the new transform. |
|
211 | - * defer_validation: boolean, // If validations should be deferred until transform starts, defaults to false. |
|
212 | - * timeout: time, // Controls the time to wait for the transform to start |
|
213 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
214 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
215 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
216 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
217 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
218 | - * body: array, // (REQUIRED) The transform definition |
|
219 | - * } $params |
|
220 | - * |
|
221 | - * @throws MissingParameterException if a required parameter is missing |
|
222 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
223 | - * @throws ClientResponseException if the status code of response is 4xx |
|
224 | - * @throws ServerResponseException if the status code of response is 5xx |
|
225 | - * |
|
226 | - * @return Elasticsearch|Promise |
|
227 | - */ |
|
228 | - public function putTransform(array $params = []) |
|
229 | - { |
|
230 | - $this->checkRequiredParameters(['transform_id', 'body'], $params); |
|
231 | - $url = '/_transform/' . $this->encode($params['transform_id']); |
|
232 | - $method = 'PUT'; |
|
233 | - $url = $this->addQueryString($url, $params, ['defer_validation', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
234 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
235 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
236 | - $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.put_transform'); |
|
237 | - return $this->client->sendRequest($request); |
|
238 | - } |
|
239 | - /** |
|
240 | - * Resets an existing transform. |
|
241 | - * |
|
242 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/reset-transform.html |
|
243 | - * |
|
244 | - * @param array{ |
|
245 | - * transform_id: string, // (REQUIRED) The id of the transform to reset |
|
246 | - * force: boolean, // When `true`, the transform is reset regardless of its current state. The default value is `false`, meaning that the transform must be `stopped` before it can be reset. |
|
247 | - * timeout: time, // Controls the time to wait for the transform to reset |
|
248 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
249 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
250 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
251 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
252 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
253 | - * } $params |
|
254 | - * |
|
255 | - * @throws MissingParameterException if a required parameter is missing |
|
256 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
257 | - * @throws ClientResponseException if the status code of response is 4xx |
|
258 | - * @throws ServerResponseException if the status code of response is 5xx |
|
259 | - * |
|
260 | - * @return Elasticsearch|Promise |
|
261 | - */ |
|
262 | - public function resetTransform(array $params = []) |
|
263 | - { |
|
264 | - $this->checkRequiredParameters(['transform_id'], $params); |
|
265 | - $url = '/_transform/' . $this->encode($params['transform_id']) . '/_reset'; |
|
266 | - $method = 'POST'; |
|
267 | - $url = $this->addQueryString($url, $params, ['force', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
268 | - $headers = ['Accept' => 'application/json']; |
|
269 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
270 | - $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.reset_transform'); |
|
271 | - return $this->client->sendRequest($request); |
|
272 | - } |
|
273 | - /** |
|
274 | - * Schedules now a transform. |
|
275 | - * |
|
276 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/schedule-now-transform.html |
|
277 | - * |
|
278 | - * @param array{ |
|
279 | - * transform_id: string, // (REQUIRED) The id of the transform. |
|
280 | - * timeout: time, // Controls the time to wait for the scheduling to take place |
|
281 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
282 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
283 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
284 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
285 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
286 | - * } $params |
|
287 | - * |
|
288 | - * @throws MissingParameterException if a required parameter is missing |
|
289 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
290 | - * @throws ClientResponseException if the status code of response is 4xx |
|
291 | - * @throws ServerResponseException if the status code of response is 5xx |
|
292 | - * |
|
293 | - * @return Elasticsearch|Promise |
|
294 | - */ |
|
295 | - public function scheduleNowTransform(array $params = []) |
|
296 | - { |
|
297 | - $this->checkRequiredParameters(['transform_id'], $params); |
|
298 | - $url = '/_transform/' . $this->encode($params['transform_id']) . '/_schedule_now'; |
|
299 | - $method = 'POST'; |
|
300 | - $url = $this->addQueryString($url, $params, ['timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
301 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
302 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
303 | - $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.schedule_now_transform'); |
|
304 | - return $this->client->sendRequest($request); |
|
305 | - } |
|
306 | - /** |
|
307 | - * Starts one or more transforms. |
|
308 | - * |
|
309 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/start-transform.html |
|
310 | - * |
|
311 | - * @param array{ |
|
312 | - * transform_id: string, // (REQUIRED) The id of the transform to start |
|
313 | - * from: string, // Restricts the set of transformed entities to those changed after this time |
|
314 | - * timeout: time, // Controls the time to wait for the transform to start |
|
315 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
316 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
317 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
318 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
319 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
320 | - * } $params |
|
321 | - * |
|
322 | - * @throws MissingParameterException if a required parameter is missing |
|
323 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
324 | - * @throws ClientResponseException if the status code of response is 4xx |
|
325 | - * @throws ServerResponseException if the status code of response is 5xx |
|
326 | - * |
|
327 | - * @return Elasticsearch|Promise |
|
328 | - */ |
|
329 | - public function startTransform(array $params = []) |
|
330 | - { |
|
331 | - $this->checkRequiredParameters(['transform_id'], $params); |
|
332 | - $url = '/_transform/' . $this->encode($params['transform_id']) . '/_start'; |
|
333 | - $method = 'POST'; |
|
334 | - $url = $this->addQueryString($url, $params, ['from', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
335 | - $headers = ['Accept' => 'application/json']; |
|
336 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
337 | - $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.start_transform'); |
|
338 | - return $this->client->sendRequest($request); |
|
339 | - } |
|
340 | - /** |
|
341 | - * Stops one or more transforms. |
|
342 | - * |
|
343 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-transform.html |
|
344 | - * |
|
345 | - * @param array{ |
|
346 | - * transform_id: string, // (REQUIRED) The id of the transform to stop |
|
347 | - * force: boolean, // Whether to force stop a failed transform or not. Default to false |
|
348 | - * wait_for_completion: boolean, // Whether to wait for the transform to fully stop before returning or not. Default to false |
|
349 | - * timeout: time, // Controls the time to wait until the transform has stopped. Default to 30 seconds |
|
350 | - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) |
|
351 | - * wait_for_checkpoint: boolean, // Whether to wait for the transform to reach a checkpoint before stopping. Default to false |
|
352 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
353 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
354 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
355 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
356 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
357 | - * } $params |
|
358 | - * |
|
359 | - * @throws MissingParameterException if a required parameter is missing |
|
360 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
361 | - * @throws ClientResponseException if the status code of response is 4xx |
|
362 | - * @throws ServerResponseException if the status code of response is 5xx |
|
363 | - * |
|
364 | - * @return Elasticsearch|Promise |
|
365 | - */ |
|
366 | - public function stopTransform(array $params = []) |
|
367 | - { |
|
368 | - $this->checkRequiredParameters(['transform_id'], $params); |
|
369 | - $url = '/_transform/' . $this->encode($params['transform_id']) . '/_stop'; |
|
370 | - $method = 'POST'; |
|
371 | - $url = $this->addQueryString($url, $params, ['force', 'wait_for_completion', 'timeout', 'allow_no_match', 'wait_for_checkpoint', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
372 | - $headers = ['Accept' => 'application/json']; |
|
373 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
374 | - $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.stop_transform'); |
|
375 | - return $this->client->sendRequest($request); |
|
376 | - } |
|
377 | - /** |
|
378 | - * Updates certain properties of a transform. |
|
379 | - * |
|
380 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/update-transform.html |
|
381 | - * |
|
382 | - * @param array{ |
|
383 | - * transform_id: string, // (REQUIRED) The id of the transform. |
|
384 | - * defer_validation: boolean, // If validations should be deferred until transform starts, defaults to false. |
|
385 | - * timeout: time, // Controls the time to wait for the update |
|
386 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
387 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
388 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
389 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
390 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
391 | - * body: array, // (REQUIRED) The update transform definition |
|
392 | - * } $params |
|
393 | - * |
|
394 | - * @throws MissingParameterException if a required parameter is missing |
|
395 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
396 | - * @throws ClientResponseException if the status code of response is 4xx |
|
397 | - * @throws ServerResponseException if the status code of response is 5xx |
|
398 | - * |
|
399 | - * @return Elasticsearch|Promise |
|
400 | - */ |
|
401 | - public function updateTransform(array $params = []) |
|
402 | - { |
|
403 | - $this->checkRequiredParameters(['transform_id', 'body'], $params); |
|
404 | - $url = '/_transform/' . $this->encode($params['transform_id']) . '/_update'; |
|
405 | - $method = 'POST'; |
|
406 | - $url = $this->addQueryString($url, $params, ['defer_validation', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
407 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
408 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
409 | - $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.update_transform'); |
|
410 | - return $this->client->sendRequest($request); |
|
411 | - } |
|
412 | - /** |
|
413 | - * Upgrades all transforms. |
|
414 | - * |
|
415 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/upgrade-transforms.html |
|
416 | - * |
|
417 | - * @param array{ |
|
418 | - * dry_run: boolean, // Whether to only check for updates but don't execute |
|
419 | - * timeout: time, // Controls the time to wait for the upgrade |
|
420 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
421 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
422 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
423 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
424 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
425 | - * } $params |
|
426 | - * |
|
427 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
428 | - * @throws ClientResponseException if the status code of response is 4xx |
|
429 | - * @throws ServerResponseException if the status code of response is 5xx |
|
430 | - * |
|
431 | - * @return Elasticsearch|Promise |
|
432 | - */ |
|
433 | - public function upgradeTransforms(array $params = []) |
|
434 | - { |
|
435 | - $url = '/_transform/_upgrade'; |
|
436 | - $method = 'POST'; |
|
437 | - $url = $this->addQueryString($url, $params, ['dry_run', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
438 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
439 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
440 | - $request = $this->addOtelAttributes($params, [], $request, 'transform.upgrade_transforms'); |
|
441 | - return $this->client->sendRequest($request); |
|
442 | - } |
|
28 | + /** |
|
29 | + * Deletes an existing transform. |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-transform.html |
|
32 | + * |
|
33 | + * @param array{ |
|
34 | + * transform_id: string, // (REQUIRED) The id of the transform to delete |
|
35 | + * force: boolean, // When `true`, the transform is deleted regardless of its current state. The default value is `false`, meaning that the transform must be `stopped` before it can be deleted. |
|
36 | + * delete_dest_index: boolean, // When `true`, the destination index is deleted together with the transform. The default value is `false`, meaning that the destination index will not be deleted. |
|
37 | + * timeout: time, // Controls the time to wait for the transform deletion |
|
38 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
39 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
40 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
41 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
42 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
43 | + * } $params |
|
44 | + * |
|
45 | + * @throws MissingParameterException if a required parameter is missing |
|
46 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
47 | + * @throws ClientResponseException if the status code of response is 4xx |
|
48 | + * @throws ServerResponseException if the status code of response is 5xx |
|
49 | + * |
|
50 | + * @return Elasticsearch|Promise |
|
51 | + */ |
|
52 | + public function deleteTransform(array $params = []) |
|
53 | + { |
|
54 | + $this->checkRequiredParameters(['transform_id'], $params); |
|
55 | + $url = '/_transform/' . $this->encode($params['transform_id']); |
|
56 | + $method = 'DELETE'; |
|
57 | + $url = $this->addQueryString($url, $params, ['force', 'delete_dest_index', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
58 | + $headers = ['Accept' => 'application/json']; |
|
59 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
60 | + $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.delete_transform'); |
|
61 | + return $this->client->sendRequest($request); |
|
62 | + } |
|
63 | + /** |
|
64 | + * Retrieves transform usage information for transform nodes. |
|
65 | + * |
|
66 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform-node-stats.html |
|
67 | + * |
|
68 | + * @param array{ |
|
69 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
70 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
71 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
72 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
73 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
74 | + * } $params |
|
75 | + * |
|
76 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
77 | + * @throws ClientResponseException if the status code of response is 4xx |
|
78 | + * @throws ServerResponseException if the status code of response is 5xx |
|
79 | + * |
|
80 | + * @return Elasticsearch|Promise |
|
81 | + */ |
|
82 | + public function getNodeStats(array $params = []) |
|
83 | + { |
|
84 | + $url = '/_transform/_node_stats'; |
|
85 | + $method = 'GET'; |
|
86 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
87 | + $headers = ['Accept' => 'application/json']; |
|
88 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
89 | + $request = $this->addOtelAttributes($params, [], $request, 'transform.get_node_stats'); |
|
90 | + return $this->client->sendRequest($request); |
|
91 | + } |
|
92 | + /** |
|
93 | + * Retrieves configuration information for transforms. |
|
94 | + * |
|
95 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform.html |
|
96 | + * |
|
97 | + * @param array{ |
|
98 | + * transform_id: string, // The id or comma delimited list of id expressions of the transforms to get, '_all' or '*' implies get all transforms |
|
99 | + * from: int, // skips a number of transform configs, defaults to 0 |
|
100 | + * size: int, // specifies a max number of transforms to get, defaults to 100 |
|
101 | + * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) |
|
102 | + * exclude_generated: boolean, // Omits fields that are illegal to set on transform PUT |
|
103 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
104 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
105 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
106 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
107 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
108 | + * } $params |
|
109 | + * |
|
110 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
111 | + * @throws ClientResponseException if the status code of response is 4xx |
|
112 | + * @throws ServerResponseException if the status code of response is 5xx |
|
113 | + * |
|
114 | + * @return Elasticsearch|Promise |
|
115 | + */ |
|
116 | + public function getTransform(array $params = []) |
|
117 | + { |
|
118 | + if (isset($params['transform_id'])) { |
|
119 | + $url = '/_transform/' . $this->encode($params['transform_id']); |
|
120 | + $method = 'GET'; |
|
121 | + } else { |
|
122 | + $url = '/_transform'; |
|
123 | + $method = 'GET'; |
|
124 | + } |
|
125 | + $url = $this->addQueryString($url, $params, ['from', 'size', 'allow_no_match', 'exclude_generated', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
126 | + $headers = ['Accept' => 'application/json']; |
|
127 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
128 | + $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.get_transform'); |
|
129 | + return $this->client->sendRequest($request); |
|
130 | + } |
|
131 | + /** |
|
132 | + * Retrieves usage information for transforms. |
|
133 | + * |
|
134 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform-stats.html |
|
135 | + * |
|
136 | + * @param array{ |
|
137 | + * transform_id: string, // (REQUIRED) The id of the transform for which to get stats. '_all' or '*' implies all transforms |
|
138 | + * from: number, // skips a number of transform stats, defaults to 0 |
|
139 | + * size: number, // specifies a max number of transform stats to get, defaults to 100 |
|
140 | + * timeout: time, // Controls the time to wait for the stats |
|
141 | + * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) |
|
142 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
143 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
144 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
145 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
146 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
147 | + * } $params |
|
148 | + * |
|
149 | + * @throws MissingParameterException if a required parameter is missing |
|
150 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
151 | + * @throws ClientResponseException if the status code of response is 4xx |
|
152 | + * @throws ServerResponseException if the status code of response is 5xx |
|
153 | + * |
|
154 | + * @return Elasticsearch|Promise |
|
155 | + */ |
|
156 | + public function getTransformStats(array $params = []) |
|
157 | + { |
|
158 | + $this->checkRequiredParameters(['transform_id'], $params); |
|
159 | + $url = '/_transform/' . $this->encode($params['transform_id']) . '/_stats'; |
|
160 | + $method = 'GET'; |
|
161 | + $url = $this->addQueryString($url, $params, ['from', 'size', 'timeout', 'allow_no_match', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
162 | + $headers = ['Accept' => 'application/json']; |
|
163 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
164 | + $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.get_transform_stats'); |
|
165 | + return $this->client->sendRequest($request); |
|
166 | + } |
|
167 | + /** |
|
168 | + * Previews a transform. |
|
169 | + * |
|
170 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-transform.html |
|
171 | + * |
|
172 | + * @param array{ |
|
173 | + * transform_id: string, // The id of the transform to preview. |
|
174 | + * timeout: time, // Controls the time to wait for the preview |
|
175 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
176 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
177 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
178 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
179 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
180 | + * body: array, // The definition for the transform to preview |
|
181 | + * } $params |
|
182 | + * |
|
183 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
184 | + * @throws ClientResponseException if the status code of response is 4xx |
|
185 | + * @throws ServerResponseException if the status code of response is 5xx |
|
186 | + * |
|
187 | + * @return Elasticsearch|Promise |
|
188 | + */ |
|
189 | + public function previewTransform(array $params = []) |
|
190 | + { |
|
191 | + if (isset($params['transform_id'])) { |
|
192 | + $url = '/_transform/' . $this->encode($params['transform_id']) . '/_preview'; |
|
193 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
194 | + } else { |
|
195 | + $url = '/_transform/_preview'; |
|
196 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
197 | + } |
|
198 | + $url = $this->addQueryString($url, $params, ['timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
199 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
200 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
201 | + $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.preview_transform'); |
|
202 | + return $this->client->sendRequest($request); |
|
203 | + } |
|
204 | + /** |
|
205 | + * Instantiates a transform. |
|
206 | + * |
|
207 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/put-transform.html |
|
208 | + * |
|
209 | + * @param array{ |
|
210 | + * transform_id: string, // (REQUIRED) The id of the new transform. |
|
211 | + * defer_validation: boolean, // If validations should be deferred until transform starts, defaults to false. |
|
212 | + * timeout: time, // Controls the time to wait for the transform to start |
|
213 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
214 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
215 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
216 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
217 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
218 | + * body: array, // (REQUIRED) The transform definition |
|
219 | + * } $params |
|
220 | + * |
|
221 | + * @throws MissingParameterException if a required parameter is missing |
|
222 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
223 | + * @throws ClientResponseException if the status code of response is 4xx |
|
224 | + * @throws ServerResponseException if the status code of response is 5xx |
|
225 | + * |
|
226 | + * @return Elasticsearch|Promise |
|
227 | + */ |
|
228 | + public function putTransform(array $params = []) |
|
229 | + { |
|
230 | + $this->checkRequiredParameters(['transform_id', 'body'], $params); |
|
231 | + $url = '/_transform/' . $this->encode($params['transform_id']); |
|
232 | + $method = 'PUT'; |
|
233 | + $url = $this->addQueryString($url, $params, ['defer_validation', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
234 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
235 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
236 | + $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.put_transform'); |
|
237 | + return $this->client->sendRequest($request); |
|
238 | + } |
|
239 | + /** |
|
240 | + * Resets an existing transform. |
|
241 | + * |
|
242 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/reset-transform.html |
|
243 | + * |
|
244 | + * @param array{ |
|
245 | + * transform_id: string, // (REQUIRED) The id of the transform to reset |
|
246 | + * force: boolean, // When `true`, the transform is reset regardless of its current state. The default value is `false`, meaning that the transform must be `stopped` before it can be reset. |
|
247 | + * timeout: time, // Controls the time to wait for the transform to reset |
|
248 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
249 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
250 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
251 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
252 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
253 | + * } $params |
|
254 | + * |
|
255 | + * @throws MissingParameterException if a required parameter is missing |
|
256 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
257 | + * @throws ClientResponseException if the status code of response is 4xx |
|
258 | + * @throws ServerResponseException if the status code of response is 5xx |
|
259 | + * |
|
260 | + * @return Elasticsearch|Promise |
|
261 | + */ |
|
262 | + public function resetTransform(array $params = []) |
|
263 | + { |
|
264 | + $this->checkRequiredParameters(['transform_id'], $params); |
|
265 | + $url = '/_transform/' . $this->encode($params['transform_id']) . '/_reset'; |
|
266 | + $method = 'POST'; |
|
267 | + $url = $this->addQueryString($url, $params, ['force', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
268 | + $headers = ['Accept' => 'application/json']; |
|
269 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
270 | + $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.reset_transform'); |
|
271 | + return $this->client->sendRequest($request); |
|
272 | + } |
|
273 | + /** |
|
274 | + * Schedules now a transform. |
|
275 | + * |
|
276 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/schedule-now-transform.html |
|
277 | + * |
|
278 | + * @param array{ |
|
279 | + * transform_id: string, // (REQUIRED) The id of the transform. |
|
280 | + * timeout: time, // Controls the time to wait for the scheduling to take place |
|
281 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
282 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
283 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
284 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
285 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
286 | + * } $params |
|
287 | + * |
|
288 | + * @throws MissingParameterException if a required parameter is missing |
|
289 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
290 | + * @throws ClientResponseException if the status code of response is 4xx |
|
291 | + * @throws ServerResponseException if the status code of response is 5xx |
|
292 | + * |
|
293 | + * @return Elasticsearch|Promise |
|
294 | + */ |
|
295 | + public function scheduleNowTransform(array $params = []) |
|
296 | + { |
|
297 | + $this->checkRequiredParameters(['transform_id'], $params); |
|
298 | + $url = '/_transform/' . $this->encode($params['transform_id']) . '/_schedule_now'; |
|
299 | + $method = 'POST'; |
|
300 | + $url = $this->addQueryString($url, $params, ['timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
301 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
302 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
303 | + $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.schedule_now_transform'); |
|
304 | + return $this->client->sendRequest($request); |
|
305 | + } |
|
306 | + /** |
|
307 | + * Starts one or more transforms. |
|
308 | + * |
|
309 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/start-transform.html |
|
310 | + * |
|
311 | + * @param array{ |
|
312 | + * transform_id: string, // (REQUIRED) The id of the transform to start |
|
313 | + * from: string, // Restricts the set of transformed entities to those changed after this time |
|
314 | + * timeout: time, // Controls the time to wait for the transform to start |
|
315 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
316 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
317 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
318 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
319 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
320 | + * } $params |
|
321 | + * |
|
322 | + * @throws MissingParameterException if a required parameter is missing |
|
323 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
324 | + * @throws ClientResponseException if the status code of response is 4xx |
|
325 | + * @throws ServerResponseException if the status code of response is 5xx |
|
326 | + * |
|
327 | + * @return Elasticsearch|Promise |
|
328 | + */ |
|
329 | + public function startTransform(array $params = []) |
|
330 | + { |
|
331 | + $this->checkRequiredParameters(['transform_id'], $params); |
|
332 | + $url = '/_transform/' . $this->encode($params['transform_id']) . '/_start'; |
|
333 | + $method = 'POST'; |
|
334 | + $url = $this->addQueryString($url, $params, ['from', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
335 | + $headers = ['Accept' => 'application/json']; |
|
336 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
337 | + $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.start_transform'); |
|
338 | + return $this->client->sendRequest($request); |
|
339 | + } |
|
340 | + /** |
|
341 | + * Stops one or more transforms. |
|
342 | + * |
|
343 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-transform.html |
|
344 | + * |
|
345 | + * @param array{ |
|
346 | + * transform_id: string, // (REQUIRED) The id of the transform to stop |
|
347 | + * force: boolean, // Whether to force stop a failed transform or not. Default to false |
|
348 | + * wait_for_completion: boolean, // Whether to wait for the transform to fully stop before returning or not. Default to false |
|
349 | + * timeout: time, // Controls the time to wait until the transform has stopped. Default to 30 seconds |
|
350 | + * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) |
|
351 | + * wait_for_checkpoint: boolean, // Whether to wait for the transform to reach a checkpoint before stopping. Default to false |
|
352 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
353 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
354 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
355 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
356 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
357 | + * } $params |
|
358 | + * |
|
359 | + * @throws MissingParameterException if a required parameter is missing |
|
360 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
361 | + * @throws ClientResponseException if the status code of response is 4xx |
|
362 | + * @throws ServerResponseException if the status code of response is 5xx |
|
363 | + * |
|
364 | + * @return Elasticsearch|Promise |
|
365 | + */ |
|
366 | + public function stopTransform(array $params = []) |
|
367 | + { |
|
368 | + $this->checkRequiredParameters(['transform_id'], $params); |
|
369 | + $url = '/_transform/' . $this->encode($params['transform_id']) . '/_stop'; |
|
370 | + $method = 'POST'; |
|
371 | + $url = $this->addQueryString($url, $params, ['force', 'wait_for_completion', 'timeout', 'allow_no_match', 'wait_for_checkpoint', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
372 | + $headers = ['Accept' => 'application/json']; |
|
373 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
374 | + $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.stop_transform'); |
|
375 | + return $this->client->sendRequest($request); |
|
376 | + } |
|
377 | + /** |
|
378 | + * Updates certain properties of a transform. |
|
379 | + * |
|
380 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/update-transform.html |
|
381 | + * |
|
382 | + * @param array{ |
|
383 | + * transform_id: string, // (REQUIRED) The id of the transform. |
|
384 | + * defer_validation: boolean, // If validations should be deferred until transform starts, defaults to false. |
|
385 | + * timeout: time, // Controls the time to wait for the update |
|
386 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
387 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
388 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
389 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
390 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
391 | + * body: array, // (REQUIRED) The update transform definition |
|
392 | + * } $params |
|
393 | + * |
|
394 | + * @throws MissingParameterException if a required parameter is missing |
|
395 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
396 | + * @throws ClientResponseException if the status code of response is 4xx |
|
397 | + * @throws ServerResponseException if the status code of response is 5xx |
|
398 | + * |
|
399 | + * @return Elasticsearch|Promise |
|
400 | + */ |
|
401 | + public function updateTransform(array $params = []) |
|
402 | + { |
|
403 | + $this->checkRequiredParameters(['transform_id', 'body'], $params); |
|
404 | + $url = '/_transform/' . $this->encode($params['transform_id']) . '/_update'; |
|
405 | + $method = 'POST'; |
|
406 | + $url = $this->addQueryString($url, $params, ['defer_validation', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
407 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
408 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
409 | + $request = $this->addOtelAttributes($params, ['transform_id'], $request, 'transform.update_transform'); |
|
410 | + return $this->client->sendRequest($request); |
|
411 | + } |
|
412 | + /** |
|
413 | + * Upgrades all transforms. |
|
414 | + * |
|
415 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/upgrade-transforms.html |
|
416 | + * |
|
417 | + * @param array{ |
|
418 | + * dry_run: boolean, // Whether to only check for updates but don't execute |
|
419 | + * timeout: time, // Controls the time to wait for the upgrade |
|
420 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
421 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
422 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
423 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
424 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
425 | + * } $params |
|
426 | + * |
|
427 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
428 | + * @throws ClientResponseException if the status code of response is 4xx |
|
429 | + * @throws ServerResponseException if the status code of response is 5xx |
|
430 | + * |
|
431 | + * @return Elasticsearch|Promise |
|
432 | + */ |
|
433 | + public function upgradeTransforms(array $params = []) |
|
434 | + { |
|
435 | + $url = '/_transform/_upgrade'; |
|
436 | + $method = 'POST'; |
|
437 | + $url = $this->addQueryString($url, $params, ['dry_run', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
438 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
439 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
440 | + $request = $this->addOtelAttributes($params, [], $request, 'transform.upgrade_transforms'); |
|
441 | + return $this->client->sendRequest($request); |
|
442 | + } |
|
443 | 443 | } |
@@ -25,433 +25,433 @@ |
||
25 | 25 | */ |
26 | 26 | class Watcher extends AbstractEndpoint |
27 | 27 | { |
28 | - /** |
|
29 | - * Acknowledges a watch, manually throttling the execution of the watch's actions. |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html |
|
32 | - * |
|
33 | - * @param array{ |
|
34 | - * watch_id: string, // (REQUIRED) Watch ID |
|
35 | - * action_id: list, // A comma-separated list of the action ids to be acked |
|
36 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
37 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
38 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
39 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
40 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
41 | - * } $params |
|
42 | - * |
|
43 | - * @throws MissingParameterException if a required parameter is missing |
|
44 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
45 | - * @throws ClientResponseException if the status code of response is 4xx |
|
46 | - * @throws ServerResponseException if the status code of response is 5xx |
|
47 | - * |
|
48 | - * @return Elasticsearch|Promise |
|
49 | - */ |
|
50 | - public function ackWatch(array $params = []) |
|
51 | - { |
|
52 | - $this->checkRequiredParameters(['watch_id'], $params); |
|
53 | - if (isset($params['action_id'])) { |
|
54 | - $url = '/_watcher/watch/' . $this->encode($params['watch_id']) . '/_ack/' . $this->encode($params['action_id']); |
|
55 | - $method = 'PUT'; |
|
56 | - } else { |
|
57 | - $url = '/_watcher/watch/' . $this->encode($params['watch_id']) . '/_ack'; |
|
58 | - $method = 'PUT'; |
|
59 | - } |
|
60 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
61 | - $headers = ['Accept' => 'application/json']; |
|
62 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
63 | - $request = $this->addOtelAttributes($params, ['watch_id', 'action_id'], $request, 'watcher.ack_watch'); |
|
64 | - return $this->client->sendRequest($request); |
|
65 | - } |
|
66 | - /** |
|
67 | - * Activates a currently inactive watch. |
|
68 | - * |
|
69 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html |
|
70 | - * |
|
71 | - * @param array{ |
|
72 | - * watch_id: string, // (REQUIRED) Watch ID |
|
73 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
74 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
75 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
76 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
77 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
78 | - * } $params |
|
79 | - * |
|
80 | - * @throws MissingParameterException if a required parameter is missing |
|
81 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
82 | - * @throws ClientResponseException if the status code of response is 4xx |
|
83 | - * @throws ServerResponseException if the status code of response is 5xx |
|
84 | - * |
|
85 | - * @return Elasticsearch|Promise |
|
86 | - */ |
|
87 | - public function activateWatch(array $params = []) |
|
88 | - { |
|
89 | - $this->checkRequiredParameters(['watch_id'], $params); |
|
90 | - $url = '/_watcher/watch/' . $this->encode($params['watch_id']) . '/_activate'; |
|
91 | - $method = 'PUT'; |
|
92 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
93 | - $headers = ['Accept' => 'application/json']; |
|
94 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
95 | - $request = $this->addOtelAttributes($params, ['watch_id'], $request, 'watcher.activate_watch'); |
|
96 | - return $this->client->sendRequest($request); |
|
97 | - } |
|
98 | - /** |
|
99 | - * Deactivates a currently active watch. |
|
100 | - * |
|
101 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html |
|
102 | - * |
|
103 | - * @param array{ |
|
104 | - * watch_id: string, // (REQUIRED) Watch ID |
|
105 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
106 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
107 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
108 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
109 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
110 | - * } $params |
|
111 | - * |
|
112 | - * @throws MissingParameterException if a required parameter is missing |
|
113 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
114 | - * @throws ClientResponseException if the status code of response is 4xx |
|
115 | - * @throws ServerResponseException if the status code of response is 5xx |
|
116 | - * |
|
117 | - * @return Elasticsearch|Promise |
|
118 | - */ |
|
119 | - public function deactivateWatch(array $params = []) |
|
120 | - { |
|
121 | - $this->checkRequiredParameters(['watch_id'], $params); |
|
122 | - $url = '/_watcher/watch/' . $this->encode($params['watch_id']) . '/_deactivate'; |
|
123 | - $method = 'PUT'; |
|
124 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
125 | - $headers = ['Accept' => 'application/json']; |
|
126 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
127 | - $request = $this->addOtelAttributes($params, ['watch_id'], $request, 'watcher.deactivate_watch'); |
|
128 | - return $this->client->sendRequest($request); |
|
129 | - } |
|
130 | - /** |
|
131 | - * Removes a watch from Watcher. |
|
132 | - * |
|
133 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html |
|
134 | - * |
|
135 | - * @param array{ |
|
136 | - * id: string, // (REQUIRED) Watch ID |
|
137 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
138 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
139 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
140 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
141 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
142 | - * } $params |
|
143 | - * |
|
144 | - * @throws MissingParameterException if a required parameter is missing |
|
145 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
146 | - * @throws ClientResponseException if the status code of response is 4xx |
|
147 | - * @throws ServerResponseException if the status code of response is 5xx |
|
148 | - * |
|
149 | - * @return Elasticsearch|Promise |
|
150 | - */ |
|
151 | - public function deleteWatch(array $params = []) |
|
152 | - { |
|
153 | - $this->checkRequiredParameters(['id'], $params); |
|
154 | - $url = '/_watcher/watch/' . $this->encode($params['id']); |
|
155 | - $method = 'DELETE'; |
|
156 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
157 | - $headers = ['Accept' => 'application/json']; |
|
158 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
159 | - $request = $this->addOtelAttributes($params, ['id'], $request, 'watcher.delete_watch'); |
|
160 | - return $this->client->sendRequest($request); |
|
161 | - } |
|
162 | - /** |
|
163 | - * Forces the execution of a stored watch. |
|
164 | - * |
|
165 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html |
|
166 | - * |
|
167 | - * @param array{ |
|
168 | - * id: string, // Watch ID |
|
169 | - * debug: boolean, // indicates whether the watch should execute in debug mode |
|
170 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
171 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
172 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
173 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
174 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
175 | - * body: array, // Execution control |
|
176 | - * } $params |
|
177 | - * |
|
178 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
179 | - * @throws ClientResponseException if the status code of response is 4xx |
|
180 | - * @throws ServerResponseException if the status code of response is 5xx |
|
181 | - * |
|
182 | - * @return Elasticsearch|Promise |
|
183 | - */ |
|
184 | - public function executeWatch(array $params = []) |
|
185 | - { |
|
186 | - if (isset($params['id'])) { |
|
187 | - $url = '/_watcher/watch/' . $this->encode($params['id']) . '/_execute'; |
|
188 | - $method = 'PUT'; |
|
189 | - } else { |
|
190 | - $url = '/_watcher/watch/_execute'; |
|
191 | - $method = 'PUT'; |
|
192 | - } |
|
193 | - $url = $this->addQueryString($url, $params, ['debug', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
194 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
195 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
196 | - $request = $this->addOtelAttributes($params, ['id'], $request, 'watcher.execute_watch'); |
|
197 | - return $this->client->sendRequest($request); |
|
198 | - } |
|
199 | - /** |
|
200 | - * Retrieve settings for the watcher system index |
|
201 | - * |
|
202 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-settings.html |
|
203 | - * |
|
204 | - * @param array{ |
|
205 | - * master_timeout: time, // Specify timeout for connection to master |
|
206 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
207 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
208 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
209 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
210 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
211 | - * } $params |
|
212 | - * |
|
213 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
214 | - * @throws ClientResponseException if the status code of response is 4xx |
|
215 | - * @throws ServerResponseException if the status code of response is 5xx |
|
216 | - * |
|
217 | - * @return Elasticsearch|Promise |
|
218 | - */ |
|
219 | - public function getSettings(array $params = []) |
|
220 | - { |
|
221 | - $url = '/_watcher/settings'; |
|
222 | - $method = 'GET'; |
|
223 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
224 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
225 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
226 | - $request = $this->addOtelAttributes($params, [], $request, 'watcher.get_settings'); |
|
227 | - return $this->client->sendRequest($request); |
|
228 | - } |
|
229 | - /** |
|
230 | - * Retrieves a watch by its ID. |
|
231 | - * |
|
232 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html |
|
233 | - * |
|
234 | - * @param array{ |
|
235 | - * id: string, // (REQUIRED) Watch ID |
|
236 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
237 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
238 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
239 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
240 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
241 | - * } $params |
|
242 | - * |
|
243 | - * @throws MissingParameterException if a required parameter is missing |
|
244 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
245 | - * @throws ClientResponseException if the status code of response is 4xx |
|
246 | - * @throws ServerResponseException if the status code of response is 5xx |
|
247 | - * |
|
248 | - * @return Elasticsearch|Promise |
|
249 | - */ |
|
250 | - public function getWatch(array $params = []) |
|
251 | - { |
|
252 | - $this->checkRequiredParameters(['id'], $params); |
|
253 | - $url = '/_watcher/watch/' . $this->encode($params['id']); |
|
254 | - $method = 'GET'; |
|
255 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
256 | - $headers = ['Accept' => 'application/json']; |
|
257 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
258 | - $request = $this->addOtelAttributes($params, ['id'], $request, 'watcher.get_watch'); |
|
259 | - return $this->client->sendRequest($request); |
|
260 | - } |
|
261 | - /** |
|
262 | - * Creates a new watch, or updates an existing one. |
|
263 | - * |
|
264 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html |
|
265 | - * |
|
266 | - * @param array{ |
|
267 | - * id: string, // (REQUIRED) Watch ID |
|
268 | - * active: boolean, // Specify whether the watch is in/active by default |
|
269 | - * version: number, // Explicit version number for concurrency control |
|
270 | - * if_seq_no: number, // only update the watch if the last operation that has changed the watch has the specified sequence number |
|
271 | - * if_primary_term: number, // only update the watch if the last operation that has changed the watch has the specified primary term |
|
272 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
273 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
274 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
275 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
276 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
277 | - * body: array, // The watch |
|
278 | - * } $params |
|
279 | - * |
|
280 | - * @throws MissingParameterException if a required parameter is missing |
|
281 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
282 | - * @throws ClientResponseException if the status code of response is 4xx |
|
283 | - * @throws ServerResponseException if the status code of response is 5xx |
|
284 | - * |
|
285 | - * @return Elasticsearch|Promise |
|
286 | - */ |
|
287 | - public function putWatch(array $params = []) |
|
288 | - { |
|
289 | - $this->checkRequiredParameters(['id'], $params); |
|
290 | - $url = '/_watcher/watch/' . $this->encode($params['id']); |
|
291 | - $method = 'PUT'; |
|
292 | - $url = $this->addQueryString($url, $params, ['active', 'version', 'if_seq_no', 'if_primary_term', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
293 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
294 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
295 | - $request = $this->addOtelAttributes($params, ['id'], $request, 'watcher.put_watch'); |
|
296 | - return $this->client->sendRequest($request); |
|
297 | - } |
|
298 | - /** |
|
299 | - * Retrieves stored watches. |
|
300 | - * |
|
301 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-query-watches.html |
|
302 | - * |
|
303 | - * @param array{ |
|
304 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
305 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
306 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
307 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
308 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
309 | - * body: array, // From, size, query, sort and search_after |
|
310 | - * } $params |
|
311 | - * |
|
312 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
313 | - * @throws ClientResponseException if the status code of response is 4xx |
|
314 | - * @throws ServerResponseException if the status code of response is 5xx |
|
315 | - * |
|
316 | - * @return Elasticsearch|Promise |
|
317 | - */ |
|
318 | - public function queryWatches(array $params = []) |
|
319 | - { |
|
320 | - $url = '/_watcher/_query/watches'; |
|
321 | - $method = empty($params['body']) ? 'GET' : 'POST'; |
|
322 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
323 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
324 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
325 | - $request = $this->addOtelAttributes($params, [], $request, 'watcher.query_watches'); |
|
326 | - return $this->client->sendRequest($request); |
|
327 | - } |
|
328 | - /** |
|
329 | - * Starts Watcher if it is not already running. |
|
330 | - * |
|
331 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html |
|
332 | - * |
|
333 | - * @param array{ |
|
334 | - * master_timeout: time, // Specify timeout for connection to master |
|
335 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
336 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
337 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
338 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
339 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
340 | - * } $params |
|
341 | - * |
|
342 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
343 | - * @throws ClientResponseException if the status code of response is 4xx |
|
344 | - * @throws ServerResponseException if the status code of response is 5xx |
|
345 | - * |
|
346 | - * @return Elasticsearch|Promise |
|
347 | - */ |
|
348 | - public function start(array $params = []) |
|
349 | - { |
|
350 | - $url = '/_watcher/_start'; |
|
351 | - $method = 'POST'; |
|
352 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
353 | - $headers = ['Accept' => 'application/json']; |
|
354 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
355 | - $request = $this->addOtelAttributes($params, [], $request, 'watcher.start'); |
|
356 | - return $this->client->sendRequest($request); |
|
357 | - } |
|
358 | - /** |
|
359 | - * Retrieves the current Watcher metrics. |
|
360 | - * |
|
361 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html |
|
362 | - * |
|
363 | - * @param array{ |
|
364 | - * metric: list, // Controls what additional stat metrics should be include in the response |
|
365 | - * emit_stacktraces: boolean, // Emits stack traces of currently running watches |
|
366 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
367 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
368 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
369 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
370 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
371 | - * } $params |
|
372 | - * |
|
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 stats(array $params = []) |
|
380 | - { |
|
381 | - if (isset($params['metric'])) { |
|
382 | - $url = '/_watcher/stats/' . $this->encode($params['metric']); |
|
383 | - $method = 'GET'; |
|
384 | - } else { |
|
385 | - $url = '/_watcher/stats'; |
|
386 | - $method = 'GET'; |
|
387 | - } |
|
388 | - $url = $this->addQueryString($url, $params, ['emit_stacktraces', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
389 | - $headers = ['Accept' => 'application/json']; |
|
390 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
391 | - $request = $this->addOtelAttributes($params, ['metric'], $request, 'watcher.stats'); |
|
392 | - return $this->client->sendRequest($request); |
|
393 | - } |
|
394 | - /** |
|
395 | - * Stops Watcher if it is running. |
|
396 | - * |
|
397 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html |
|
398 | - * |
|
399 | - * @param array{ |
|
400 | - * master_timeout: time, // Specify timeout for connection to master |
|
401 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
402 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
403 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
404 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
405 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
406 | - * } $params |
|
407 | - * |
|
408 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
409 | - * @throws ClientResponseException if the status code of response is 4xx |
|
410 | - * @throws ServerResponseException if the status code of response is 5xx |
|
411 | - * |
|
412 | - * @return Elasticsearch|Promise |
|
413 | - */ |
|
414 | - public function stop(array $params = []) |
|
415 | - { |
|
416 | - $url = '/_watcher/_stop'; |
|
417 | - $method = 'POST'; |
|
418 | - $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
419 | - $headers = ['Accept' => 'application/json']; |
|
420 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
421 | - $request = $this->addOtelAttributes($params, [], $request, 'watcher.stop'); |
|
422 | - return $this->client->sendRequest($request); |
|
423 | - } |
|
424 | - /** |
|
425 | - * Update settings for the watcher system index |
|
426 | - * |
|
427 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-update-settings.html |
|
428 | - * |
|
429 | - * @param array{ |
|
430 | - * timeout: time, // Specify timeout for waiting for acknowledgement from all nodes |
|
431 | - * master_timeout: time, // Specify timeout for connection to master |
|
432 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
433 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
434 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
435 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
436 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
437 | - * body: array, // (REQUIRED) An object with the new index settings |
|
438 | - * } $params |
|
439 | - * |
|
440 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
441 | - * @throws ClientResponseException if the status code of response is 4xx |
|
442 | - * @throws ServerResponseException if the status code of response is 5xx |
|
443 | - * |
|
444 | - * @return Elasticsearch|Promise |
|
445 | - */ |
|
446 | - public function updateSettings(array $params = []) |
|
447 | - { |
|
448 | - $this->checkRequiredParameters(['body'], $params); |
|
449 | - $url = '/_watcher/settings'; |
|
450 | - $method = 'PUT'; |
|
451 | - $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
452 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
453 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
454 | - $request = $this->addOtelAttributes($params, [], $request, 'watcher.update_settings'); |
|
455 | - return $this->client->sendRequest($request); |
|
456 | - } |
|
28 | + /** |
|
29 | + * Acknowledges a watch, manually throttling the execution of the watch's actions. |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html |
|
32 | + * |
|
33 | + * @param array{ |
|
34 | + * watch_id: string, // (REQUIRED) Watch ID |
|
35 | + * action_id: list, // A comma-separated list of the action ids to be acked |
|
36 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
37 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
38 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
39 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
40 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
41 | + * } $params |
|
42 | + * |
|
43 | + * @throws MissingParameterException if a required parameter is missing |
|
44 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
45 | + * @throws ClientResponseException if the status code of response is 4xx |
|
46 | + * @throws ServerResponseException if the status code of response is 5xx |
|
47 | + * |
|
48 | + * @return Elasticsearch|Promise |
|
49 | + */ |
|
50 | + public function ackWatch(array $params = []) |
|
51 | + { |
|
52 | + $this->checkRequiredParameters(['watch_id'], $params); |
|
53 | + if (isset($params['action_id'])) { |
|
54 | + $url = '/_watcher/watch/' . $this->encode($params['watch_id']) . '/_ack/' . $this->encode($params['action_id']); |
|
55 | + $method = 'PUT'; |
|
56 | + } else { |
|
57 | + $url = '/_watcher/watch/' . $this->encode($params['watch_id']) . '/_ack'; |
|
58 | + $method = 'PUT'; |
|
59 | + } |
|
60 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
61 | + $headers = ['Accept' => 'application/json']; |
|
62 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
63 | + $request = $this->addOtelAttributes($params, ['watch_id', 'action_id'], $request, 'watcher.ack_watch'); |
|
64 | + return $this->client->sendRequest($request); |
|
65 | + } |
|
66 | + /** |
|
67 | + * Activates a currently inactive watch. |
|
68 | + * |
|
69 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html |
|
70 | + * |
|
71 | + * @param array{ |
|
72 | + * watch_id: string, // (REQUIRED) Watch ID |
|
73 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
74 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
75 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
76 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
77 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
78 | + * } $params |
|
79 | + * |
|
80 | + * @throws MissingParameterException if a required parameter is missing |
|
81 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
82 | + * @throws ClientResponseException if the status code of response is 4xx |
|
83 | + * @throws ServerResponseException if the status code of response is 5xx |
|
84 | + * |
|
85 | + * @return Elasticsearch|Promise |
|
86 | + */ |
|
87 | + public function activateWatch(array $params = []) |
|
88 | + { |
|
89 | + $this->checkRequiredParameters(['watch_id'], $params); |
|
90 | + $url = '/_watcher/watch/' . $this->encode($params['watch_id']) . '/_activate'; |
|
91 | + $method = 'PUT'; |
|
92 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
93 | + $headers = ['Accept' => 'application/json']; |
|
94 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
95 | + $request = $this->addOtelAttributes($params, ['watch_id'], $request, 'watcher.activate_watch'); |
|
96 | + return $this->client->sendRequest($request); |
|
97 | + } |
|
98 | + /** |
|
99 | + * Deactivates a currently active watch. |
|
100 | + * |
|
101 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html |
|
102 | + * |
|
103 | + * @param array{ |
|
104 | + * watch_id: string, // (REQUIRED) Watch ID |
|
105 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
106 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
107 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
108 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
109 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
110 | + * } $params |
|
111 | + * |
|
112 | + * @throws MissingParameterException if a required parameter is missing |
|
113 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
114 | + * @throws ClientResponseException if the status code of response is 4xx |
|
115 | + * @throws ServerResponseException if the status code of response is 5xx |
|
116 | + * |
|
117 | + * @return Elasticsearch|Promise |
|
118 | + */ |
|
119 | + public function deactivateWatch(array $params = []) |
|
120 | + { |
|
121 | + $this->checkRequiredParameters(['watch_id'], $params); |
|
122 | + $url = '/_watcher/watch/' . $this->encode($params['watch_id']) . '/_deactivate'; |
|
123 | + $method = 'PUT'; |
|
124 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
125 | + $headers = ['Accept' => 'application/json']; |
|
126 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
127 | + $request = $this->addOtelAttributes($params, ['watch_id'], $request, 'watcher.deactivate_watch'); |
|
128 | + return $this->client->sendRequest($request); |
|
129 | + } |
|
130 | + /** |
|
131 | + * Removes a watch from Watcher. |
|
132 | + * |
|
133 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html |
|
134 | + * |
|
135 | + * @param array{ |
|
136 | + * id: string, // (REQUIRED) Watch ID |
|
137 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
138 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
139 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
140 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
141 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
142 | + * } $params |
|
143 | + * |
|
144 | + * @throws MissingParameterException if a required parameter is missing |
|
145 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
146 | + * @throws ClientResponseException if the status code of response is 4xx |
|
147 | + * @throws ServerResponseException if the status code of response is 5xx |
|
148 | + * |
|
149 | + * @return Elasticsearch|Promise |
|
150 | + */ |
|
151 | + public function deleteWatch(array $params = []) |
|
152 | + { |
|
153 | + $this->checkRequiredParameters(['id'], $params); |
|
154 | + $url = '/_watcher/watch/' . $this->encode($params['id']); |
|
155 | + $method = 'DELETE'; |
|
156 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
157 | + $headers = ['Accept' => 'application/json']; |
|
158 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
159 | + $request = $this->addOtelAttributes($params, ['id'], $request, 'watcher.delete_watch'); |
|
160 | + return $this->client->sendRequest($request); |
|
161 | + } |
|
162 | + /** |
|
163 | + * Forces the execution of a stored watch. |
|
164 | + * |
|
165 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html |
|
166 | + * |
|
167 | + * @param array{ |
|
168 | + * id: string, // Watch ID |
|
169 | + * debug: boolean, // indicates whether the watch should execute in debug mode |
|
170 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
171 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
172 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
173 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
174 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
175 | + * body: array, // Execution control |
|
176 | + * } $params |
|
177 | + * |
|
178 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
179 | + * @throws ClientResponseException if the status code of response is 4xx |
|
180 | + * @throws ServerResponseException if the status code of response is 5xx |
|
181 | + * |
|
182 | + * @return Elasticsearch|Promise |
|
183 | + */ |
|
184 | + public function executeWatch(array $params = []) |
|
185 | + { |
|
186 | + if (isset($params['id'])) { |
|
187 | + $url = '/_watcher/watch/' . $this->encode($params['id']) . '/_execute'; |
|
188 | + $method = 'PUT'; |
|
189 | + } else { |
|
190 | + $url = '/_watcher/watch/_execute'; |
|
191 | + $method = 'PUT'; |
|
192 | + } |
|
193 | + $url = $this->addQueryString($url, $params, ['debug', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
194 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
195 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
196 | + $request = $this->addOtelAttributes($params, ['id'], $request, 'watcher.execute_watch'); |
|
197 | + return $this->client->sendRequest($request); |
|
198 | + } |
|
199 | + /** |
|
200 | + * Retrieve settings for the watcher system index |
|
201 | + * |
|
202 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-settings.html |
|
203 | + * |
|
204 | + * @param array{ |
|
205 | + * master_timeout: time, // Specify timeout for connection to master |
|
206 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
207 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
208 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
209 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
210 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
211 | + * } $params |
|
212 | + * |
|
213 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
214 | + * @throws ClientResponseException if the status code of response is 4xx |
|
215 | + * @throws ServerResponseException if the status code of response is 5xx |
|
216 | + * |
|
217 | + * @return Elasticsearch|Promise |
|
218 | + */ |
|
219 | + public function getSettings(array $params = []) |
|
220 | + { |
|
221 | + $url = '/_watcher/settings'; |
|
222 | + $method = 'GET'; |
|
223 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
224 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
225 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
226 | + $request = $this->addOtelAttributes($params, [], $request, 'watcher.get_settings'); |
|
227 | + return $this->client->sendRequest($request); |
|
228 | + } |
|
229 | + /** |
|
230 | + * Retrieves a watch by its ID. |
|
231 | + * |
|
232 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html |
|
233 | + * |
|
234 | + * @param array{ |
|
235 | + * id: string, // (REQUIRED) Watch ID |
|
236 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
237 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
238 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
239 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
240 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
241 | + * } $params |
|
242 | + * |
|
243 | + * @throws MissingParameterException if a required parameter is missing |
|
244 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
245 | + * @throws ClientResponseException if the status code of response is 4xx |
|
246 | + * @throws ServerResponseException if the status code of response is 5xx |
|
247 | + * |
|
248 | + * @return Elasticsearch|Promise |
|
249 | + */ |
|
250 | + public function getWatch(array $params = []) |
|
251 | + { |
|
252 | + $this->checkRequiredParameters(['id'], $params); |
|
253 | + $url = '/_watcher/watch/' . $this->encode($params['id']); |
|
254 | + $method = 'GET'; |
|
255 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
256 | + $headers = ['Accept' => 'application/json']; |
|
257 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
258 | + $request = $this->addOtelAttributes($params, ['id'], $request, 'watcher.get_watch'); |
|
259 | + return $this->client->sendRequest($request); |
|
260 | + } |
|
261 | + /** |
|
262 | + * Creates a new watch, or updates an existing one. |
|
263 | + * |
|
264 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html |
|
265 | + * |
|
266 | + * @param array{ |
|
267 | + * id: string, // (REQUIRED) Watch ID |
|
268 | + * active: boolean, // Specify whether the watch is in/active by default |
|
269 | + * version: number, // Explicit version number for concurrency control |
|
270 | + * if_seq_no: number, // only update the watch if the last operation that has changed the watch has the specified sequence number |
|
271 | + * if_primary_term: number, // only update the watch if the last operation that has changed the watch has the specified primary term |
|
272 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
273 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
274 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
275 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
276 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
277 | + * body: array, // The watch |
|
278 | + * } $params |
|
279 | + * |
|
280 | + * @throws MissingParameterException if a required parameter is missing |
|
281 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
282 | + * @throws ClientResponseException if the status code of response is 4xx |
|
283 | + * @throws ServerResponseException if the status code of response is 5xx |
|
284 | + * |
|
285 | + * @return Elasticsearch|Promise |
|
286 | + */ |
|
287 | + public function putWatch(array $params = []) |
|
288 | + { |
|
289 | + $this->checkRequiredParameters(['id'], $params); |
|
290 | + $url = '/_watcher/watch/' . $this->encode($params['id']); |
|
291 | + $method = 'PUT'; |
|
292 | + $url = $this->addQueryString($url, $params, ['active', 'version', 'if_seq_no', 'if_primary_term', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
293 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
294 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
295 | + $request = $this->addOtelAttributes($params, ['id'], $request, 'watcher.put_watch'); |
|
296 | + return $this->client->sendRequest($request); |
|
297 | + } |
|
298 | + /** |
|
299 | + * Retrieves stored watches. |
|
300 | + * |
|
301 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-query-watches.html |
|
302 | + * |
|
303 | + * @param array{ |
|
304 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
305 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
306 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
307 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
308 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
309 | + * body: array, // From, size, query, sort and search_after |
|
310 | + * } $params |
|
311 | + * |
|
312 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
313 | + * @throws ClientResponseException if the status code of response is 4xx |
|
314 | + * @throws ServerResponseException if the status code of response is 5xx |
|
315 | + * |
|
316 | + * @return Elasticsearch|Promise |
|
317 | + */ |
|
318 | + public function queryWatches(array $params = []) |
|
319 | + { |
|
320 | + $url = '/_watcher/_query/watches'; |
|
321 | + $method = empty($params['body']) ? 'GET' : 'POST'; |
|
322 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
323 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
324 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
325 | + $request = $this->addOtelAttributes($params, [], $request, 'watcher.query_watches'); |
|
326 | + return $this->client->sendRequest($request); |
|
327 | + } |
|
328 | + /** |
|
329 | + * Starts Watcher if it is not already running. |
|
330 | + * |
|
331 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html |
|
332 | + * |
|
333 | + * @param array{ |
|
334 | + * master_timeout: time, // Specify timeout for connection to master |
|
335 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
336 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
337 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
338 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
339 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
340 | + * } $params |
|
341 | + * |
|
342 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
343 | + * @throws ClientResponseException if the status code of response is 4xx |
|
344 | + * @throws ServerResponseException if the status code of response is 5xx |
|
345 | + * |
|
346 | + * @return Elasticsearch|Promise |
|
347 | + */ |
|
348 | + public function start(array $params = []) |
|
349 | + { |
|
350 | + $url = '/_watcher/_start'; |
|
351 | + $method = 'POST'; |
|
352 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
353 | + $headers = ['Accept' => 'application/json']; |
|
354 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
355 | + $request = $this->addOtelAttributes($params, [], $request, 'watcher.start'); |
|
356 | + return $this->client->sendRequest($request); |
|
357 | + } |
|
358 | + /** |
|
359 | + * Retrieves the current Watcher metrics. |
|
360 | + * |
|
361 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html |
|
362 | + * |
|
363 | + * @param array{ |
|
364 | + * metric: list, // Controls what additional stat metrics should be include in the response |
|
365 | + * emit_stacktraces: boolean, // Emits stack traces of currently running watches |
|
366 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
367 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
368 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
369 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
370 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
371 | + * } $params |
|
372 | + * |
|
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 stats(array $params = []) |
|
380 | + { |
|
381 | + if (isset($params['metric'])) { |
|
382 | + $url = '/_watcher/stats/' . $this->encode($params['metric']); |
|
383 | + $method = 'GET'; |
|
384 | + } else { |
|
385 | + $url = '/_watcher/stats'; |
|
386 | + $method = 'GET'; |
|
387 | + } |
|
388 | + $url = $this->addQueryString($url, $params, ['emit_stacktraces', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
389 | + $headers = ['Accept' => 'application/json']; |
|
390 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
391 | + $request = $this->addOtelAttributes($params, ['metric'], $request, 'watcher.stats'); |
|
392 | + return $this->client->sendRequest($request); |
|
393 | + } |
|
394 | + /** |
|
395 | + * Stops Watcher if it is running. |
|
396 | + * |
|
397 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html |
|
398 | + * |
|
399 | + * @param array{ |
|
400 | + * master_timeout: time, // Specify timeout for connection to master |
|
401 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
402 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
403 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
404 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
405 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
406 | + * } $params |
|
407 | + * |
|
408 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
409 | + * @throws ClientResponseException if the status code of response is 4xx |
|
410 | + * @throws ServerResponseException if the status code of response is 5xx |
|
411 | + * |
|
412 | + * @return Elasticsearch|Promise |
|
413 | + */ |
|
414 | + public function stop(array $params = []) |
|
415 | + { |
|
416 | + $url = '/_watcher/_stop'; |
|
417 | + $method = 'POST'; |
|
418 | + $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
419 | + $headers = ['Accept' => 'application/json']; |
|
420 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
421 | + $request = $this->addOtelAttributes($params, [], $request, 'watcher.stop'); |
|
422 | + return $this->client->sendRequest($request); |
|
423 | + } |
|
424 | + /** |
|
425 | + * Update settings for the watcher system index |
|
426 | + * |
|
427 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-update-settings.html |
|
428 | + * |
|
429 | + * @param array{ |
|
430 | + * timeout: time, // Specify timeout for waiting for acknowledgement from all nodes |
|
431 | + * master_timeout: time, // Specify timeout for connection to master |
|
432 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
433 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
434 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
435 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
436 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
437 | + * body: array, // (REQUIRED) An object with the new index settings |
|
438 | + * } $params |
|
439 | + * |
|
440 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
441 | + * @throws ClientResponseException if the status code of response is 4xx |
|
442 | + * @throws ServerResponseException if the status code of response is 5xx |
|
443 | + * |
|
444 | + * @return Elasticsearch|Promise |
|
445 | + */ |
|
446 | + public function updateSettings(array $params = []) |
|
447 | + { |
|
448 | + $this->checkRequiredParameters(['body'], $params); |
|
449 | + $url = '/_watcher/settings'; |
|
450 | + $method = 'PUT'; |
|
451 | + $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
452 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
453 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
454 | + $request = $this->addOtelAttributes($params, [], $request, 'watcher.update_settings'); |
|
455 | + return $this->client->sendRequest($request); |
|
456 | + } |
|
457 | 457 | } |
@@ -25,205 +25,205 @@ |
||
25 | 25 | */ |
26 | 26 | class Inference extends AbstractEndpoint |
27 | 27 | { |
28 | - /** |
|
29 | - * Delete an inference endpoint |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-inference-api.html |
|
32 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
33 | - * |
|
34 | - * @param array{ |
|
35 | - * inference_id: string, // (REQUIRED) The inference Id |
|
36 | - * task_type: string, // The task type |
|
37 | - * dry_run: boolean, // If true the endpoint will not be deleted and a list of ingest processors which reference this endpoint will be returned. |
|
38 | - * force: boolean, // If true the endpoint will be forcefully stopped (regardless of whether or not it is referenced by any ingest processors or semantic text fields). |
|
39 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
40 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
41 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
42 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
43 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
44 | - * } $params |
|
45 | - * |
|
46 | - * @throws MissingParameterException if a required parameter is missing |
|
47 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
48 | - * @throws ClientResponseException if the status code of response is 4xx |
|
49 | - * @throws ServerResponseException if the status code of response is 5xx |
|
50 | - * |
|
51 | - * @return Elasticsearch|Promise |
|
52 | - */ |
|
53 | - public function delete(array $params = []) |
|
54 | - { |
|
55 | - $this->checkRequiredParameters(['inference_id'], $params); |
|
56 | - if (isset($params['task_type'])) { |
|
57 | - $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); |
|
58 | - $method = 'DELETE'; |
|
59 | - } else { |
|
60 | - $url = '/_inference/' . $this->encode($params['inference_id']); |
|
61 | - $method = 'DELETE'; |
|
62 | - } |
|
63 | - $url = $this->addQueryString($url, $params, ['dry_run', 'force', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
64 | - $headers = ['Accept' => 'application/json']; |
|
65 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
66 | - $request = $this->addOtelAttributes($params, ['inference_id', 'task_type'], $request, 'inference.delete'); |
|
67 | - return $this->client->sendRequest($request); |
|
68 | - } |
|
69 | - /** |
|
70 | - * Get an inference endpoint |
|
71 | - * |
|
72 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-inference-api.html |
|
73 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
74 | - * |
|
75 | - * @param array{ |
|
76 | - * inference_id: string, // The inference Id |
|
77 | - * task_type: string, // The task type |
|
78 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
79 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
80 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
81 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
82 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
83 | - * } $params |
|
84 | - * |
|
85 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
86 | - * @throws ClientResponseException if the status code of response is 4xx |
|
87 | - * @throws ServerResponseException if the status code of response is 5xx |
|
88 | - * |
|
89 | - * @return Elasticsearch|Promise |
|
90 | - */ |
|
91 | - public function get(array $params = []) |
|
92 | - { |
|
93 | - if (isset($params['task_type']) && isset($params['inference_id'])) { |
|
94 | - $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); |
|
95 | - $method = 'GET'; |
|
96 | - } elseif (isset($params['inference_id'])) { |
|
97 | - $url = '/_inference/' . $this->encode($params['inference_id']); |
|
98 | - $method = 'GET'; |
|
99 | - } else { |
|
100 | - $url = '/_inference'; |
|
101 | - $method = 'GET'; |
|
102 | - } |
|
103 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
104 | - $headers = ['Accept' => 'application/json']; |
|
105 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
106 | - $request = $this->addOtelAttributes($params, ['inference_id', 'task_type'], $request, 'inference.get'); |
|
107 | - return $this->client->sendRequest($request); |
|
108 | - } |
|
109 | - /** |
|
110 | - * Perform inference |
|
111 | - * |
|
112 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/post-inference-api.html |
|
113 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
114 | - * |
|
115 | - * @param array{ |
|
116 | - * inference_id: string, // (REQUIRED) The inference Id |
|
117 | - * task_type: string, // The task type |
|
118 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
119 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
120 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
121 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
122 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
123 | - * body: array, // The inference payload |
|
124 | - * } $params |
|
125 | - * |
|
126 | - * @throws MissingParameterException if a required parameter is missing |
|
127 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
128 | - * @throws ClientResponseException if the status code of response is 4xx |
|
129 | - * @throws ServerResponseException if the status code of response is 5xx |
|
130 | - * |
|
131 | - * @return Elasticsearch|Promise |
|
132 | - */ |
|
133 | - public function inference(array $params = []) |
|
134 | - { |
|
135 | - $this->checkRequiredParameters(['inference_id'], $params); |
|
136 | - if (isset($params['task_type'])) { |
|
137 | - $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); |
|
138 | - $method = 'POST'; |
|
139 | - } else { |
|
140 | - $url = '/_inference/' . $this->encode($params['inference_id']); |
|
141 | - $method = 'POST'; |
|
142 | - } |
|
143 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
144 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
145 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
146 | - $request = $this->addOtelAttributes($params, ['inference_id', 'task_type'], $request, 'inference.inference'); |
|
147 | - return $this->client->sendRequest($request); |
|
148 | - } |
|
149 | - /** |
|
150 | - * Configure an inference endpoint for use in the Inference API |
|
151 | - * |
|
152 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-inference-api.html |
|
153 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
154 | - * |
|
155 | - * @param array{ |
|
156 | - * inference_id: string, // (REQUIRED) The inference Id |
|
157 | - * task_type: string, // The task type |
|
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, // The inference endpoint's task and service settings |
|
164 | - * } $params |
|
165 | - * |
|
166 | - * @throws MissingParameterException if a required parameter is missing |
|
167 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
168 | - * @throws ClientResponseException if the status code of response is 4xx |
|
169 | - * @throws ServerResponseException if the status code of response is 5xx |
|
170 | - * |
|
171 | - * @return Elasticsearch|Promise |
|
172 | - */ |
|
173 | - public function put(array $params = []) |
|
174 | - { |
|
175 | - $this->checkRequiredParameters(['inference_id'], $params); |
|
176 | - if (isset($params['task_type'])) { |
|
177 | - $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); |
|
178 | - $method = 'PUT'; |
|
179 | - } else { |
|
180 | - $url = '/_inference/' . $this->encode($params['inference_id']); |
|
181 | - $method = 'PUT'; |
|
182 | - } |
|
183 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
184 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
185 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
186 | - $request = $this->addOtelAttributes($params, ['inference_id', 'task_type'], $request, 'inference.put'); |
|
187 | - return $this->client->sendRequest($request); |
|
188 | - } |
|
189 | - /** |
|
190 | - * Perform streaming inference |
|
191 | - * |
|
192 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/post-stream-inference-api.html |
|
193 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
194 | - * |
|
195 | - * @param array{ |
|
196 | - * inference_id: string, // (REQUIRED) The inference Id |
|
197 | - * task_type: string, // The task type |
|
198 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
199 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
200 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
201 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
202 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
203 | - * body: array, // The inference payload |
|
204 | - * } $params |
|
205 | - * |
|
206 | - * @throws MissingParameterException if a required parameter is missing |
|
207 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
208 | - * @throws ClientResponseException if the status code of response is 4xx |
|
209 | - * @throws ServerResponseException if the status code of response is 5xx |
|
210 | - * |
|
211 | - * @return Elasticsearch|Promise |
|
212 | - */ |
|
213 | - public function streamInference(array $params = []) |
|
214 | - { |
|
215 | - $this->checkRequiredParameters(['inference_id'], $params); |
|
216 | - if (isset($params['task_type'])) { |
|
217 | - $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']) . '/_stream'; |
|
218 | - $method = 'POST'; |
|
219 | - } else { |
|
220 | - $url = '/_inference/' . $this->encode($params['inference_id']) . '/_stream'; |
|
221 | - $method = 'POST'; |
|
222 | - } |
|
223 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
224 | - $headers = ['Accept' => 'text/event-stream', 'Content-Type' => 'application/json']; |
|
225 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
226 | - $request = $this->addOtelAttributes($params, ['inference_id', 'task_type'], $request, 'inference.stream_inference'); |
|
227 | - return $this->client->sendRequest($request); |
|
228 | - } |
|
28 | + /** |
|
29 | + * Delete an inference endpoint |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-inference-api.html |
|
32 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
33 | + * |
|
34 | + * @param array{ |
|
35 | + * inference_id: string, // (REQUIRED) The inference Id |
|
36 | + * task_type: string, // The task type |
|
37 | + * dry_run: boolean, // If true the endpoint will not be deleted and a list of ingest processors which reference this endpoint will be returned. |
|
38 | + * force: boolean, // If true the endpoint will be forcefully stopped (regardless of whether or not it is referenced by any ingest processors or semantic text fields). |
|
39 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
40 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
41 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
42 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
43 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
44 | + * } $params |
|
45 | + * |
|
46 | + * @throws MissingParameterException if a required parameter is missing |
|
47 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
48 | + * @throws ClientResponseException if the status code of response is 4xx |
|
49 | + * @throws ServerResponseException if the status code of response is 5xx |
|
50 | + * |
|
51 | + * @return Elasticsearch|Promise |
|
52 | + */ |
|
53 | + public function delete(array $params = []) |
|
54 | + { |
|
55 | + $this->checkRequiredParameters(['inference_id'], $params); |
|
56 | + if (isset($params['task_type'])) { |
|
57 | + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); |
|
58 | + $method = 'DELETE'; |
|
59 | + } else { |
|
60 | + $url = '/_inference/' . $this->encode($params['inference_id']); |
|
61 | + $method = 'DELETE'; |
|
62 | + } |
|
63 | + $url = $this->addQueryString($url, $params, ['dry_run', 'force', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
64 | + $headers = ['Accept' => 'application/json']; |
|
65 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
66 | + $request = $this->addOtelAttributes($params, ['inference_id', 'task_type'], $request, 'inference.delete'); |
|
67 | + return $this->client->sendRequest($request); |
|
68 | + } |
|
69 | + /** |
|
70 | + * Get an inference endpoint |
|
71 | + * |
|
72 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-inference-api.html |
|
73 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
74 | + * |
|
75 | + * @param array{ |
|
76 | + * inference_id: string, // The inference Id |
|
77 | + * task_type: string, // The task type |
|
78 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
79 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
80 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
81 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
82 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
83 | + * } $params |
|
84 | + * |
|
85 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
86 | + * @throws ClientResponseException if the status code of response is 4xx |
|
87 | + * @throws ServerResponseException if the status code of response is 5xx |
|
88 | + * |
|
89 | + * @return Elasticsearch|Promise |
|
90 | + */ |
|
91 | + public function get(array $params = []) |
|
92 | + { |
|
93 | + if (isset($params['task_type']) && isset($params['inference_id'])) { |
|
94 | + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); |
|
95 | + $method = 'GET'; |
|
96 | + } elseif (isset($params['inference_id'])) { |
|
97 | + $url = '/_inference/' . $this->encode($params['inference_id']); |
|
98 | + $method = 'GET'; |
|
99 | + } else { |
|
100 | + $url = '/_inference'; |
|
101 | + $method = 'GET'; |
|
102 | + } |
|
103 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
104 | + $headers = ['Accept' => 'application/json']; |
|
105 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
106 | + $request = $this->addOtelAttributes($params, ['inference_id', 'task_type'], $request, 'inference.get'); |
|
107 | + return $this->client->sendRequest($request); |
|
108 | + } |
|
109 | + /** |
|
110 | + * Perform inference |
|
111 | + * |
|
112 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/post-inference-api.html |
|
113 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
114 | + * |
|
115 | + * @param array{ |
|
116 | + * inference_id: string, // (REQUIRED) The inference Id |
|
117 | + * task_type: string, // The task type |
|
118 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
119 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
120 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
121 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
122 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
123 | + * body: array, // The inference payload |
|
124 | + * } $params |
|
125 | + * |
|
126 | + * @throws MissingParameterException if a required parameter is missing |
|
127 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
128 | + * @throws ClientResponseException if the status code of response is 4xx |
|
129 | + * @throws ServerResponseException if the status code of response is 5xx |
|
130 | + * |
|
131 | + * @return Elasticsearch|Promise |
|
132 | + */ |
|
133 | + public function inference(array $params = []) |
|
134 | + { |
|
135 | + $this->checkRequiredParameters(['inference_id'], $params); |
|
136 | + if (isset($params['task_type'])) { |
|
137 | + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); |
|
138 | + $method = 'POST'; |
|
139 | + } else { |
|
140 | + $url = '/_inference/' . $this->encode($params['inference_id']); |
|
141 | + $method = 'POST'; |
|
142 | + } |
|
143 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
144 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
145 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
146 | + $request = $this->addOtelAttributes($params, ['inference_id', 'task_type'], $request, 'inference.inference'); |
|
147 | + return $this->client->sendRequest($request); |
|
148 | + } |
|
149 | + /** |
|
150 | + * Configure an inference endpoint for use in the Inference API |
|
151 | + * |
|
152 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-inference-api.html |
|
153 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
154 | + * |
|
155 | + * @param array{ |
|
156 | + * inference_id: string, // (REQUIRED) The inference Id |
|
157 | + * task_type: string, // The task type |
|
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, // The inference endpoint's task and service settings |
|
164 | + * } $params |
|
165 | + * |
|
166 | + * @throws MissingParameterException if a required parameter is missing |
|
167 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
168 | + * @throws ClientResponseException if the status code of response is 4xx |
|
169 | + * @throws ServerResponseException if the status code of response is 5xx |
|
170 | + * |
|
171 | + * @return Elasticsearch|Promise |
|
172 | + */ |
|
173 | + public function put(array $params = []) |
|
174 | + { |
|
175 | + $this->checkRequiredParameters(['inference_id'], $params); |
|
176 | + if (isset($params['task_type'])) { |
|
177 | + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); |
|
178 | + $method = 'PUT'; |
|
179 | + } else { |
|
180 | + $url = '/_inference/' . $this->encode($params['inference_id']); |
|
181 | + $method = 'PUT'; |
|
182 | + } |
|
183 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
184 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
185 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
186 | + $request = $this->addOtelAttributes($params, ['inference_id', 'task_type'], $request, 'inference.put'); |
|
187 | + return $this->client->sendRequest($request); |
|
188 | + } |
|
189 | + /** |
|
190 | + * Perform streaming inference |
|
191 | + * |
|
192 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/post-stream-inference-api.html |
|
193 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
194 | + * |
|
195 | + * @param array{ |
|
196 | + * inference_id: string, // (REQUIRED) The inference Id |
|
197 | + * task_type: string, // The task type |
|
198 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
199 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
200 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
201 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
202 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
203 | + * body: array, // The inference payload |
|
204 | + * } $params |
|
205 | + * |
|
206 | + * @throws MissingParameterException if a required parameter is missing |
|
207 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
208 | + * @throws ClientResponseException if the status code of response is 4xx |
|
209 | + * @throws ServerResponseException if the status code of response is 5xx |
|
210 | + * |
|
211 | + * @return Elasticsearch|Promise |
|
212 | + */ |
|
213 | + public function streamInference(array $params = []) |
|
214 | + { |
|
215 | + $this->checkRequiredParameters(['inference_id'], $params); |
|
216 | + if (isset($params['task_type'])) { |
|
217 | + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']) . '/_stream'; |
|
218 | + $method = 'POST'; |
|
219 | + } else { |
|
220 | + $url = '/_inference/' . $this->encode($params['inference_id']) . '/_stream'; |
|
221 | + $method = 'POST'; |
|
222 | + } |
|
223 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
224 | + $headers = ['Accept' => 'text/event-stream', 'Content-Type' => 'application/json']; |
|
225 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
226 | + $request = $this->addOtelAttributes($params, ['inference_id', 'task_type'], $request, 'inference.stream_inference'); |
|
227 | + return $this->client->sendRequest($request); |
|
228 | + } |
|
229 | 229 | } |
@@ -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\Endpoints; |
16 | 16 | |
17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Exception\ClientResponseException; |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | { |
55 | 55 | $this->checkRequiredParameters(['inference_id'], $params); |
56 | 56 | if (isset($params['task_type'])) { |
57 | - $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); |
|
57 | + $url = '/_inference/'.$this->encode($params['task_type']).'/'.$this->encode($params['inference_id']); |
|
58 | 58 | $method = 'DELETE'; |
59 | 59 | } else { |
60 | - $url = '/_inference/' . $this->encode($params['inference_id']); |
|
60 | + $url = '/_inference/'.$this->encode($params['inference_id']); |
|
61 | 61 | $method = 'DELETE'; |
62 | 62 | } |
63 | 63 | $url = $this->addQueryString($url, $params, ['dry_run', 'force', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | public function get(array $params = []) |
92 | 92 | { |
93 | 93 | if (isset($params['task_type']) && isset($params['inference_id'])) { |
94 | - $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); |
|
94 | + $url = '/_inference/'.$this->encode($params['task_type']).'/'.$this->encode($params['inference_id']); |
|
95 | 95 | $method = 'GET'; |
96 | 96 | } elseif (isset($params['inference_id'])) { |
97 | - $url = '/_inference/' . $this->encode($params['inference_id']); |
|
97 | + $url = '/_inference/'.$this->encode($params['inference_id']); |
|
98 | 98 | $method = 'GET'; |
99 | 99 | } else { |
100 | 100 | $url = '/_inference'; |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | { |
135 | 135 | $this->checkRequiredParameters(['inference_id'], $params); |
136 | 136 | if (isset($params['task_type'])) { |
137 | - $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); |
|
137 | + $url = '/_inference/'.$this->encode($params['task_type']).'/'.$this->encode($params['inference_id']); |
|
138 | 138 | $method = 'POST'; |
139 | 139 | } else { |
140 | - $url = '/_inference/' . $this->encode($params['inference_id']); |
|
140 | + $url = '/_inference/'.$this->encode($params['inference_id']); |
|
141 | 141 | $method = 'POST'; |
142 | 142 | } |
143 | 143 | $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | { |
175 | 175 | $this->checkRequiredParameters(['inference_id'], $params); |
176 | 176 | if (isset($params['task_type'])) { |
177 | - $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); |
|
177 | + $url = '/_inference/'.$this->encode($params['task_type']).'/'.$this->encode($params['inference_id']); |
|
178 | 178 | $method = 'PUT'; |
179 | 179 | } else { |
180 | - $url = '/_inference/' . $this->encode($params['inference_id']); |
|
180 | + $url = '/_inference/'.$this->encode($params['inference_id']); |
|
181 | 181 | $method = 'PUT'; |
182 | 182 | } |
183 | 183 | $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | { |
215 | 215 | $this->checkRequiredParameters(['inference_id'], $params); |
216 | 216 | if (isset($params['task_type'])) { |
217 | - $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']) . '/_stream'; |
|
217 | + $url = '/_inference/'.$this->encode($params['task_type']).'/'.$this->encode($params['inference_id']).'/_stream'; |
|
218 | 218 | $method = 'POST'; |
219 | 219 | } else { |
220 | - $url = '/_inference/' . $this->encode($params['inference_id']) . '/_stream'; |
|
220 | + $url = '/_inference/'.$this->encode($params['inference_id']).'/_stream'; |
|
221 | 221 | $method = 'POST'; |
222 | 222 | } |
223 | 223 | $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
@@ -23,8 +23,7 @@ |
||
23 | 23 | /** |
24 | 24 | * @generated This file is generated, please do not edit |
25 | 25 | */ |
26 | -class Inference extends AbstractEndpoint |
|
27 | -{ |
|
26 | +class Inference extends AbstractEndpoint { |
|
28 | 27 | /** |
29 | 28 | * Delete an inference endpoint |
30 | 29 | * |
@@ -25,116 +25,116 @@ |
||
25 | 25 | */ |
26 | 26 | class Tasks extends AbstractEndpoint |
27 | 27 | { |
28 | - /** |
|
29 | - * Cancels a task, if it can be cancelled through an API. |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html |
|
32 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
33 | - * |
|
34 | - * @param array{ |
|
35 | - * task_id: string, // Cancel the task with specified task id (node_id:task_number) |
|
36 | - * nodes: list, // A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes |
|
37 | - * actions: list, // A comma-separated list of actions that should be cancelled. Leave empty to cancel all. |
|
38 | - * parent_task_id: string, // Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. |
|
39 | - * wait_for_completion: boolean, // Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false |
|
40 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
41 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
42 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
43 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
44 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
45 | - * } $params |
|
46 | - * |
|
47 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
48 | - * @throws ClientResponseException if the status code of response is 4xx |
|
49 | - * @throws ServerResponseException if the status code of response is 5xx |
|
50 | - * |
|
51 | - * @return Elasticsearch|Promise |
|
52 | - */ |
|
53 | - public function cancel(array $params = []) |
|
54 | - { |
|
55 | - if (isset($params['task_id'])) { |
|
56 | - $url = '/_tasks/' . $this->encode($params['task_id']) . '/_cancel'; |
|
57 | - $method = 'POST'; |
|
58 | - } else { |
|
59 | - $url = '/_tasks/_cancel'; |
|
60 | - $method = 'POST'; |
|
61 | - } |
|
62 | - $url = $this->addQueryString($url, $params, ['nodes', 'actions', 'parent_task_id', 'wait_for_completion', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
63 | - $headers = ['Accept' => 'application/json']; |
|
64 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
65 | - $request = $this->addOtelAttributes($params, ['task_id'], $request, 'tasks.cancel'); |
|
66 | - return $this->client->sendRequest($request); |
|
67 | - } |
|
68 | - /** |
|
69 | - * Returns information about a task. |
|
70 | - * |
|
71 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html |
|
72 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
73 | - * |
|
74 | - * @param array{ |
|
75 | - * task_id: string, // (REQUIRED) Return the task with specified id (node_id:task_number) |
|
76 | - * wait_for_completion: boolean, // Wait for the matching tasks to complete (default: false) |
|
77 | - * timeout: time, // Explicit operation timeout |
|
78 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
79 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
80 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
81 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
82 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
83 | - * } $params |
|
84 | - * |
|
85 | - * @throws MissingParameterException if a required parameter is missing |
|
86 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
87 | - * @throws ClientResponseException if the status code of response is 4xx |
|
88 | - * @throws ServerResponseException if the status code of response is 5xx |
|
89 | - * |
|
90 | - * @return Elasticsearch|Promise |
|
91 | - */ |
|
92 | - public function get(array $params = []) |
|
93 | - { |
|
94 | - $this->checkRequiredParameters(['task_id'], $params); |
|
95 | - $url = '/_tasks/' . $this->encode($params['task_id']); |
|
96 | - $method = 'GET'; |
|
97 | - $url = $this->addQueryString($url, $params, ['wait_for_completion', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
98 | - $headers = ['Accept' => 'application/json']; |
|
99 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
100 | - $request = $this->addOtelAttributes($params, ['task_id'], $request, 'tasks.get'); |
|
101 | - return $this->client->sendRequest($request); |
|
102 | - } |
|
103 | - /** |
|
104 | - * Returns a list of tasks. |
|
105 | - * |
|
106 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html |
|
107 | - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
108 | - * |
|
109 | - * @param array{ |
|
110 | - * nodes: list, // A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes |
|
111 | - * actions: list, // A comma-separated list of actions that should be returned. Leave empty to return all. |
|
112 | - * detailed: boolean, // Return detailed task information (default: false) |
|
113 | - * parent_task_id: string, // Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all. |
|
114 | - * wait_for_completion: boolean, // Wait for the matching tasks to complete (default: false) |
|
115 | - * group_by: enum, // Group tasks by nodes or parent/child relationships |
|
116 | - * timeout: time, // Explicit operation timeout |
|
117 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
118 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
119 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
120 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
121 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
122 | - * } $params |
|
123 | - * |
|
124 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
125 | - * @throws ClientResponseException if the status code of response is 4xx |
|
126 | - * @throws ServerResponseException if the status code of response is 5xx |
|
127 | - * |
|
128 | - * @return Elasticsearch|Promise |
|
129 | - */ |
|
130 | - public function list(array $params = []) |
|
131 | - { |
|
132 | - $url = '/_tasks'; |
|
133 | - $method = 'GET'; |
|
134 | - $url = $this->addQueryString($url, $params, ['nodes', 'actions', 'detailed', 'parent_task_id', 'wait_for_completion', 'group_by', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
135 | - $headers = ['Accept' => 'application/json']; |
|
136 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
137 | - $request = $this->addOtelAttributes($params, [], $request, 'tasks.list'); |
|
138 | - return $this->client->sendRequest($request); |
|
139 | - } |
|
28 | + /** |
|
29 | + * Cancels a task, if it can be cancelled through an API. |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html |
|
32 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
33 | + * |
|
34 | + * @param array{ |
|
35 | + * task_id: string, // Cancel the task with specified task id (node_id:task_number) |
|
36 | + * nodes: list, // A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes |
|
37 | + * actions: list, // A comma-separated list of actions that should be cancelled. Leave empty to cancel all. |
|
38 | + * parent_task_id: string, // Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. |
|
39 | + * wait_for_completion: boolean, // Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false |
|
40 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
41 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
42 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
43 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
44 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
45 | + * } $params |
|
46 | + * |
|
47 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
48 | + * @throws ClientResponseException if the status code of response is 4xx |
|
49 | + * @throws ServerResponseException if the status code of response is 5xx |
|
50 | + * |
|
51 | + * @return Elasticsearch|Promise |
|
52 | + */ |
|
53 | + public function cancel(array $params = []) |
|
54 | + { |
|
55 | + if (isset($params['task_id'])) { |
|
56 | + $url = '/_tasks/' . $this->encode($params['task_id']) . '/_cancel'; |
|
57 | + $method = 'POST'; |
|
58 | + } else { |
|
59 | + $url = '/_tasks/_cancel'; |
|
60 | + $method = 'POST'; |
|
61 | + } |
|
62 | + $url = $this->addQueryString($url, $params, ['nodes', 'actions', 'parent_task_id', 'wait_for_completion', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
63 | + $headers = ['Accept' => 'application/json']; |
|
64 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
65 | + $request = $this->addOtelAttributes($params, ['task_id'], $request, 'tasks.cancel'); |
|
66 | + return $this->client->sendRequest($request); |
|
67 | + } |
|
68 | + /** |
|
69 | + * Returns information about a task. |
|
70 | + * |
|
71 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html |
|
72 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
73 | + * |
|
74 | + * @param array{ |
|
75 | + * task_id: string, // (REQUIRED) Return the task with specified id (node_id:task_number) |
|
76 | + * wait_for_completion: boolean, // Wait for the matching tasks to complete (default: false) |
|
77 | + * timeout: time, // Explicit operation timeout |
|
78 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
79 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
80 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
81 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
82 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
83 | + * } $params |
|
84 | + * |
|
85 | + * @throws MissingParameterException if a required parameter is missing |
|
86 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
87 | + * @throws ClientResponseException if the status code of response is 4xx |
|
88 | + * @throws ServerResponseException if the status code of response is 5xx |
|
89 | + * |
|
90 | + * @return Elasticsearch|Promise |
|
91 | + */ |
|
92 | + public function get(array $params = []) |
|
93 | + { |
|
94 | + $this->checkRequiredParameters(['task_id'], $params); |
|
95 | + $url = '/_tasks/' . $this->encode($params['task_id']); |
|
96 | + $method = 'GET'; |
|
97 | + $url = $this->addQueryString($url, $params, ['wait_for_completion', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
98 | + $headers = ['Accept' => 'application/json']; |
|
99 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
100 | + $request = $this->addOtelAttributes($params, ['task_id'], $request, 'tasks.get'); |
|
101 | + return $this->client->sendRequest($request); |
|
102 | + } |
|
103 | + /** |
|
104 | + * Returns a list of tasks. |
|
105 | + * |
|
106 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html |
|
107 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
|
108 | + * |
|
109 | + * @param array{ |
|
110 | + * nodes: list, // A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes |
|
111 | + * actions: list, // A comma-separated list of actions that should be returned. Leave empty to return all. |
|
112 | + * detailed: boolean, // Return detailed task information (default: false) |
|
113 | + * parent_task_id: string, // Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all. |
|
114 | + * wait_for_completion: boolean, // Wait for the matching tasks to complete (default: false) |
|
115 | + * group_by: enum, // Group tasks by nodes or parent/child relationships |
|
116 | + * timeout: time, // Explicit operation timeout |
|
117 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
118 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
119 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
120 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
121 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
122 | + * } $params |
|
123 | + * |
|
124 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
125 | + * @throws ClientResponseException if the status code of response is 4xx |
|
126 | + * @throws ServerResponseException if the status code of response is 5xx |
|
127 | + * |
|
128 | + * @return Elasticsearch|Promise |
|
129 | + */ |
|
130 | + public function list(array $params = []) |
|
131 | + { |
|
132 | + $url = '/_tasks'; |
|
133 | + $method = 'GET'; |
|
134 | + $url = $this->addQueryString($url, $params, ['nodes', 'actions', 'detailed', 'parent_task_id', 'wait_for_completion', 'group_by', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
135 | + $headers = ['Accept' => 'application/json']; |
|
136 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
137 | + $request = $this->addOtelAttributes($params, [], $request, 'tasks.list'); |
|
138 | + return $this->client->sendRequest($request); |
|
139 | + } |
|
140 | 140 | } |
@@ -25,182 +25,182 @@ |
||
25 | 25 | */ |
26 | 26 | class AsyncSearch extends AbstractEndpoint |
27 | 27 | { |
28 | - /** |
|
29 | - * Deletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted. |
|
30 | - * |
|
31 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
32 | - * |
|
33 | - * @param array{ |
|
34 | - * id: string, // (REQUIRED) The async search ID |
|
35 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
36 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
37 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
38 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
39 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
40 | - * } $params |
|
41 | - * |
|
42 | - * @throws MissingParameterException if a required parameter is missing |
|
43 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
44 | - * @throws ClientResponseException if the status code of response is 4xx |
|
45 | - * @throws ServerResponseException if the status code of response is 5xx |
|
46 | - * |
|
47 | - * @return Elasticsearch|Promise |
|
48 | - */ |
|
49 | - public function delete(array $params = []) |
|
50 | - { |
|
51 | - $this->checkRequiredParameters(['id'], $params); |
|
52 | - $url = '/_async_search/' . $this->encode($params['id']); |
|
53 | - $method = 'DELETE'; |
|
54 | - $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
55 | - $headers = ['Accept' => 'application/json']; |
|
56 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
57 | - $request = $this->addOtelAttributes($params, ['id'], $request, 'async_search.delete'); |
|
58 | - return $this->client->sendRequest($request); |
|
59 | - } |
|
60 | - /** |
|
61 | - * Retrieves the results of a previously submitted async search request given its ID. |
|
62 | - * |
|
63 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
64 | - * |
|
65 | - * @param array{ |
|
66 | - * id: string, // (REQUIRED) The async search ID |
|
67 | - * wait_for_completion_timeout: time, // Specify the time that the request should block waiting for the final response |
|
68 | - * keep_alive: time, // Specify the time interval in which the results (partial or final) for this search will be available |
|
69 | - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
70 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
71 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
72 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
73 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
74 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
75 | - * } $params |
|
76 | - * |
|
77 | - * @throws MissingParameterException if a required parameter is missing |
|
78 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
79 | - * @throws ClientResponseException if the status code of response is 4xx |
|
80 | - * @throws ServerResponseException if the status code of response is 5xx |
|
81 | - * |
|
82 | - * @return Elasticsearch|Promise |
|
83 | - */ |
|
84 | - public function get(array $params = []) |
|
85 | - { |
|
86 | - $this->checkRequiredParameters(['id'], $params); |
|
87 | - $url = '/_async_search/' . $this->encode($params['id']); |
|
88 | - $method = 'GET'; |
|
89 | - $url = $this->addQueryString($url, $params, ['wait_for_completion_timeout', 'keep_alive', 'typed_keys', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
90 | - $headers = ['Accept' => 'application/json']; |
|
91 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
92 | - $request = $this->addOtelAttributes($params, ['id'], $request, 'async_search.get'); |
|
93 | - return $this->client->sendRequest($request); |
|
94 | - } |
|
95 | - /** |
|
96 | - * Retrieves the status of a previously submitted async search request given its ID. |
|
97 | - * |
|
98 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
99 | - * |
|
100 | - * @param array{ |
|
101 | - * id: string, // (REQUIRED) The async search ID |
|
102 | - * keep_alive: time, // Specify the time interval in which the results (partial or final) for this search will be available |
|
103 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
104 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
105 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
106 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
107 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
108 | - * } $params |
|
109 | - * |
|
110 | - * @throws MissingParameterException if a required parameter is missing |
|
111 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
112 | - * @throws ClientResponseException if the status code of response is 4xx |
|
113 | - * @throws ServerResponseException if the status code of response is 5xx |
|
114 | - * |
|
115 | - * @return Elasticsearch|Promise |
|
116 | - */ |
|
117 | - public function status(array $params = []) |
|
118 | - { |
|
119 | - $this->checkRequiredParameters(['id'], $params); |
|
120 | - $url = '/_async_search/status/' . $this->encode($params['id']); |
|
121 | - $method = 'GET'; |
|
122 | - $url = $this->addQueryString($url, $params, ['keep_alive', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
123 | - $headers = ['Accept' => 'application/json']; |
|
124 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
125 | - $request = $this->addOtelAttributes($params, ['id'], $request, 'async_search.status'); |
|
126 | - return $this->client->sendRequest($request); |
|
127 | - } |
|
128 | - /** |
|
129 | - * Executes a search request asynchronously. |
|
130 | - * |
|
131 | - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
132 | - * |
|
133 | - * @param array{ |
|
134 | - * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
135 | - * wait_for_completion_timeout: time, // Specify the time that the request should block waiting for the final response |
|
136 | - * keep_on_completion: boolean, // Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false) |
|
137 | - * 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 the granularity at which progress results will be made available. |
|
138 | - * request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to true |
|
139 | - * analyzer: string, // The analyzer to use for the query string |
|
140 | - * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) |
|
141 | - * ccs_minimize_roundtrips: boolean, // When doing a cross-cluster search, setting it to true may improve overall search latency, particularly when searching clusters with a large number of shards. However, when set to true, the progress of searches on the remote clusters will not be received until the search finishes on all clusters. |
|
142 | - * default_operator: enum, // The default operator for query string query (AND or OR) |
|
143 | - * df: string, // The field to use as default where no field prefix is given in the query string |
|
144 | - * explain: boolean, // Specify whether to return detailed information about score computation as part of a hit |
|
145 | - * stored_fields: list, // A comma-separated list of stored fields to return as part of a hit |
|
146 | - * docvalue_fields: list, // A comma-separated list of fields to return as the docvalue representation of a field for each hit |
|
147 | - * from: number, // Starting offset (default: 0) |
|
148 | - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
149 | - * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled |
|
150 | - * 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) |
|
151 | - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
152 | - * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
153 | - * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
154 | - * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response |
|
155 | - * q: string, // Query in the Lucene query string syntax |
|
156 | - * routing: list, // A comma-separated list of specific routing values |
|
157 | - * search_type: enum, // Search operation type |
|
158 | - * size: number, // Number of hits to return (default: 10) |
|
159 | - * sort: list, // A comma-separated list of <field>:<direction> pairs |
|
160 | - * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
161 | - * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
162 | - * _source_includes: list, // A list of fields to extract and return from the _source field |
|
163 | - * terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. |
|
164 | - * stats: list, // Specific 'tag' of the request for logging and statistical purposes |
|
165 | - * suggest_field: string, // Specify which field to use for suggestions |
|
166 | - * suggest_mode: enum, // Specify suggest mode |
|
167 | - * suggest_size: number, // How many suggestions to return in response |
|
168 | - * suggest_text: string, // The source text for which the suggestions should be returned |
|
169 | - * timeout: time, // Explicit operation timeout |
|
170 | - * track_scores: boolean, // Whether to calculate and return scores even if they are not used for sorting |
|
171 | - * 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. |
|
172 | - * allow_partial_search_results: boolean, // Indicate if an error should be returned if there is a partial search failure or timeout |
|
173 | - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
174 | - * version: boolean, // Specify whether to return document version as part of a hit |
|
175 | - * seq_no_primary_term: boolean, // Specify whether to return sequence number and primary term of the last modification of each hit |
|
176 | - * 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 |
|
177 | - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
178 | - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
179 | - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
180 | - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
181 | - * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
182 | - * body: array, // The search definition using the Query DSL |
|
183 | - * } $params |
|
184 | - * |
|
185 | - * @throws NoNodeAvailableException if all the hosts are offline |
|
186 | - * @throws ClientResponseException if the status code of response is 4xx |
|
187 | - * @throws ServerResponseException if the status code of response is 5xx |
|
188 | - * |
|
189 | - * @return Elasticsearch|Promise |
|
190 | - */ |
|
191 | - public function submit(array $params = []) |
|
192 | - { |
|
193 | - if (isset($params['index'])) { |
|
194 | - $url = '/' . $this->encode($params['index']) . '/_async_search'; |
|
195 | - $method = 'POST'; |
|
196 | - } else { |
|
197 | - $url = '/_async_search'; |
|
198 | - $method = 'POST'; |
|
199 | - } |
|
200 | - $url = $this->addQueryString($url, $params, ['wait_for_completion_timeout', 'keep_on_completion', 'batched_reduce_size', 'request_cache', 'analyzer', 'analyze_wildcard', 'ccs_minimize_roundtrips', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'rest_total_hits_as_int', 'q', 'routing', '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', 'max_concurrent_shard_requests', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
201 | - $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
202 | - $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
203 | - $request = $this->addOtelAttributes($params, ['index'], $request, 'async_search.submit'); |
|
204 | - return $this->client->sendRequest($request); |
|
205 | - } |
|
28 | + /** |
|
29 | + * Deletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted. |
|
30 | + * |
|
31 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
32 | + * |
|
33 | + * @param array{ |
|
34 | + * id: string, // (REQUIRED) The async search ID |
|
35 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
36 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
37 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
38 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
39 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
40 | + * } $params |
|
41 | + * |
|
42 | + * @throws MissingParameterException if a required parameter is missing |
|
43 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
44 | + * @throws ClientResponseException if the status code of response is 4xx |
|
45 | + * @throws ServerResponseException if the status code of response is 5xx |
|
46 | + * |
|
47 | + * @return Elasticsearch|Promise |
|
48 | + */ |
|
49 | + public function delete(array $params = []) |
|
50 | + { |
|
51 | + $this->checkRequiredParameters(['id'], $params); |
|
52 | + $url = '/_async_search/' . $this->encode($params['id']); |
|
53 | + $method = 'DELETE'; |
|
54 | + $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
55 | + $headers = ['Accept' => 'application/json']; |
|
56 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
57 | + $request = $this->addOtelAttributes($params, ['id'], $request, 'async_search.delete'); |
|
58 | + return $this->client->sendRequest($request); |
|
59 | + } |
|
60 | + /** |
|
61 | + * Retrieves the results of a previously submitted async search request given its ID. |
|
62 | + * |
|
63 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
64 | + * |
|
65 | + * @param array{ |
|
66 | + * id: string, // (REQUIRED) The async search ID |
|
67 | + * wait_for_completion_timeout: time, // Specify the time that the request should block waiting for the final response |
|
68 | + * keep_alive: time, // Specify the time interval in which the results (partial or final) for this search will be available |
|
69 | + * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
70 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
71 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
72 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
73 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
74 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
75 | + * } $params |
|
76 | + * |
|
77 | + * @throws MissingParameterException if a required parameter is missing |
|
78 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
79 | + * @throws ClientResponseException if the status code of response is 4xx |
|
80 | + * @throws ServerResponseException if the status code of response is 5xx |
|
81 | + * |
|
82 | + * @return Elasticsearch|Promise |
|
83 | + */ |
|
84 | + public function get(array $params = []) |
|
85 | + { |
|
86 | + $this->checkRequiredParameters(['id'], $params); |
|
87 | + $url = '/_async_search/' . $this->encode($params['id']); |
|
88 | + $method = 'GET'; |
|
89 | + $url = $this->addQueryString($url, $params, ['wait_for_completion_timeout', 'keep_alive', 'typed_keys', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
90 | + $headers = ['Accept' => 'application/json']; |
|
91 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
92 | + $request = $this->addOtelAttributes($params, ['id'], $request, 'async_search.get'); |
|
93 | + return $this->client->sendRequest($request); |
|
94 | + } |
|
95 | + /** |
|
96 | + * Retrieves the status of a previously submitted async search request given its ID. |
|
97 | + * |
|
98 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
99 | + * |
|
100 | + * @param array{ |
|
101 | + * id: string, // (REQUIRED) The async search ID |
|
102 | + * keep_alive: time, // Specify the time interval in which the results (partial or final) for this search will be available |
|
103 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
104 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
105 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
106 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
107 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
108 | + * } $params |
|
109 | + * |
|
110 | + * @throws MissingParameterException if a required parameter is missing |
|
111 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
112 | + * @throws ClientResponseException if the status code of response is 4xx |
|
113 | + * @throws ServerResponseException if the status code of response is 5xx |
|
114 | + * |
|
115 | + * @return Elasticsearch|Promise |
|
116 | + */ |
|
117 | + public function status(array $params = []) |
|
118 | + { |
|
119 | + $this->checkRequiredParameters(['id'], $params); |
|
120 | + $url = '/_async_search/status/' . $this->encode($params['id']); |
|
121 | + $method = 'GET'; |
|
122 | + $url = $this->addQueryString($url, $params, ['keep_alive', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
123 | + $headers = ['Accept' => 'application/json']; |
|
124 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
125 | + $request = $this->addOtelAttributes($params, ['id'], $request, 'async_search.status'); |
|
126 | + return $this->client->sendRequest($request); |
|
127 | + } |
|
128 | + /** |
|
129 | + * Executes a search request asynchronously. |
|
130 | + * |
|
131 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html |
|
132 | + * |
|
133 | + * @param array{ |
|
134 | + * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices |
|
135 | + * wait_for_completion_timeout: time, // Specify the time that the request should block waiting for the final response |
|
136 | + * keep_on_completion: boolean, // Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false) |
|
137 | + * 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 the granularity at which progress results will be made available. |
|
138 | + * request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to true |
|
139 | + * analyzer: string, // The analyzer to use for the query string |
|
140 | + * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) |
|
141 | + * ccs_minimize_roundtrips: boolean, // When doing a cross-cluster search, setting it to true may improve overall search latency, particularly when searching clusters with a large number of shards. However, when set to true, the progress of searches on the remote clusters will not be received until the search finishes on all clusters. |
|
142 | + * default_operator: enum, // The default operator for query string query (AND or OR) |
|
143 | + * df: string, // The field to use as default where no field prefix is given in the query string |
|
144 | + * explain: boolean, // Specify whether to return detailed information about score computation as part of a hit |
|
145 | + * stored_fields: list, // A comma-separated list of stored fields to return as part of a hit |
|
146 | + * docvalue_fields: list, // A comma-separated list of fields to return as the docvalue representation of a field for each hit |
|
147 | + * from: number, // Starting offset (default: 0) |
|
148 | + * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) |
|
149 | + * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled |
|
150 | + * 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) |
|
151 | + * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. |
|
152 | + * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored |
|
153 | + * preference: string, // Specify the node or shard the operation should be performed on (default: random) |
|
154 | + * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response |
|
155 | + * q: string, // Query in the Lucene query string syntax |
|
156 | + * routing: list, // A comma-separated list of specific routing values |
|
157 | + * search_type: enum, // Search operation type |
|
158 | + * size: number, // Number of hits to return (default: 10) |
|
159 | + * sort: list, // A comma-separated list of <field>:<direction> pairs |
|
160 | + * _source: list, // True or false to return the _source field or not, or a list of fields to return |
|
161 | + * _source_excludes: list, // A list of fields to exclude from the returned _source field |
|
162 | + * _source_includes: list, // A list of fields to extract and return from the _source field |
|
163 | + * terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. |
|
164 | + * stats: list, // Specific 'tag' of the request for logging and statistical purposes |
|
165 | + * suggest_field: string, // Specify which field to use for suggestions |
|
166 | + * suggest_mode: enum, // Specify suggest mode |
|
167 | + * suggest_size: number, // How many suggestions to return in response |
|
168 | + * suggest_text: string, // The source text for which the suggestions should be returned |
|
169 | + * timeout: time, // Explicit operation timeout |
|
170 | + * track_scores: boolean, // Whether to calculate and return scores even if they are not used for sorting |
|
171 | + * 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. |
|
172 | + * allow_partial_search_results: boolean, // Indicate if an error should be returned if there is a partial search failure or timeout |
|
173 | + * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response |
|
174 | + * version: boolean, // Specify whether to return document version as part of a hit |
|
175 | + * seq_no_primary_term: boolean, // Specify whether to return sequence number and primary term of the last modification of each hit |
|
176 | + * 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 |
|
177 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
|
178 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
|
179 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
|
180 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
|
181 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
|
182 | + * body: array, // The search definition using the Query DSL |
|
183 | + * } $params |
|
184 | + * |
|
185 | + * @throws NoNodeAvailableException if all the hosts are offline |
|
186 | + * @throws ClientResponseException if the status code of response is 4xx |
|
187 | + * @throws ServerResponseException if the status code of response is 5xx |
|
188 | + * |
|
189 | + * @return Elasticsearch|Promise |
|
190 | + */ |
|
191 | + public function submit(array $params = []) |
|
192 | + { |
|
193 | + if (isset($params['index'])) { |
|
194 | + $url = '/' . $this->encode($params['index']) . '/_async_search'; |
|
195 | + $method = 'POST'; |
|
196 | + } else { |
|
197 | + $url = '/_async_search'; |
|
198 | + $method = 'POST'; |
|
199 | + } |
|
200 | + $url = $this->addQueryString($url, $params, ['wait_for_completion_timeout', 'keep_on_completion', 'batched_reduce_size', 'request_cache', 'analyzer', 'analyze_wildcard', 'ccs_minimize_roundtrips', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'rest_total_hits_as_int', 'q', 'routing', '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', 'max_concurrent_shard_requests', 'pretty', 'human', 'error_trace', 'source', 'filter_path']); |
|
201 | + $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json']; |
|
202 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
|
203 | + $request = $this->addOtelAttributes($params, ['index'], $request, 'async_search.submit'); |
|
204 | + return $this->client->sendRequest($request); |
|
205 | + } |
|
206 | 206 | } |