Completed
Push — master ( 444b7c...2b29c8 )
by Maxence
17s queued 14s
created
lib/Vendor/Elastic/Elasticsearch/Traits/ClientEndpointsTrait.php 2 patches
Indentation   +1837 added lines, -1837 removed lines patch added patch discarded remove patch
@@ -25,1841 +25,1841 @@
 block discarded – undo
25 25
  */
26 26
 trait ClientEndpointsTrait
27 27
 {
28
-    /**
29
-     * Allows to perform multiple index/update/delete operations in a single request.
30
-     *
31
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html
32
-     *
33
-     * @param array{
34
-     *     index: string, //  Default index for items which don't provide one
35
-     *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
36
-     *     refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
37
-     *     routing: string, // Specific routing value
38
-     *     timeout: time, // Explicit operation timeout
39
-     *     type: string, // Default document type for items which don't provide one
40
-     *     _source: list, // True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request
41
-     *     _source_excludes: list, // Default list of fields to exclude from the returned _source field, can be overridden on each sub-request
42
-     *     _source_includes: list, // Default list of fields to extract and return from the _source field, can be overridden on each sub-request
43
-     *     pipeline: string, // The pipeline id to preprocess incoming documents with
44
-     *     require_alias: boolean, // Sets require_alias for all incoming documents. Defaults to unset (false)
45
-     *     require_data_stream: boolean, // When true, requires the destination to be a data stream (existing or to-be-created). Default is false
46
-     *     list_executed_pipelines: boolean, // Sets list_executed_pipelines for all incoming documents. Defaults to unset (false)
47
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
48
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
49
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
50
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
51
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
52
-     *     body: array, // (REQUIRED) The operation definition and data (action-data pairs), separated by newlines
53
-     * } $params
54
-     *
55
-     * @throws NoNodeAvailableException if all the hosts are offline
56
-     * @throws ClientResponseException if the status code of response is 4xx
57
-     * @throws ServerResponseException if the status code of response is 5xx
58
-     *
59
-     * @return Elasticsearch|Promise
60
-     */
61
-    public function bulk(array $params = [])
62
-    {
63
-        $this->checkRequiredParameters(['body'], $params);
64
-        if (isset($params['index'])) {
65
-            $url = '/' . $this->encode($params['index']) . '/_bulk';
66
-            $method = 'POST';
67
-        } else {
68
-            $url = '/_bulk';
69
-            $method = 'POST';
70
-        }
71
-        $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'type', '_source', '_source_excludes', '_source_includes', 'pipeline', 'require_alias', 'require_data_stream', 'list_executed_pipelines', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
72
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson'];
73
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
74
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'bulk');
75
-        return $this->sendRequest($request);
76
-    }
77
-    /**
78
-     * Explicitly clears the search context for a scroll.
79
-     *
80
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/clear-scroll-api.html
81
-     *
82
-     * @param array{
83
-     *     scroll_id: list, //  A comma-separated list of scroll IDs to clear
84
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
85
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
86
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
87
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
88
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
89
-     *     body: array, //  A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter
90
-     * } $params
91
-     *
92
-     * @throws NoNodeAvailableException if all the hosts are offline
93
-     * @throws ClientResponseException if the status code of response is 4xx
94
-     * @throws ServerResponseException if the status code of response is 5xx
95
-     *
96
-     * @return Elasticsearch|Promise
97
-     */
98
-    public function clearScroll(array $params = [])
99
-    {
100
-        if (isset($params['scroll_id'])) {
101
-            $url = '/_search/scroll/' . $this->encode($params['scroll_id']);
102
-            $method = 'DELETE';
103
-        } else {
104
-            $url = '/_search/scroll';
105
-            $method = 'DELETE';
106
-        }
107
-        $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
108
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
109
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
110
-        $request = $this->addOtelAttributes($params, ['scroll_id'], $request, 'clear_scroll');
111
-        return $this->sendRequest($request);
112
-    }
113
-    /**
114
-     * Close a point in time
115
-     *
116
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html
117
-     *
118
-     * @param array{
119
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
120
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
121
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
122
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
123
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
124
-     *     body: array, //  a point-in-time id to close
125
-     * } $params
126
-     *
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 closePointInTime(array $params = [])
134
-    {
135
-        $url = '/_pit';
136
-        $method = 'DELETE';
137
-        $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
138
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
139
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
140
-        $request = $this->addOtelAttributes($params, [], $request, 'close_point_in_time');
141
-        return $this->sendRequest($request);
142
-    }
143
-    /**
144
-     * Returns number of documents matching a query.
145
-     *
146
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html
147
-     *
148
-     * @param array{
149
-     *     index: list, //  A comma-separated list of indices to restrict the results
150
-     *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
151
-     *     ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled
152
-     *     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)
153
-     *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
154
-     *     min_score: number, // Include only documents with a specific `_score` value in the result
155
-     *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
156
-     *     routing: list, // A comma-separated list of specific routing values
157
-     *     q: string, // Query in the Lucene query string syntax
158
-     *     analyzer: string, // The analyzer to use for the query string
159
-     *     analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false)
160
-     *     default_operator: enum, // The default operator for query string query (AND or OR)
161
-     *     df: string, // The field to use as default where no field prefix is given in the query string
162
-     *     lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
163
-     *     terminate_after: number, // The maximum count for each shard, upon reaching which the query execution will terminate early
164
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
165
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
166
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
167
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
168
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
169
-     *     body: array, //  A query to restrict the results specified with the Query DSL (optional)
170
-     * } $params
171
-     *
172
-     * @throws NoNodeAvailableException if all the hosts are offline
173
-     * @throws ClientResponseException if the status code of response is 4xx
174
-     * @throws ServerResponseException if the status code of response is 5xx
175
-     *
176
-     * @return Elasticsearch|Promise
177
-     */
178
-    public function count(array $params = [])
179
-    {
180
-        if (isset($params['index'])) {
181
-            $url = '/' . $this->encode($params['index']) . '/_count';
182
-            $method = empty($params['body']) ? 'GET' : 'POST';
183
-        } else {
184
-            $url = '/_count';
185
-            $method = empty($params['body']) ? 'GET' : 'POST';
186
-        }
187
-        $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'min_score', 'preference', 'routing', 'q', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'terminate_after', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
188
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
189
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
190
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'count');
191
-        return $this->sendRequest($request);
192
-    }
193
-    /**
194
-     * Creates a new document in the index.
195
-     *
196
-     * Returns a 409 response when a document with a same ID already exists in the index.
197
-     *
198
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html
199
-     *
200
-     * @param array{
201
-     *     id: string, // (REQUIRED) Document ID
202
-     *     index: string, // (REQUIRED) The name of the index
203
-     *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
204
-     *     refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
205
-     *     routing: string, // Specific routing value
206
-     *     timeout: time, // Explicit operation timeout
207
-     *     version: number, // Explicit version number for concurrency control
208
-     *     version_type: enum, // Specific version type
209
-     *     pipeline: string, // The pipeline id to preprocess incoming documents with
210
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
211
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
212
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
213
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
214
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
215
-     *     body: array, // (REQUIRED) The document
216
-     * } $params
217
-     *
218
-     * @throws MissingParameterException if a required parameter is missing
219
-     * @throws NoNodeAvailableException if all the hosts are offline
220
-     * @throws ClientResponseException if the status code of response is 4xx
221
-     * @throws ServerResponseException if the status code of response is 5xx
222
-     *
223
-     * @return Elasticsearch|Promise
224
-     */
225
-    public function create(array $params = [])
226
-    {
227
-        $this->checkRequiredParameters(['id', 'index', 'body'], $params);
228
-        $url = '/' . $this->encode($params['index']) . '/_create/' . $this->encode($params['id']);
229
-        $method = 'PUT';
230
-        $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'pipeline', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
231
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
232
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
233
-        $request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'create');
234
-        return $this->sendRequest($request);
235
-    }
236
-    /**
237
-     * Removes a document from the index.
238
-     *
239
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html
240
-     *
241
-     * @param array{
242
-     *     id: string, // (REQUIRED) The document ID
243
-     *     index: string, // (REQUIRED) The name of the index
244
-     *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
245
-     *     refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
246
-     *     routing: string, // Specific routing value
247
-     *     timeout: time, // Explicit operation timeout
248
-     *     if_seq_no: number, // only perform the delete operation if the last operation that has changed the document has the specified sequence number
249
-     *     if_primary_term: number, // only perform the delete operation if the last operation that has changed the document has the specified primary term
250
-     *     version: number, // Explicit version number for concurrency control
251
-     *     version_type: enum, // Specific version type
252
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
253
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
254
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
255
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
256
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
257
-     * } $params
258
-     *
259
-     * @throws MissingParameterException if a required parameter is missing
260
-     * @throws NoNodeAvailableException if all the hosts are offline
261
-     * @throws ClientResponseException if the status code of response is 4xx
262
-     * @throws ServerResponseException if the status code of response is 5xx
263
-     *
264
-     * @return Elasticsearch|Promise
265
-     */
266
-    public function delete(array $params = [])
267
-    {
268
-        $this->checkRequiredParameters(['id', 'index'], $params);
269
-        $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']);
270
-        $method = 'DELETE';
271
-        $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
272
-        $headers = ['Accept' => 'application/json'];
273
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
274
-        $request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'delete');
275
-        return $this->sendRequest($request);
276
-    }
277
-    /**
278
-     * Deletes documents matching the provided query.
279
-     *
280
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html
281
-     *
282
-     * @param array{
283
-     *     index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
284
-     *     analyzer: string, // The analyzer to use for the query string
285
-     *     analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false)
286
-     *     default_operator: enum, // The default operator for query string query (AND or OR)
287
-     *     df: string, // The field to use as default where no field prefix is given in the query string
288
-     *     from: number, // Starting offset (default: 0)
289
-     *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
290
-     *     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)
291
-     *     conflicts: enum, // What to do when the delete by query hits version conflicts?
292
-     *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
293
-     *     lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
294
-     *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
295
-     *     q: string, // Query in the Lucene query string syntax
296
-     *     routing: list, // A comma-separated list of specific routing values
297
-     *     scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search
298
-     *     search_type: enum, // Search operation type
299
-     *     search_timeout: time, // Explicit timeout for each search request. Defaults to no timeout.
300
-     *     max_docs: number, // Maximum number of documents to process (default: all documents)
301
-     *     sort: list, // A comma-separated list of <field>:<direction> pairs
302
-     *     terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
303
-     *     stats: list, // Specific 'tag' of the request for logging and statistical purposes
304
-     *     version: boolean, // Specify whether to return document version as part of a hit
305
-     *     request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to index level setting
306
-     *     refresh: boolean, // Should the affected indexes be refreshed?
307
-     *     timeout: time, // Time each individual bulk request should wait for shards that are unavailable.
308
-     *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
309
-     *     scroll_size: number, // Size on the scroll request powering the delete by query
310
-     *     wait_for_completion: boolean, // Should the request should block until the delete by query is complete.
311
-     *     requests_per_second: number, // The throttle for this request in sub-requests per second. -1 means no throttle.
312
-     *     slices: number|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`.
313
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
314
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
315
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
316
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
317
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
318
-     *     body: array, // (REQUIRED) The search definition using the Query DSL
319
-     * } $params
320
-     *
321
-     * @throws MissingParameterException if a required parameter is missing
322
-     * @throws NoNodeAvailableException if all the hosts are offline
323
-     * @throws ClientResponseException if the status code of response is 4xx
324
-     * @throws ServerResponseException if the status code of response is 5xx
325
-     *
326
-     * @return Elasticsearch|Promise
327
-     */
328
-    public function deleteByQuery(array $params = [])
329
-    {
330
-        $this->checkRequiredParameters(['index', 'body'], $params);
331
-        $url = '/' . $this->encode($params['index']) . '/_delete_by_query';
332
-        $method = 'POST';
333
-        $url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'max_docs', 'sort', 'terminate_after', 'stats', 'version', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
334
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
335
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
336
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'delete_by_query');
337
-        return $this->sendRequest($request);
338
-    }
339
-    /**
340
-     * Changes the number of requests per second for a particular Delete By Query operation.
341
-     *
342
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html
343
-     *
344
-     * @param array{
345
-     *     task_id: string, // (REQUIRED) The task id to rethrottle
346
-     *     requests_per_second: number, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
347
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
348
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
349
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
350
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
351
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
352
-     * } $params
353
-     *
354
-     * @throws MissingParameterException if a required parameter is missing
355
-     * @throws NoNodeAvailableException if all the hosts are offline
356
-     * @throws ClientResponseException if the status code of response is 4xx
357
-     * @throws ServerResponseException if the status code of response is 5xx
358
-     *
359
-     * @return Elasticsearch|Promise
360
-     */
361
-    public function deleteByQueryRethrottle(array $params = [])
362
-    {
363
-        $this->checkRequiredParameters(['task_id', 'requests_per_second'], $params);
364
-        $url = '/_delete_by_query/' . $this->encode($params['task_id']) . '/_rethrottle';
365
-        $method = 'POST';
366
-        $url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
367
-        $headers = ['Accept' => 'application/json'];
368
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
369
-        $request = $this->addOtelAttributes($params, ['task_id'], $request, 'delete_by_query_rethrottle');
370
-        return $this->sendRequest($request);
371
-    }
372
-    /**
373
-     * Deletes a script.
374
-     *
375
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html
376
-     *
377
-     * @param array{
378
-     *     id: string, // (REQUIRED) Script ID
379
-     *     timeout: time, // Explicit operation timeout
380
-     *     master_timeout: time, // Specify timeout for connection to master
381
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
382
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
383
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
384
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
385
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
386
-     * } $params
387
-     *
388
-     * @throws MissingParameterException if a required parameter is missing
389
-     * @throws NoNodeAvailableException if all the hosts are offline
390
-     * @throws ClientResponseException if the status code of response is 4xx
391
-     * @throws ServerResponseException if the status code of response is 5xx
392
-     *
393
-     * @return Elasticsearch|Promise
394
-     */
395
-    public function deleteScript(array $params = [])
396
-    {
397
-        $this->checkRequiredParameters(['id'], $params);
398
-        $url = '/_scripts/' . $this->encode($params['id']);
399
-        $method = 'DELETE';
400
-        $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
401
-        $headers = ['Accept' => 'application/json'];
402
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
403
-        $request = $this->addOtelAttributes($params, ['id'], $request, 'delete_script');
404
-        return $this->sendRequest($request);
405
-    }
406
-    /**
407
-     * Returns information about whether a document exists in an index.
408
-     *
409
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html
410
-     *
411
-     * @param array{
412
-     *     id: string, // (REQUIRED) The document ID
413
-     *     index: string, // (REQUIRED) The name of the index
414
-     *     stored_fields: list, // A comma-separated list of stored fields to return in the response
415
-     *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
416
-     *     realtime: boolean, // Specify whether to perform the operation in realtime or search mode
417
-     *     refresh: boolean, // Refresh the shard containing the document before performing the operation
418
-     *     routing: string, // Specific routing value
419
-     *     _source: list, // True or false to return the _source field or not, or a list of fields to return
420
-     *     _source_excludes: list, // A list of fields to exclude from the returned _source field
421
-     *     _source_includes: list, // A list of fields to extract and return from the _source field
422
-     *     version: number, // Explicit version number for concurrency control
423
-     *     version_type: enum, // Specific version type
424
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
425
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
426
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
427
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
428
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
429
-     * } $params
430
-     *
431
-     * @throws MissingParameterException if a required parameter is missing
432
-     * @throws NoNodeAvailableException if all the hosts are offline
433
-     * @throws ClientResponseException if the status code of response is 4xx
434
-     * @throws ServerResponseException if the status code of response is 5xx
435
-     *
436
-     * @return Elasticsearch|Promise
437
-     */
438
-    public function exists(array $params = [])
439
-    {
440
-        $this->checkRequiredParameters(['id', 'index'], $params);
441
-        $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']);
442
-        $method = 'HEAD';
443
-        $url = $this->addQueryString($url, $params, ['stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
444
-        $headers = ['Accept' => 'application/json'];
445
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
446
-        $request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'exists');
447
-        return $this->sendRequest($request);
448
-    }
449
-    /**
450
-     * Returns information about whether a document source exists in an index.
451
-     *
452
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html
453
-     *
454
-     * @param array{
455
-     *     id: string, // (REQUIRED) The document ID
456
-     *     index: string, // (REQUIRED) The name of the index
457
-     *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
458
-     *     realtime: boolean, // Specify whether to perform the operation in realtime or search mode
459
-     *     refresh: boolean, // Refresh the shard containing the document before performing the operation
460
-     *     routing: string, // Specific routing value
461
-     *     _source: list, // True or false to return the _source field or not, or a list of fields to return
462
-     *     _source_excludes: list, // A list of fields to exclude from the returned _source field
463
-     *     _source_includes: list, // A list of fields to extract and return from the _source field
464
-     *     version: number, // Explicit version number for concurrency control
465
-     *     version_type: enum, // Specific version type
466
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
467
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
468
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
469
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
470
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
471
-     * } $params
472
-     *
473
-     * @throws MissingParameterException if a required parameter is missing
474
-     * @throws NoNodeAvailableException if all the hosts are offline
475
-     * @throws ClientResponseException if the status code of response is 4xx
476
-     * @throws ServerResponseException if the status code of response is 5xx
477
-     *
478
-     * @return Elasticsearch|Promise
479
-     */
480
-    public function existsSource(array $params = [])
481
-    {
482
-        $this->checkRequiredParameters(['id', 'index'], $params);
483
-        $url = '/' . $this->encode($params['index']) . '/_source/' . $this->encode($params['id']);
484
-        $method = 'HEAD';
485
-        $url = $this->addQueryString($url, $params, ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
486
-        $headers = ['Accept' => 'application/json'];
487
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
488
-        $request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'exists_source');
489
-        return $this->sendRequest($request);
490
-    }
491
-    /**
492
-     * Returns information about why a specific matches (or doesn't match) a query.
493
-     *
494
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html
495
-     *
496
-     * @param array{
497
-     *     id: string, // (REQUIRED) The document ID
498
-     *     index: string, // (REQUIRED) The name of the index
499
-     *     analyze_wildcard: boolean, // Specify whether wildcards and prefix queries in the query string query should be analyzed (default: false)
500
-     *     analyzer: string, // The analyzer for the query string query
501
-     *     default_operator: enum, // The default operator for query string query (AND or OR)
502
-     *     df: string, // The default field for query string query (default: _all)
503
-     *     stored_fields: list, // A comma-separated list of stored fields to return in the response
504
-     *     lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
505
-     *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
506
-     *     q: string, // Query in the Lucene query string syntax
507
-     *     routing: string, // Specific routing value
508
-     *     _source: list, // True or false to return the _source field or not, or a list of fields to return
509
-     *     _source_excludes: list, // A list of fields to exclude from the returned _source field
510
-     *     _source_includes: list, // A list of fields to extract and return from the _source field
511
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
512
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
513
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
514
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
515
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
516
-     *     body: array, //  The query definition using the Query DSL
517
-     * } $params
518
-     *
519
-     * @throws MissingParameterException if a required parameter is missing
520
-     * @throws NoNodeAvailableException if all the hosts are offline
521
-     * @throws ClientResponseException if the status code of response is 4xx
522
-     * @throws ServerResponseException if the status code of response is 5xx
523
-     *
524
-     * @return Elasticsearch|Promise
525
-     */
526
-    public function explain(array $params = [])
527
-    {
528
-        $this->checkRequiredParameters(['id', 'index'], $params);
529
-        $url = '/' . $this->encode($params['index']) . '/_explain/' . $this->encode($params['id']);
530
-        $method = empty($params['body']) ? 'GET' : 'POST';
531
-        $url = $this->addQueryString($url, $params, ['analyze_wildcard', 'analyzer', 'default_operator', 'df', 'stored_fields', 'lenient', 'preference', 'q', 'routing', '_source', '_source_excludes', '_source_includes', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
532
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
533
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
534
-        $request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'explain');
535
-        return $this->sendRequest($request);
536
-    }
537
-    /**
538
-     * Returns the information about the capabilities of fields among multiple indices.
539
-     *
540
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html
541
-     *
542
-     * @param array{
543
-     *     index: list, //  A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
544
-     *     fields: list, // A comma-separated list of field names
545
-     *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
546
-     *     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)
547
-     *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
548
-     *     include_unmapped: boolean, // Indicates whether unmapped fields should be included in the response.
549
-     *     filters: list, // An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent
550
-     *     types: list, // Only return results for fields that have one of the types in the list
551
-     *     include_empty_fields: boolean, // Include empty fields in result
552
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
553
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
554
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
555
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
556
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
557
-     *     body: array, //  An index filter specified with the Query DSL
558
-     * } $params
559
-     *
560
-     * @throws NoNodeAvailableException if all the hosts are offline
561
-     * @throws ClientResponseException if the status code of response is 4xx
562
-     * @throws ServerResponseException if the status code of response is 5xx
563
-     *
564
-     * @return Elasticsearch|Promise
565
-     */
566
-    public function fieldCaps(array $params = [])
567
-    {
568
-        if (isset($params['index'])) {
569
-            $url = '/' . $this->encode($params['index']) . '/_field_caps';
570
-            $method = empty($params['body']) ? 'GET' : 'POST';
571
-        } else {
572
-            $url = '/_field_caps';
573
-            $method = empty($params['body']) ? 'GET' : 'POST';
574
-        }
575
-        $url = $this->addQueryString($url, $params, ['fields', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'include_unmapped', 'filters', 'types', 'include_empty_fields', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
576
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
577
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
578
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'field_caps');
579
-        return $this->sendRequest($request);
580
-    }
581
-    /**
582
-     * Returns a document.
583
-     *
584
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html
585
-     *
586
-     * @param array{
587
-     *     id: string, // (REQUIRED) The document ID
588
-     *     index: string, // (REQUIRED) The name of the index
589
-     *     force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index.
590
-     *     stored_fields: list, // A comma-separated list of stored fields to return in the response
591
-     *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
592
-     *     realtime: boolean, // Specify whether to perform the operation in realtime or search mode
593
-     *     refresh: boolean, // Refresh the shard containing the document before performing the operation
594
-     *     routing: string, // Specific routing value
595
-     *     _source: list, // True or false to return the _source field or not, or a list of fields to return
596
-     *     _source_excludes: list, // A list of fields to exclude from the returned _source field
597
-     *     _source_includes: list, // A list of fields to extract and return from the _source field
598
-     *     version: number, // Explicit version number for concurrency control
599
-     *     version_type: enum, // Specific version type
600
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
601
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
602
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
603
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
604
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
605
-     * } $params
606
-     *
607
-     * @throws MissingParameterException if a required parameter is missing
608
-     * @throws NoNodeAvailableException if all the hosts are offline
609
-     * @throws ClientResponseException if the status code of response is 4xx
610
-     * @throws ServerResponseException if the status code of response is 5xx
611
-     *
612
-     * @return Elasticsearch|Promise
613
-     */
614
-    public function get(array $params = [])
615
-    {
616
-        $this->checkRequiredParameters(['id', 'index'], $params);
617
-        $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']);
618
-        $method = 'GET';
619
-        $url = $this->addQueryString($url, $params, ['force_synthetic_source', 'stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
620
-        $headers = ['Accept' => 'application/json'];
621
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
622
-        $request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'get');
623
-        return $this->sendRequest($request);
624
-    }
625
-    /**
626
-     * Returns a script.
627
-     *
628
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html
629
-     *
630
-     * @param array{
631
-     *     id: string, // (REQUIRED) Script ID
632
-     *     master_timeout: time, // Specify timeout for connection to master
633
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
634
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
635
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
636
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
637
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
638
-     * } $params
639
-     *
640
-     * @throws MissingParameterException if a required parameter is missing
641
-     * @throws NoNodeAvailableException if all the hosts are offline
642
-     * @throws ClientResponseException if the status code of response is 4xx
643
-     * @throws ServerResponseException if the status code of response is 5xx
644
-     *
645
-     * @return Elasticsearch|Promise
646
-     */
647
-    public function getScript(array $params = [])
648
-    {
649
-        $this->checkRequiredParameters(['id'], $params);
650
-        $url = '/_scripts/' . $this->encode($params['id']);
651
-        $method = 'GET';
652
-        $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
653
-        $headers = ['Accept' => 'application/json'];
654
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
655
-        $request = $this->addOtelAttributes($params, ['id'], $request, 'get_script');
656
-        return $this->sendRequest($request);
657
-    }
658
-    /**
659
-     * Returns all script contexts.
660
-     *
661
-     * @see https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-contexts.html
662
-     *
663
-     * @param array{
664
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
665
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
666
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
667
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
668
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
669
-     * } $params
670
-     *
671
-     * @throws NoNodeAvailableException if all the hosts are offline
672
-     * @throws ClientResponseException if the status code of response is 4xx
673
-     * @throws ServerResponseException if the status code of response is 5xx
674
-     *
675
-     * @return Elasticsearch|Promise
676
-     */
677
-    public function getScriptContext(array $params = [])
678
-    {
679
-        $url = '/_script_context';
680
-        $method = 'GET';
681
-        $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
682
-        $headers = ['Accept' => 'application/json'];
683
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
684
-        $request = $this->addOtelAttributes($params, [], $request, 'get_script_context');
685
-        return $this->sendRequest($request);
686
-    }
687
-    /**
688
-     * Returns available script types, languages and contexts
689
-     *
690
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html
691
-     *
692
-     * @param array{
693
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
694
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
695
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
696
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
697
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
698
-     * } $params
699
-     *
700
-     * @throws NoNodeAvailableException if all the hosts are offline
701
-     * @throws ClientResponseException if the status code of response is 4xx
702
-     * @throws ServerResponseException if the status code of response is 5xx
703
-     *
704
-     * @return Elasticsearch|Promise
705
-     */
706
-    public function getScriptLanguages(array $params = [])
707
-    {
708
-        $url = '/_script_language';
709
-        $method = 'GET';
710
-        $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
711
-        $headers = ['Accept' => 'application/json'];
712
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
713
-        $request = $this->addOtelAttributes($params, [], $request, 'get_script_languages');
714
-        return $this->sendRequest($request);
715
-    }
716
-    /**
717
-     * Returns the source of a document.
718
-     *
719
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html
720
-     *
721
-     * @param array{
722
-     *     id: string, // (REQUIRED) The document ID
723
-     *     index: string, // (REQUIRED) The name of the index
724
-     *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
725
-     *     realtime: boolean, // Specify whether to perform the operation in realtime or search mode
726
-     *     refresh: boolean, // Refresh the shard containing the document before performing the operation
727
-     *     routing: string, // Specific routing value
728
-     *     _source: list, // True or false to return the _source field or not, or a list of fields to return
729
-     *     _source_excludes: list, // A list of fields to exclude from the returned _source field
730
-     *     _source_includes: list, // A list of fields to extract and return from the _source field
731
-     *     version: number, // Explicit version number for concurrency control
732
-     *     version_type: enum, // Specific version type
733
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
734
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
735
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
736
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
737
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
738
-     * } $params
739
-     *
740
-     * @throws MissingParameterException if a required parameter is missing
741
-     * @throws NoNodeAvailableException if all the hosts are offline
742
-     * @throws ClientResponseException if the status code of response is 4xx
743
-     * @throws ServerResponseException if the status code of response is 5xx
744
-     *
745
-     * @return Elasticsearch|Promise
746
-     */
747
-    public function getSource(array $params = [])
748
-    {
749
-        $this->checkRequiredParameters(['id', 'index'], $params);
750
-        $url = '/' . $this->encode($params['index']) . '/_source/' . $this->encode($params['id']);
751
-        $method = 'GET';
752
-        $url = $this->addQueryString($url, $params, ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
753
-        $headers = ['Accept' => 'application/json'];
754
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
755
-        $request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'get_source');
756
-        return $this->sendRequest($request);
757
-    }
758
-    /**
759
-     * Returns the health of the cluster.
760
-     *
761
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/health-api.html
762
-     *
763
-     * @param array{
764
-     *     feature: string, //  A feature of the cluster, as returned by the top-level health API
765
-     *     timeout: time, // Explicit operation timeout
766
-     *     verbose: boolean, // Opt in for more information about the health of the system
767
-     *     size: int, // Limit the number of affected resources the health API returns
768
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
769
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
770
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
771
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
772
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
773
-     * } $params
774
-     *
775
-     * @throws NoNodeAvailableException if all the hosts are offline
776
-     * @throws ClientResponseException if the status code of response is 4xx
777
-     * @throws ServerResponseException if the status code of response is 5xx
778
-     *
779
-     * @return Elasticsearch|Promise
780
-     */
781
-    public function healthReport(array $params = [])
782
-    {
783
-        if (isset($params['feature'])) {
784
-            $url = '/_health_report/' . $this->encode($params['feature']);
785
-            $method = 'GET';
786
-        } else {
787
-            $url = '/_health_report';
788
-            $method = 'GET';
789
-        }
790
-        $url = $this->addQueryString($url, $params, ['timeout', 'verbose', 'size', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
791
-        $headers = ['Accept' => 'application/json'];
792
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
793
-        $request = $this->addOtelAttributes($params, ['feature'], $request, 'health_report');
794
-        return $this->sendRequest($request);
795
-    }
796
-    /**
797
-     * Creates or updates a document in an index.
798
-     *
799
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html
800
-     *
801
-     * @param array{
802
-     *     id: string, //  Document ID
803
-     *     index: string, // (REQUIRED) The name of the index
804
-     *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
805
-     *     op_type: enum, // Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID
806
-     *     refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
807
-     *     routing: string, // Specific routing value
808
-     *     timeout: time, // Explicit operation timeout
809
-     *     version: number, // Explicit version number for concurrency control
810
-     *     version_type: enum, // Specific version type
811
-     *     if_seq_no: number, // only perform the index operation if the last operation that has changed the document has the specified sequence number
812
-     *     if_primary_term: number, // only perform the index operation if the last operation that has changed the document has the specified primary term
813
-     *     pipeline: string, // The pipeline id to preprocess incoming documents with
814
-     *     require_alias: boolean, // When true, requires destination to be an alias. Default is false
815
-     *     require_data_stream: boolean, // When true, requires the destination to be a data stream (existing or to-be-created). Default is false
816
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
817
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
818
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
819
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
820
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
821
-     *     body: array, // (REQUIRED) The document
822
-     * } $params
823
-     *
824
-     * @throws MissingParameterException if a required parameter is missing
825
-     * @throws NoNodeAvailableException if all the hosts are offline
826
-     * @throws ClientResponseException if the status code of response is 4xx
827
-     * @throws ServerResponseException if the status code of response is 5xx
828
-     *
829
-     * @return Elasticsearch|Promise
830
-     */
831
-    public function index(array $params = [])
832
-    {
833
-        $this->checkRequiredParameters(['index', 'body'], $params);
834
-        if (isset($params['id'])) {
835
-            $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']);
836
-            $method = 'PUT';
837
-        } else {
838
-            $url = '/' . $this->encode($params['index']) . '/_doc';
839
-            $method = 'POST';
840
-        }
841
-        $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'op_type', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'if_seq_no', 'if_primary_term', 'pipeline', 'require_alias', 'require_data_stream', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
842
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
843
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
844
-        $request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'index');
845
-        return $this->sendRequest($request);
846
-    }
847
-    /**
848
-     * Returns basic information about the cluster.
849
-     *
850
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
851
-     *
852
-     * @param array{
853
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
854
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
855
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
856
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
857
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
858
-     * } $params
859
-     *
860
-     * @throws NoNodeAvailableException if all the hosts are offline
861
-     * @throws ClientResponseException if the status code of response is 4xx
862
-     * @throws ServerResponseException if the status code of response is 5xx
863
-     *
864
-     * @return Elasticsearch|Promise
865
-     */
866
-    public function info(array $params = [])
867
-    {
868
-        $url = '/';
869
-        $method = 'GET';
870
-        $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
871
-        $headers = ['Accept' => 'application/json'];
872
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
873
-        $request = $this->addOtelAttributes($params, [], $request, 'info');
874
-        return $this->sendRequest($request);
875
-    }
876
-    /**
877
-     * Performs a kNN search.
878
-     *
879
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html
880
-     * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
881
-     *
882
-     * @param array{
883
-     *     index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` to perform the operation on all indices
884
-     *     routing: list, // A comma-separated list of specific routing values
885
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
886
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
887
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
888
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
889
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
890
-     *     body: array, //  The search definition
891
-     * } $params
892
-     *
893
-     * @throws MissingParameterException if a required parameter is missing
894
-     * @throws NoNodeAvailableException if all the hosts are offline
895
-     * @throws ClientResponseException if the status code of response is 4xx
896
-     * @throws ServerResponseException if the status code of response is 5xx
897
-     *
898
-     * @return Elasticsearch|Promise
899
-     */
900
-    public function knnSearch(array $params = [])
901
-    {
902
-        $this->checkRequiredParameters(['index'], $params);
903
-        $url = '/' . $this->encode($params['index']) . '/_knn_search';
904
-        $method = empty($params['body']) ? 'GET' : 'POST';
905
-        $url = $this->addQueryString($url, $params, ['routing', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
906
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
907
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
908
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'knn_search');
909
-        return $this->sendRequest($request);
910
-    }
911
-    /**
912
-     * Allows to get multiple documents in one request.
913
-     *
914
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html
915
-     *
916
-     * @param array{
917
-     *     index: string, //  The name of the index
918
-     *     force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index.
919
-     *     stored_fields: list, // A comma-separated list of stored fields to return in the response
920
-     *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
921
-     *     realtime: boolean, // Specify whether to perform the operation in realtime or search mode
922
-     *     refresh: boolean, // Refresh the shard containing the document before performing the operation
923
-     *     routing: string, // Specific routing value
924
-     *     _source: list, // True or false to return the _source field or not, or a list of fields to return
925
-     *     _source_excludes: list, // A list of fields to exclude from the returned _source field
926
-     *     _source_includes: list, // A list of fields to extract and return from the _source field
927
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
928
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
929
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
930
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
931
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
932
-     *     body: array, // (REQUIRED) Document identifiers; can be either `docs` (containing full document information) or `ids` (when index is provided in the URL.
933
-     * } $params
934
-     *
935
-     * @throws NoNodeAvailableException if all the hosts are offline
936
-     * @throws ClientResponseException if the status code of response is 4xx
937
-     * @throws ServerResponseException if the status code of response is 5xx
938
-     *
939
-     * @return Elasticsearch|Promise
940
-     */
941
-    public function mget(array $params = [])
942
-    {
943
-        $this->checkRequiredParameters(['body'], $params);
944
-        if (isset($params['index'])) {
945
-            $url = '/' . $this->encode($params['index']) . '/_mget';
946
-            $method = empty($params['body']) ? 'GET' : 'POST';
947
-        } else {
948
-            $url = '/_mget';
949
-            $method = empty($params['body']) ? 'GET' : 'POST';
950
-        }
951
-        $url = $this->addQueryString($url, $params, ['force_synthetic_source', 'stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
952
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
953
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
954
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'mget');
955
-        return $this->sendRequest($request);
956
-    }
957
-    /**
958
-     * Allows to execute several search operations in one request.
959
-     *
960
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html
961
-     *
962
-     * @param array{
963
-     *     index: list, //  A comma-separated list of index names to use as default
964
-     *     search_type: enum, // Search operation type
965
-     *     max_concurrent_searches: number, // Controls the maximum number of concurrent searches the multi search api will execute
966
-     *     typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response
967
-     *     pre_filter_shard_size: number, // A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.
968
-     *     max_concurrent_shard_requests: number, // The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests
969
-     *     rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response
970
-     *     ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
971
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
972
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
973
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
974
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
975
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
976
-     *     body: array, // (REQUIRED) The request definitions (metadata-search request definition pairs), separated by newlines
977
-     * } $params
978
-     *
979
-     * @throws NoNodeAvailableException if all the hosts are offline
980
-     * @throws ClientResponseException if the status code of response is 4xx
981
-     * @throws ServerResponseException if the status code of response is 5xx
982
-     *
983
-     * @return Elasticsearch|Promise
984
-     */
985
-    public function msearch(array $params = [])
986
-    {
987
-        $this->checkRequiredParameters(['body'], $params);
988
-        if (isset($params['index'])) {
989
-            $url = '/' . $this->encode($params['index']) . '/_msearch';
990
-            $method = empty($params['body']) ? 'GET' : 'POST';
991
-        } else {
992
-            $url = '/_msearch';
993
-            $method = empty($params['body']) ? 'GET' : 'POST';
994
-        }
995
-        $url = $this->addQueryString($url, $params, ['search_type', 'max_concurrent_searches', 'typed_keys', 'pre_filter_shard_size', 'max_concurrent_shard_requests', 'rest_total_hits_as_int', 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
996
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson'];
997
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
998
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'msearch');
999
-        return $this->sendRequest($request);
1000
-    }
1001
-    /**
1002
-     * Allows to execute several search template operations in one request.
1003
-     *
1004
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html
1005
-     *
1006
-     * @param array{
1007
-     *     index: list, //  A comma-separated list of index names to use as default
1008
-     *     search_type: enum, // Search operation type
1009
-     *     typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response
1010
-     *     max_concurrent_searches: number, // Controls the maximum number of concurrent searches the multi search api will execute
1011
-     *     rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response
1012
-     *     ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
1013
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1014
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1015
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1016
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1017
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1018
-     *     body: array, // (REQUIRED) The request definitions (metadata-search request definition pairs), separated by newlines
1019
-     * } $params
1020
-     *
1021
-     * @throws NoNodeAvailableException if all the hosts are offline
1022
-     * @throws ClientResponseException if the status code of response is 4xx
1023
-     * @throws ServerResponseException if the status code of response is 5xx
1024
-     *
1025
-     * @return Elasticsearch|Promise
1026
-     */
1027
-    public function msearchTemplate(array $params = [])
1028
-    {
1029
-        $this->checkRequiredParameters(['body'], $params);
1030
-        if (isset($params['index'])) {
1031
-            $url = '/' . $this->encode($params['index']) . '/_msearch/template';
1032
-            $method = empty($params['body']) ? 'GET' : 'POST';
1033
-        } else {
1034
-            $url = '/_msearch/template';
1035
-            $method = empty($params['body']) ? 'GET' : 'POST';
1036
-        }
1037
-        $url = $this->addQueryString($url, $params, ['search_type', 'typed_keys', 'max_concurrent_searches', 'rest_total_hits_as_int', 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1038
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson'];
1039
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1040
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'msearch_template');
1041
-        return $this->sendRequest($request);
1042
-    }
1043
-    /**
1044
-     * Returns multiple termvectors in one request.
1045
-     *
1046
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html
1047
-     *
1048
-     * @param array{
1049
-     *     index: string, //  The index in which the document resides.
1050
-     *     ids: list, // A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body
1051
-     *     term_statistics: boolean, // Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
1052
-     *     field_statistics: boolean, // Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
1053
-     *     fields: list, // A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body "params" or "docs".
1054
-     *     offsets: boolean, // Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
1055
-     *     positions: boolean, // Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
1056
-     *     payloads: boolean, // Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
1057
-     *     preference: string, // Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body "params" or "docs".
1058
-     *     routing: string, // Specific routing value. Applies to all returned documents unless otherwise specified in body "params" or "docs".
1059
-     *     realtime: boolean, // Specifies if requests are real-time as opposed to near-real-time (default: true).
1060
-     *     version: number, // Explicit version number for concurrency control
1061
-     *     version_type: enum, // Specific version type
1062
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1063
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1064
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1065
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1066
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1067
-     *     body: array, //  Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation.
1068
-     * } $params
1069
-     *
1070
-     * @throws NoNodeAvailableException if all the hosts are offline
1071
-     * @throws ClientResponseException if the status code of response is 4xx
1072
-     * @throws ServerResponseException if the status code of response is 5xx
1073
-     *
1074
-     * @return Elasticsearch|Promise
1075
-     */
1076
-    public function mtermvectors(array $params = [])
1077
-    {
1078
-        if (isset($params['index'])) {
1079
-            $url = '/' . $this->encode($params['index']) . '/_mtermvectors';
1080
-            $method = empty($params['body']) ? 'GET' : 'POST';
1081
-        } else {
1082
-            $url = '/_mtermvectors';
1083
-            $method = empty($params['body']) ? 'GET' : 'POST';
1084
-        }
1085
-        $url = $this->addQueryString($url, $params, ['ids', 'term_statistics', 'field_statistics', 'fields', 'offsets', 'positions', 'payloads', 'preference', 'routing', 'realtime', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1086
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1087
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1088
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'mtermvectors');
1089
-        return $this->sendRequest($request);
1090
-    }
1091
-    /**
1092
-     * Open a point in time that can be used in subsequent searches
1093
-     *
1094
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html
1095
-     *
1096
-     * @param array{
1097
-     *     index: list, // (REQUIRED) A comma-separated list of index names to open point in time; use `_all` or empty string to perform the operation on all indices
1098
-     *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
1099
-     *     routing: string, // Specific routing value
1100
-     *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
1101
-     *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
1102
-     *     keep_alive: string, // Specific the time to live for the point in time
1103
-     *     allow_partial_search_results: boolean, // Specify whether to tolerate shards missing when creating the point-in-time, or otherwise throw an exception. (default: false)
1104
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1105
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1106
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1107
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1108
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1109
-     *     body: array, //  An index_filter specified with the Query DSL
1110
-     * } $params
1111
-     *
1112
-     * @throws MissingParameterException if a required parameter is missing
1113
-     * @throws NoNodeAvailableException if all the hosts are offline
1114
-     * @throws ClientResponseException if the status code of response is 4xx
1115
-     * @throws ServerResponseException if the status code of response is 5xx
1116
-     *
1117
-     * @return Elasticsearch|Promise
1118
-     */
1119
-    public function openPointInTime(array $params = [])
1120
-    {
1121
-        $this->checkRequiredParameters(['index', 'keep_alive'], $params);
1122
-        $url = '/' . $this->encode($params['index']) . '/_pit';
1123
-        $method = 'POST';
1124
-        $url = $this->addQueryString($url, $params, ['preference', 'routing', 'ignore_unavailable', 'expand_wildcards', 'keep_alive', 'allow_partial_search_results', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1125
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1126
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1127
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'open_point_in_time');
1128
-        return $this->sendRequest($request);
1129
-    }
1130
-    /**
1131
-     * Returns whether the cluster is running.
1132
-     *
1133
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
1134
-     *
1135
-     * @param array{
1136
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1137
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1138
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1139
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1140
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1141
-     * } $params
1142
-     *
1143
-     * @throws NoNodeAvailableException if all the hosts are offline
1144
-     * @throws ClientResponseException if the status code of response is 4xx
1145
-     * @throws ServerResponseException if the status code of response is 5xx
1146
-     *
1147
-     * @return Elasticsearch|Promise
1148
-     */
1149
-    public function ping(array $params = [])
1150
-    {
1151
-        $url = '/';
1152
-        $method = 'HEAD';
1153
-        $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
1154
-        $headers = ['Accept' => 'application/json'];
1155
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1156
-        $request = $this->addOtelAttributes($params, [], $request, 'ping');
1157
-        return $this->sendRequest($request);
1158
-    }
1159
-    /**
1160
-     * Creates or updates a script.
1161
-     *
1162
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html
1163
-     *
1164
-     * @param array{
1165
-     *     id: string, // (REQUIRED) Script ID
1166
-     *     context: string, //  Script context
1167
-     *     timeout: time, // Explicit operation timeout
1168
-     *     master_timeout: time, // Specify timeout for connection to master
1169
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1170
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1171
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1172
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1173
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1174
-     *     body: array, // (REQUIRED) The document
1175
-     * } $params
1176
-     *
1177
-     * @throws MissingParameterException if a required parameter is missing
1178
-     * @throws NoNodeAvailableException if all the hosts are offline
1179
-     * @throws ClientResponseException if the status code of response is 4xx
1180
-     * @throws ServerResponseException if the status code of response is 5xx
1181
-     *
1182
-     * @return Elasticsearch|Promise
1183
-     */
1184
-    public function putScript(array $params = [])
1185
-    {
1186
-        $this->checkRequiredParameters(['id', 'body'], $params);
1187
-        if (isset($params['context'])) {
1188
-            $url = '/_scripts/' . $this->encode($params['id']) . '/' . $this->encode($params['context']);
1189
-            $method = 'PUT';
1190
-        } else {
1191
-            $url = '/_scripts/' . $this->encode($params['id']);
1192
-            $method = 'PUT';
1193
-        }
1194
-        $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1195
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1196
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1197
-        $request = $this->addOtelAttributes($params, ['id', 'context'], $request, 'put_script');
1198
-        return $this->sendRequest($request);
1199
-    }
1200
-    /**
1201
-     * Allows to evaluate the quality of ranked search results over a set of typical search queries
1202
-     *
1203
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html
1204
-     *
1205
-     * @param array{
1206
-     *     index: list, //  A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
1207
-     *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
1208
-     *     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)
1209
-     *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
1210
-     *     search_type: enum, // Search operation type
1211
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1212
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1213
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1214
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1215
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1216
-     *     body: array, // (REQUIRED) The ranking evaluation search definition, including search requests, document ratings and ranking metric definition.
1217
-     * } $params
1218
-     *
1219
-     * @throws NoNodeAvailableException if all the hosts are offline
1220
-     * @throws ClientResponseException if the status code of response is 4xx
1221
-     * @throws ServerResponseException if the status code of response is 5xx
1222
-     *
1223
-     * @return Elasticsearch|Promise
1224
-     */
1225
-    public function rankEval(array $params = [])
1226
-    {
1227
-        $this->checkRequiredParameters(['body'], $params);
1228
-        if (isset($params['index'])) {
1229
-            $url = '/' . $this->encode($params['index']) . '/_rank_eval';
1230
-            $method = empty($params['body']) ? 'GET' : 'POST';
1231
-        } else {
1232
-            $url = '/_rank_eval';
1233
-            $method = empty($params['body']) ? 'GET' : 'POST';
1234
-        }
1235
-        $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'search_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1236
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1237
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1238
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'rank_eval');
1239
-        return $this->sendRequest($request);
1240
-    }
1241
-    /**
1242
-     * Allows to copy documents from one index to another, optionally filtering the source
1243
-     * documents by a query, changing the destination index settings, or fetching the
1244
-     * documents from a remote cluster.
1245
-     *
1246
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html
1247
-     *
1248
-     * @param array{
1249
-     *     refresh: boolean, // Should the affected indexes be refreshed?
1250
-     *     timeout: time, // Time each individual bulk request should wait for shards that are unavailable.
1251
-     *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
1252
-     *     wait_for_completion: boolean, // Should the request should block until the reindex is complete.
1253
-     *     requests_per_second: number, // The throttle to set on this request in sub-requests per second. -1 means no throttle.
1254
-     *     scroll: time, // Control how long to keep the search context alive
1255
-     *     slices: number|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`.
1256
-     *     max_docs: number, // Maximum number of documents to process (default: all documents)
1257
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1258
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1259
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1260
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1261
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1262
-     *     body: array, // (REQUIRED) The search definition using the Query DSL and the prototype for the index request.
1263
-     * } $params
1264
-     *
1265
-     * @throws NoNodeAvailableException if all the hosts are offline
1266
-     * @throws ClientResponseException if the status code of response is 4xx
1267
-     * @throws ServerResponseException if the status code of response is 5xx
1268
-     *
1269
-     * @return Elasticsearch|Promise
1270
-     */
1271
-    public function reindex(array $params = [])
1272
-    {
1273
-        $this->checkRequiredParameters(['body'], $params);
1274
-        $url = '/_reindex';
1275
-        $method = 'POST';
1276
-        $url = $this->addQueryString($url, $params, ['refresh', 'timeout', 'wait_for_active_shards', 'wait_for_completion', 'requests_per_second', 'scroll', 'slices', 'max_docs', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1277
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1278
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1279
-        $request = $this->addOtelAttributes($params, [], $request, 'reindex');
1280
-        return $this->sendRequest($request);
1281
-    }
1282
-    /**
1283
-     * Changes the number of requests per second for a particular Reindex operation.
1284
-     *
1285
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html
1286
-     *
1287
-     * @param array{
1288
-     *     task_id: string, // (REQUIRED) The task id to rethrottle
1289
-     *     requests_per_second: number, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
1290
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1291
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1292
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1293
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1294
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1295
-     * } $params
1296
-     *
1297
-     * @throws MissingParameterException if a required parameter is missing
1298
-     * @throws NoNodeAvailableException if all the hosts are offline
1299
-     * @throws ClientResponseException if the status code of response is 4xx
1300
-     * @throws ServerResponseException if the status code of response is 5xx
1301
-     *
1302
-     * @return Elasticsearch|Promise
1303
-     */
1304
-    public function reindexRethrottle(array $params = [])
1305
-    {
1306
-        $this->checkRequiredParameters(['task_id', 'requests_per_second'], $params);
1307
-        $url = '/_reindex/' . $this->encode($params['task_id']) . '/_rethrottle';
1308
-        $method = 'POST';
1309
-        $url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1310
-        $headers = ['Accept' => 'application/json'];
1311
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1312
-        $request = $this->addOtelAttributes($params, ['task_id'], $request, 'reindex_rethrottle');
1313
-        return $this->sendRequest($request);
1314
-    }
1315
-    /**
1316
-     * Allows to use the Mustache language to pre-render a search definition.
1317
-     *
1318
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/render-search-template-api.html
1319
-     *
1320
-     * @param array{
1321
-     *     id: string, //  The id of the stored search template
1322
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1323
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1324
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1325
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1326
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1327
-     *     body: array, //  The search definition template and its params
1328
-     * } $params
1329
-     *
1330
-     * @throws NoNodeAvailableException if all the hosts are offline
1331
-     * @throws ClientResponseException if the status code of response is 4xx
1332
-     * @throws ServerResponseException if the status code of response is 5xx
1333
-     *
1334
-     * @return Elasticsearch|Promise
1335
-     */
1336
-    public function renderSearchTemplate(array $params = [])
1337
-    {
1338
-        if (isset($params['id'])) {
1339
-            $url = '/_render/template/' . $this->encode($params['id']);
1340
-            $method = empty($params['body']) ? 'GET' : 'POST';
1341
-        } else {
1342
-            $url = '/_render/template';
1343
-            $method = empty($params['body']) ? 'GET' : 'POST';
1344
-        }
1345
-        $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
1346
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1347
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1348
-        $request = $this->addOtelAttributes($params, ['id'], $request, 'render_search_template');
1349
-        return $this->sendRequest($request);
1350
-    }
1351
-    /**
1352
-     * Allows an arbitrary script to be executed and a result to be returned
1353
-     *
1354
-     * @see https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html
1355
-     * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
1356
-     *
1357
-     * @param array{
1358
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1359
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1360
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1361
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1362
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1363
-     *     body: array, //  The script to execute
1364
-     * } $params
1365
-     *
1366
-     * @throws NoNodeAvailableException if all the hosts are offline
1367
-     * @throws ClientResponseException if the status code of response is 4xx
1368
-     * @throws ServerResponseException if the status code of response is 5xx
1369
-     *
1370
-     * @return Elasticsearch|Promise
1371
-     */
1372
-    public function scriptsPainlessExecute(array $params = [])
1373
-    {
1374
-        $url = '/_scripts/painless/_execute';
1375
-        $method = empty($params['body']) ? 'GET' : 'POST';
1376
-        $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
1377
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1378
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1379
-        $request = $this->addOtelAttributes($params, [], $request, 'scripts_painless_execute');
1380
-        return $this->sendRequest($request);
1381
-    }
1382
-    /**
1383
-     * Allows to retrieve a large numbers of results from a single search request.
1384
-     *
1385
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll
1386
-     *
1387
-     * @param array{
1388
-     *     scroll_id: string, //  The scroll ID
1389
-     *     scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search
1390
-     *     rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response
1391
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1392
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1393
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1394
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1395
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1396
-     *     body: array, //  The scroll ID if not passed by URL or query parameter.
1397
-     * } $params
1398
-     *
1399
-     * @throws NoNodeAvailableException if all the hosts are offline
1400
-     * @throws ClientResponseException if the status code of response is 4xx
1401
-     * @throws ServerResponseException if the status code of response is 5xx
1402
-     *
1403
-     * @return Elasticsearch|Promise
1404
-     */
1405
-    public function scroll(array $params = [])
1406
-    {
1407
-        if (isset($params['scroll_id'])) {
1408
-            $url = '/_search/scroll/' . $this->encode($params['scroll_id']);
1409
-            $method = empty($params['body']) ? 'GET' : 'POST';
1410
-        } else {
1411
-            $url = '/_search/scroll';
1412
-            $method = empty($params['body']) ? 'GET' : 'POST';
1413
-        }
1414
-        $url = $this->addQueryString($url, $params, ['scroll', 'rest_total_hits_as_int', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1415
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1416
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1417
-        $request = $this->addOtelAttributes($params, ['scroll_id'], $request, 'scroll');
1418
-        return $this->sendRequest($request);
1419
-    }
1420
-    /**
1421
-     * Returns results matching a query.
1422
-     *
1423
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html
1424
-     *
1425
-     * @param array{
1426
-     *     index: list, //  A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
1427
-     *     analyzer: string, // The analyzer to use for the query string
1428
-     *     analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false)
1429
-     *     ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
1430
-     *     default_operator: enum, // The default operator for query string query (AND or OR)
1431
-     *     df: string, // The field to use as default where no field prefix is given in the query string
1432
-     *     explain: boolean, // Specify whether to return detailed information about score computation as part of a hit
1433
-     *     stored_fields: list, // A comma-separated list of stored fields to return as part of a hit
1434
-     *     docvalue_fields: list, // A comma-separated list of fields to return as the docvalue representation of a field for each hit
1435
-     *     from: number, // Starting offset (default: 0)
1436
-     *     force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index.
1437
-     *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
1438
-     *     ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled
1439
-     *     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)
1440
-     *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
1441
-     *     lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
1442
-     *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
1443
-     *     q: string, // Query in the Lucene query string syntax
1444
-     *     routing: list, // A comma-separated list of specific routing values
1445
-     *     scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search
1446
-     *     search_type: enum, // Search operation type
1447
-     *     size: number, // Number of hits to return (default: 10)
1448
-     *     sort: list, // A comma-separated list of <field>:<direction> pairs
1449
-     *     _source: list, // True or false to return the _source field or not, or a list of fields to return
1450
-     *     _source_excludes: list, // A list of fields to exclude from the returned _source field
1451
-     *     _source_includes: list, // A list of fields to extract and return from the _source field
1452
-     *     terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
1453
-     *     stats: list, // Specific 'tag' of the request for logging and statistical purposes
1454
-     *     suggest_field: string, // Specify which field to use for suggestions
1455
-     *     suggest_mode: enum, // Specify suggest mode
1456
-     *     suggest_size: number, // How many suggestions to return in response
1457
-     *     suggest_text: string, // The source text for which the suggestions should be returned
1458
-     *     timeout: time, // Explicit operation timeout
1459
-     *     track_scores: boolean, // Whether to calculate and return scores even if they are not used for sorting
1460
-     *     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.
1461
-     *     allow_partial_search_results: boolean, // Indicate if an error should be returned if there is a partial search failure or timeout
1462
-     *     typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response
1463
-     *     version: boolean, // Specify whether to return document version as part of a hit
1464
-     *     seq_no_primary_term: boolean, // Specify whether to return sequence number and primary term of the last modification of each hit
1465
-     *     request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to index level setting
1466
-     *     batched_reduce_size: number, // The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.
1467
-     *     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
1468
-     *     pre_filter_shard_size: number, // A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.
1469
-     *     rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response
1470
-     *     min_compatible_shard_node: string, // The minimum compatible version that all shards involved in search should have for this request to be successful
1471
-     *     include_named_queries_score: boolean, // Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false)
1472
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1473
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1474
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1475
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1476
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1477
-     *     body: array, //  The search definition using the Query DSL
1478
-     * } $params
1479
-     *
1480
-     * @throws NoNodeAvailableException if all the hosts are offline
1481
-     * @throws ClientResponseException if the status code of response is 4xx
1482
-     * @throws ServerResponseException if the status code of response is 5xx
1483
-     *
1484
-     * @return Elasticsearch|Promise
1485
-     */
1486
-    public function search(array $params = [])
1487
-    {
1488
-        if (isset($params['index'])) {
1489
-            $url = '/' . $this->encode($params['index']) . '/_search';
1490
-            $method = empty($params['body']) ? 'GET' : 'POST';
1491
-        } else {
1492
-            $url = '/_search';
1493
-            $method = empty($params['body']) ? 'GET' : 'POST';
1494
-        }
1495
-        $url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'ccs_minimize_roundtrips', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'force_synthetic_source', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'size', 'sort', '_source', '_source_excludes', '_source_includes', 'terminate_after', 'stats', 'suggest_field', 'suggest_mode', 'suggest_size', 'suggest_text', 'timeout', 'track_scores', 'track_total_hits', 'allow_partial_search_results', 'typed_keys', 'version', 'seq_no_primary_term', 'request_cache', 'batched_reduce_size', 'max_concurrent_shard_requests', 'pre_filter_shard_size', 'rest_total_hits_as_int', 'min_compatible_shard_node', 'include_named_queries_score', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1496
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1497
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1498
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'search');
1499
-        return $this->sendRequest($request);
1500
-    }
1501
-    /**
1502
-     * Searches a vector tile for geospatial values. Returns results as a binary Mapbox vector tile.
1503
-     *
1504
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-vector-tile-api.html
1505
-     * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
1506
-     *
1507
-     * @param array{
1508
-     *     index: list, // (REQUIRED) Comma-separated list of data streams, indices, or aliases to search
1509
-     *     field: string, // (REQUIRED) Field containing geospatial data to return
1510
-     *     zoom: int, // (REQUIRED) Zoom level for the vector tile to search
1511
-     *     x: int, // (REQUIRED) X coordinate for the vector tile to search
1512
-     *     y: int, // (REQUIRED) Y coordinate for the vector tile to search
1513
-     *     exact_bounds: boolean, // If false, the meta layer's feature is the bounding box of the tile. If true, the meta layer's feature is a bounding box resulting from a `geo_bounds` aggregation.
1514
-     *     extent: int, // Size, in pixels, of a side of the vector tile.
1515
-     *     grid_precision: int, // Additional zoom levels available through the aggs layer. Accepts 0-8.
1516
-     *     grid_type: enum, // Determines the geometry type for features in the aggs layer.
1517
-     *     size: int, // Maximum number of features to return in the hits layer. Accepts 0-10000.
1518
-     *     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.
1519
-     *     with_labels: boolean, // If true, the hits and aggs layers will contain additional point features with suggested label positions for the original features.
1520
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1521
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1522
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1523
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1524
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1525
-     *     body: array, //  Search request body.
1526
-     * } $params
1527
-     *
1528
-     * @throws MissingParameterException if a required parameter is missing
1529
-     * @throws NoNodeAvailableException if all the hosts are offline
1530
-     * @throws ClientResponseException if the status code of response is 4xx
1531
-     * @throws ServerResponseException if the status code of response is 5xx
1532
-     *
1533
-     * @return Elasticsearch|Promise
1534
-     */
1535
-    public function searchMvt(array $params = [])
1536
-    {
1537
-        $this->checkRequiredParameters(['index', 'field', 'zoom', 'x', 'y'], $params);
1538
-        $url = '/' . $this->encode($params['index']) . '/_mvt/' . $this->encode($params['field']) . '/' . $this->encode($params['zoom']) . '/' . $this->encode($params['x']) . '/' . $this->encode($params['y']);
1539
-        $method = empty($params['body']) ? 'GET' : 'POST';
1540
-        $url = $this->addQueryString($url, $params, ['exact_bounds', 'extent', 'grid_precision', 'grid_type', 'size', 'track_total_hits', 'with_labels', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1541
-        $headers = ['Accept' => 'application/vnd.mapbox-vector-tile', 'Content-Type' => 'application/json'];
1542
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1543
-        $request = $this->addOtelAttributes($params, ['index', 'field', 'zoom', 'x', 'y'], $request, 'search_mvt');
1544
-        return $this->sendRequest($request);
1545
-    }
1546
-    /**
1547
-     * Returns information about the indices and shards that a search request would be executed against.
1548
-     *
1549
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html
1550
-     *
1551
-     * @param array{
1552
-     *     index: list, //  A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
1553
-     *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
1554
-     *     routing: string, // Specific routing value
1555
-     *     local: boolean, // Return local information, do not retrieve the state from master node (default: false)
1556
-     *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
1557
-     *     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)
1558
-     *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
1559
-     *     master_timeout: time, // Explicit operation timeout for connection to master node
1560
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1561
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1562
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1563
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1564
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1565
-     * } $params
1566
-     *
1567
-     * @throws NoNodeAvailableException if all the hosts are offline
1568
-     * @throws ClientResponseException if the status code of response is 4xx
1569
-     * @throws ServerResponseException if the status code of response is 5xx
1570
-     *
1571
-     * @return Elasticsearch|Promise
1572
-     */
1573
-    public function searchShards(array $params = [])
1574
-    {
1575
-        if (isset($params['index'])) {
1576
-            $url = '/' . $this->encode($params['index']) . '/_search_shards';
1577
-            $method = empty($params['body']) ? 'GET' : 'POST';
1578
-        } else {
1579
-            $url = '/_search_shards';
1580
-            $method = empty($params['body']) ? 'GET' : 'POST';
1581
-        }
1582
-        $url = $this->addQueryString($url, $params, ['preference', 'routing', 'local', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1583
-        $headers = ['Accept' => 'application/json'];
1584
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1585
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'search_shards');
1586
-        return $this->sendRequest($request);
1587
-    }
1588
-    /**
1589
-     * Allows to use the Mustache language to pre-render a search definition.
1590
-     *
1591
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html
1592
-     *
1593
-     * @param array{
1594
-     *     index: list, //  A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
1595
-     *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
1596
-     *     ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled
1597
-     *     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)
1598
-     *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
1599
-     *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
1600
-     *     routing: list, // A comma-separated list of specific routing values
1601
-     *     scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search
1602
-     *     search_type: enum, // Search operation type
1603
-     *     explain: boolean, // Specify whether to return detailed information about score computation as part of a hit
1604
-     *     profile: boolean, // Specify whether to profile the query execution
1605
-     *     typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response
1606
-     *     rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response
1607
-     *     ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
1608
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1609
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1610
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1611
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1612
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1613
-     *     body: array, // (REQUIRED) The search definition template and its params
1614
-     * } $params
1615
-     *
1616
-     * @throws NoNodeAvailableException if all the hosts are offline
1617
-     * @throws ClientResponseException if the status code of response is 4xx
1618
-     * @throws ServerResponseException if the status code of response is 5xx
1619
-     *
1620
-     * @return Elasticsearch|Promise
1621
-     */
1622
-    public function searchTemplate(array $params = [])
1623
-    {
1624
-        $this->checkRequiredParameters(['body'], $params);
1625
-        if (isset($params['index'])) {
1626
-            $url = '/' . $this->encode($params['index']) . '/_search/template';
1627
-            $method = empty($params['body']) ? 'GET' : 'POST';
1628
-        } else {
1629
-            $url = '/_search/template';
1630
-            $method = empty($params['body']) ? 'GET' : 'POST';
1631
-        }
1632
-        $url = $this->addQueryString($url, $params, ['ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'preference', 'routing', 'scroll', 'search_type', 'explain', 'profile', 'typed_keys', 'rest_total_hits_as_int', 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1633
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1634
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1635
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'search_template');
1636
-        return $this->sendRequest($request);
1637
-    }
1638
-    /**
1639
-     * The terms enum API  can be used to discover terms in the index that begin with the provided string. It is designed for low-latency look-ups used in auto-complete scenarios.
1640
-     *
1641
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-terms-enum.html
1642
-     *
1643
-     * @param array{
1644
-     *     index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
1645
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1646
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1647
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1648
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1649
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1650
-     *     body: array, //  field name, string which is the prefix expected in matching terms, timeout and size for max number of results
1651
-     * } $params
1652
-     *
1653
-     * @throws MissingParameterException if a required parameter is missing
1654
-     * @throws NoNodeAvailableException if all the hosts are offline
1655
-     * @throws ClientResponseException if the status code of response is 4xx
1656
-     * @throws ServerResponseException if the status code of response is 5xx
1657
-     *
1658
-     * @return Elasticsearch|Promise
1659
-     */
1660
-    public function termsEnum(array $params = [])
1661
-    {
1662
-        $this->checkRequiredParameters(['index'], $params);
1663
-        $url = '/' . $this->encode($params['index']) . '/_terms_enum';
1664
-        $method = empty($params['body']) ? 'GET' : 'POST';
1665
-        $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
1666
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1667
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1668
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'terms_enum');
1669
-        return $this->sendRequest($request);
1670
-    }
1671
-    /**
1672
-     * Returns information and statistics about terms in the fields of a particular document.
1673
-     *
1674
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html
1675
-     *
1676
-     * @param array{
1677
-     *     index: string, // (REQUIRED) The index in which the document resides.
1678
-     *     id: string, //  The id of the document, when not specified a doc param should be supplied.
1679
-     *     term_statistics: boolean, // Specifies if total term frequency and document frequency should be returned.
1680
-     *     field_statistics: boolean, // Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned.
1681
-     *     fields: list, // A comma-separated list of fields to return.
1682
-     *     offsets: boolean, // Specifies if term offsets should be returned.
1683
-     *     positions: boolean, // Specifies if term positions should be returned.
1684
-     *     payloads: boolean, // Specifies if term payloads should be returned.
1685
-     *     preference: string, // Specify the node or shard the operation should be performed on (default: random).
1686
-     *     routing: string, // Specific routing value.
1687
-     *     realtime: boolean, // Specifies if request is real-time as opposed to near-real-time (default: true).
1688
-     *     version: number, // Explicit version number for concurrency control
1689
-     *     version_type: enum, // Specific version type
1690
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1691
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1692
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1693
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1694
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1695
-     *     body: array, //  Define parameters and or supply a document to get termvectors for. See documentation.
1696
-     * } $params
1697
-     *
1698
-     * @throws MissingParameterException if a required parameter is missing
1699
-     * @throws NoNodeAvailableException if all the hosts are offline
1700
-     * @throws ClientResponseException if the status code of response is 4xx
1701
-     * @throws ServerResponseException if the status code of response is 5xx
1702
-     *
1703
-     * @return Elasticsearch|Promise
1704
-     */
1705
-    public function termvectors(array $params = [])
1706
-    {
1707
-        $this->checkRequiredParameters(['index'], $params);
1708
-        if (isset($params['id'])) {
1709
-            $url = '/' . $this->encode($params['index']) . '/_termvectors/' . $this->encode($params['id']);
1710
-            $method = empty($params['body']) ? 'GET' : 'POST';
1711
-        } else {
1712
-            $url = '/' . $this->encode($params['index']) . '/_termvectors';
1713
-            $method = empty($params['body']) ? 'GET' : 'POST';
1714
-        }
1715
-        $url = $this->addQueryString($url, $params, ['term_statistics', 'field_statistics', 'fields', 'offsets', 'positions', 'payloads', 'preference', 'routing', 'realtime', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1716
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1717
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1718
-        $request = $this->addOtelAttributes($params, ['index', 'id'], $request, 'termvectors');
1719
-        return $this->sendRequest($request);
1720
-    }
1721
-    /**
1722
-     * Updates a document with a script or partial document.
1723
-     *
1724
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html
1725
-     *
1726
-     * @param array{
1727
-     *     id: string, // (REQUIRED) Document ID
1728
-     *     index: string, // (REQUIRED) The name of the index
1729
-     *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
1730
-     *     _source: list, // True or false to return the _source field or not, or a list of fields to return
1731
-     *     _source_excludes: list, // A list of fields to exclude from the returned _source field
1732
-     *     _source_includes: list, // A list of fields to extract and return from the _source field
1733
-     *     lang: string, // The script language (default: painless)
1734
-     *     refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
1735
-     *     retry_on_conflict: number, // Specify how many times should the operation be retried when a conflict occurs (default: 0)
1736
-     *     routing: string, // Specific routing value
1737
-     *     timeout: time, // Explicit operation timeout
1738
-     *     if_seq_no: number, // only perform the update operation if the last operation that has changed the document has the specified sequence number
1739
-     *     if_primary_term: number, // only perform the update operation if the last operation that has changed the document has the specified primary term
1740
-     *     require_alias: boolean, // When true, requires destination is an alias. Default is false
1741
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1742
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1743
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1744
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1745
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1746
-     *     body: array, // (REQUIRED) The request definition requires either `script` or partial `doc`
1747
-     * } $params
1748
-     *
1749
-     * @throws MissingParameterException if a required parameter is missing
1750
-     * @throws NoNodeAvailableException if all the hosts are offline
1751
-     * @throws ClientResponseException if the status code of response is 4xx
1752
-     * @throws ServerResponseException if the status code of response is 5xx
1753
-     *
1754
-     * @return Elasticsearch|Promise
1755
-     */
1756
-    public function update(array $params = [])
1757
-    {
1758
-        $this->checkRequiredParameters(['id', 'index', 'body'], $params);
1759
-        $url = '/' . $this->encode($params['index']) . '/_update/' . $this->encode($params['id']);
1760
-        $method = 'POST';
1761
-        $url = $this->addQueryString($url, $params, ['wait_for_active_shards', '_source', '_source_excludes', '_source_includes', 'lang', 'refresh', 'retry_on_conflict', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1762
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1763
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1764
-        $request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'update');
1765
-        return $this->sendRequest($request);
1766
-    }
1767
-    /**
1768
-     * Performs an update on every document in the index without changing the source,
1769
-     * for example to pick up a mapping change.
1770
-     *
1771
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html
1772
-     *
1773
-     * @param array{
1774
-     *     index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
1775
-     *     analyzer: string, // The analyzer to use for the query string
1776
-     *     analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false)
1777
-     *     default_operator: enum, // The default operator for query string query (AND or OR)
1778
-     *     df: string, // The field to use as default where no field prefix is given in the query string
1779
-     *     from: number, // Starting offset (default: 0)
1780
-     *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
1781
-     *     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)
1782
-     *     conflicts: enum, // What to do when the update by query hits version conflicts?
1783
-     *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
1784
-     *     lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
1785
-     *     pipeline: string, // Ingest pipeline to set on index requests made by this action. (default: none)
1786
-     *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
1787
-     *     q: string, // Query in the Lucene query string syntax
1788
-     *     routing: list, // A comma-separated list of specific routing values
1789
-     *     scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search
1790
-     *     search_type: enum, // Search operation type
1791
-     *     search_timeout: time, // Explicit timeout for each search request. Defaults to no timeout.
1792
-     *     max_docs: number, // Maximum number of documents to process (default: all documents)
1793
-     *     sort: list, // A comma-separated list of <field>:<direction> pairs
1794
-     *     terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
1795
-     *     stats: list, // Specific 'tag' of the request for logging and statistical purposes
1796
-     *     version: boolean, // Specify whether to return document version as part of a hit
1797
-     *     version_type: boolean, // Should the document increment the version number (internal) on hit or not (reindex)
1798
-     *     request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to index level setting
1799
-     *     refresh: boolean, // Should the affected indexes be refreshed?
1800
-     *     timeout: time, // Time each individual bulk request should wait for shards that are unavailable.
1801
-     *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the update by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
1802
-     *     scroll_size: number, // Size on the scroll request powering the update by query
1803
-     *     wait_for_completion: boolean, // Should the request should block until the update by query operation is complete.
1804
-     *     requests_per_second: number, // The throttle to set on this request in sub-requests per second. -1 means no throttle.
1805
-     *     slices: number|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`.
1806
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1807
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1808
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1809
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1810
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1811
-     *     body: array, //  The search definition using the Query DSL
1812
-     * } $params
1813
-     *
1814
-     * @throws MissingParameterException if a required parameter is missing
1815
-     * @throws NoNodeAvailableException if all the hosts are offline
1816
-     * @throws ClientResponseException if the status code of response is 4xx
1817
-     * @throws ServerResponseException if the status code of response is 5xx
1818
-     *
1819
-     * @return Elasticsearch|Promise
1820
-     */
1821
-    public function updateByQuery(array $params = [])
1822
-    {
1823
-        $this->checkRequiredParameters(['index'], $params);
1824
-        $url = '/' . $this->encode($params['index']) . '/_update_by_query';
1825
-        $method = 'POST';
1826
-        $url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'pipeline', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'max_docs', 'sort', 'terminate_after', 'stats', 'version', 'version_type', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1827
-        $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1828
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1829
-        $request = $this->addOtelAttributes($params, ['index'], $request, 'update_by_query');
1830
-        return $this->sendRequest($request);
1831
-    }
1832
-    /**
1833
-     * Changes the number of requests per second for a particular Update By Query operation.
1834
-     *
1835
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html
1836
-     *
1837
-     * @param array{
1838
-     *     task_id: string, // (REQUIRED) The task id to rethrottle
1839
-     *     requests_per_second: number, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
1840
-     *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1841
-     *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1842
-     *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1843
-     *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1844
-     *     filter_path: list, // A comma-separated list of filters used to reduce the response.
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 updateByQueryRethrottle(array $params = [])
1855
-    {
1856
-        $this->checkRequiredParameters(['task_id', 'requests_per_second'], $params);
1857
-        $url = '/_update_by_query/' . $this->encode($params['task_id']) . '/_rethrottle';
1858
-        $method = 'POST';
1859
-        $url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1860
-        $headers = ['Accept' => 'application/json'];
1861
-        $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1862
-        $request = $this->addOtelAttributes($params, ['task_id'], $request, 'update_by_query_rethrottle');
1863
-        return $this->sendRequest($request);
1864
-    }
28
+	/**
29
+	 * Allows to perform multiple index/update/delete operations in a single request.
30
+	 *
31
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html
32
+	 *
33
+	 * @param array{
34
+	 *     index: string, //  Default index for items which don't provide one
35
+	 *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
36
+	 *     refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
37
+	 *     routing: string, // Specific routing value
38
+	 *     timeout: time, // Explicit operation timeout
39
+	 *     type: string, // Default document type for items which don't provide one
40
+	 *     _source: list, // True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request
41
+	 *     _source_excludes: list, // Default list of fields to exclude from the returned _source field, can be overridden on each sub-request
42
+	 *     _source_includes: list, // Default list of fields to extract and return from the _source field, can be overridden on each sub-request
43
+	 *     pipeline: string, // The pipeline id to preprocess incoming documents with
44
+	 *     require_alias: boolean, // Sets require_alias for all incoming documents. Defaults to unset (false)
45
+	 *     require_data_stream: boolean, // When true, requires the destination to be a data stream (existing or to-be-created). Default is false
46
+	 *     list_executed_pipelines: boolean, // Sets list_executed_pipelines for all incoming documents. Defaults to unset (false)
47
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
48
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
49
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
50
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
51
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
52
+	 *     body: array, // (REQUIRED) The operation definition and data (action-data pairs), separated by newlines
53
+	 * } $params
54
+	 *
55
+	 * @throws NoNodeAvailableException if all the hosts are offline
56
+	 * @throws ClientResponseException if the status code of response is 4xx
57
+	 * @throws ServerResponseException if the status code of response is 5xx
58
+	 *
59
+	 * @return Elasticsearch|Promise
60
+	 */
61
+	public function bulk(array $params = [])
62
+	{
63
+		$this->checkRequiredParameters(['body'], $params);
64
+		if (isset($params['index'])) {
65
+			$url = '/' . $this->encode($params['index']) . '/_bulk';
66
+			$method = 'POST';
67
+		} else {
68
+			$url = '/_bulk';
69
+			$method = 'POST';
70
+		}
71
+		$url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'type', '_source', '_source_excludes', '_source_includes', 'pipeline', 'require_alias', 'require_data_stream', 'list_executed_pipelines', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
72
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson'];
73
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
74
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'bulk');
75
+		return $this->sendRequest($request);
76
+	}
77
+	/**
78
+	 * Explicitly clears the search context for a scroll.
79
+	 *
80
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/clear-scroll-api.html
81
+	 *
82
+	 * @param array{
83
+	 *     scroll_id: list, //  A comma-separated list of scroll IDs to clear
84
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
85
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
86
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
87
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
88
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
89
+	 *     body: array, //  A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter
90
+	 * } $params
91
+	 *
92
+	 * @throws NoNodeAvailableException if all the hosts are offline
93
+	 * @throws ClientResponseException if the status code of response is 4xx
94
+	 * @throws ServerResponseException if the status code of response is 5xx
95
+	 *
96
+	 * @return Elasticsearch|Promise
97
+	 */
98
+	public function clearScroll(array $params = [])
99
+	{
100
+		if (isset($params['scroll_id'])) {
101
+			$url = '/_search/scroll/' . $this->encode($params['scroll_id']);
102
+			$method = 'DELETE';
103
+		} else {
104
+			$url = '/_search/scroll';
105
+			$method = 'DELETE';
106
+		}
107
+		$url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
108
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
109
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
110
+		$request = $this->addOtelAttributes($params, ['scroll_id'], $request, 'clear_scroll');
111
+		return $this->sendRequest($request);
112
+	}
113
+	/**
114
+	 * Close a point in time
115
+	 *
116
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html
117
+	 *
118
+	 * @param array{
119
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
120
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
121
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
122
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
123
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
124
+	 *     body: array, //  a point-in-time id to close
125
+	 * } $params
126
+	 *
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 closePointInTime(array $params = [])
134
+	{
135
+		$url = '/_pit';
136
+		$method = 'DELETE';
137
+		$url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
138
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
139
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
140
+		$request = $this->addOtelAttributes($params, [], $request, 'close_point_in_time');
141
+		return $this->sendRequest($request);
142
+	}
143
+	/**
144
+	 * Returns number of documents matching a query.
145
+	 *
146
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html
147
+	 *
148
+	 * @param array{
149
+	 *     index: list, //  A comma-separated list of indices to restrict the results
150
+	 *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
151
+	 *     ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled
152
+	 *     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)
153
+	 *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
154
+	 *     min_score: number, // Include only documents with a specific `_score` value in the result
155
+	 *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
156
+	 *     routing: list, // A comma-separated list of specific routing values
157
+	 *     q: string, // Query in the Lucene query string syntax
158
+	 *     analyzer: string, // The analyzer to use for the query string
159
+	 *     analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false)
160
+	 *     default_operator: enum, // The default operator for query string query (AND or OR)
161
+	 *     df: string, // The field to use as default where no field prefix is given in the query string
162
+	 *     lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
163
+	 *     terminate_after: number, // The maximum count for each shard, upon reaching which the query execution will terminate early
164
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
165
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
166
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
167
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
168
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
169
+	 *     body: array, //  A query to restrict the results specified with the Query DSL (optional)
170
+	 * } $params
171
+	 *
172
+	 * @throws NoNodeAvailableException if all the hosts are offline
173
+	 * @throws ClientResponseException if the status code of response is 4xx
174
+	 * @throws ServerResponseException if the status code of response is 5xx
175
+	 *
176
+	 * @return Elasticsearch|Promise
177
+	 */
178
+	public function count(array $params = [])
179
+	{
180
+		if (isset($params['index'])) {
181
+			$url = '/' . $this->encode($params['index']) . '/_count';
182
+			$method = empty($params['body']) ? 'GET' : 'POST';
183
+		} else {
184
+			$url = '/_count';
185
+			$method = empty($params['body']) ? 'GET' : 'POST';
186
+		}
187
+		$url = $this->addQueryString($url, $params, ['ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'min_score', 'preference', 'routing', 'q', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'terminate_after', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
188
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
189
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
190
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'count');
191
+		return $this->sendRequest($request);
192
+	}
193
+	/**
194
+	 * Creates a new document in the index.
195
+	 *
196
+	 * Returns a 409 response when a document with a same ID already exists in the index.
197
+	 *
198
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html
199
+	 *
200
+	 * @param array{
201
+	 *     id: string, // (REQUIRED) Document ID
202
+	 *     index: string, // (REQUIRED) The name of the index
203
+	 *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
204
+	 *     refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
205
+	 *     routing: string, // Specific routing value
206
+	 *     timeout: time, // Explicit operation timeout
207
+	 *     version: number, // Explicit version number for concurrency control
208
+	 *     version_type: enum, // Specific version type
209
+	 *     pipeline: string, // The pipeline id to preprocess incoming documents with
210
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
211
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
212
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
213
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
214
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
215
+	 *     body: array, // (REQUIRED) The document
216
+	 * } $params
217
+	 *
218
+	 * @throws MissingParameterException if a required parameter is missing
219
+	 * @throws NoNodeAvailableException if all the hosts are offline
220
+	 * @throws ClientResponseException if the status code of response is 4xx
221
+	 * @throws ServerResponseException if the status code of response is 5xx
222
+	 *
223
+	 * @return Elasticsearch|Promise
224
+	 */
225
+	public function create(array $params = [])
226
+	{
227
+		$this->checkRequiredParameters(['id', 'index', 'body'], $params);
228
+		$url = '/' . $this->encode($params['index']) . '/_create/' . $this->encode($params['id']);
229
+		$method = 'PUT';
230
+		$url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'pipeline', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
231
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
232
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
233
+		$request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'create');
234
+		return $this->sendRequest($request);
235
+	}
236
+	/**
237
+	 * Removes a document from the index.
238
+	 *
239
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html
240
+	 *
241
+	 * @param array{
242
+	 *     id: string, // (REQUIRED) The document ID
243
+	 *     index: string, // (REQUIRED) The name of the index
244
+	 *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
245
+	 *     refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
246
+	 *     routing: string, // Specific routing value
247
+	 *     timeout: time, // Explicit operation timeout
248
+	 *     if_seq_no: number, // only perform the delete operation if the last operation that has changed the document has the specified sequence number
249
+	 *     if_primary_term: number, // only perform the delete operation if the last operation that has changed the document has the specified primary term
250
+	 *     version: number, // Explicit version number for concurrency control
251
+	 *     version_type: enum, // Specific version type
252
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
253
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
254
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
255
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
256
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
257
+	 * } $params
258
+	 *
259
+	 * @throws MissingParameterException if a required parameter is missing
260
+	 * @throws NoNodeAvailableException if all the hosts are offline
261
+	 * @throws ClientResponseException if the status code of response is 4xx
262
+	 * @throws ServerResponseException if the status code of response is 5xx
263
+	 *
264
+	 * @return Elasticsearch|Promise
265
+	 */
266
+	public function delete(array $params = [])
267
+	{
268
+		$this->checkRequiredParameters(['id', 'index'], $params);
269
+		$url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']);
270
+		$method = 'DELETE';
271
+		$url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
272
+		$headers = ['Accept' => 'application/json'];
273
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
274
+		$request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'delete');
275
+		return $this->sendRequest($request);
276
+	}
277
+	/**
278
+	 * Deletes documents matching the provided query.
279
+	 *
280
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html
281
+	 *
282
+	 * @param array{
283
+	 *     index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
284
+	 *     analyzer: string, // The analyzer to use for the query string
285
+	 *     analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false)
286
+	 *     default_operator: enum, // The default operator for query string query (AND or OR)
287
+	 *     df: string, // The field to use as default where no field prefix is given in the query string
288
+	 *     from: number, // Starting offset (default: 0)
289
+	 *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
290
+	 *     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)
291
+	 *     conflicts: enum, // What to do when the delete by query hits version conflicts?
292
+	 *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
293
+	 *     lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
294
+	 *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
295
+	 *     q: string, // Query in the Lucene query string syntax
296
+	 *     routing: list, // A comma-separated list of specific routing values
297
+	 *     scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search
298
+	 *     search_type: enum, // Search operation type
299
+	 *     search_timeout: time, // Explicit timeout for each search request. Defaults to no timeout.
300
+	 *     max_docs: number, // Maximum number of documents to process (default: all documents)
301
+	 *     sort: list, // A comma-separated list of <field>:<direction> pairs
302
+	 *     terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
303
+	 *     stats: list, // Specific 'tag' of the request for logging and statistical purposes
304
+	 *     version: boolean, // Specify whether to return document version as part of a hit
305
+	 *     request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to index level setting
306
+	 *     refresh: boolean, // Should the affected indexes be refreshed?
307
+	 *     timeout: time, // Time each individual bulk request should wait for shards that are unavailable.
308
+	 *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
309
+	 *     scroll_size: number, // Size on the scroll request powering the delete by query
310
+	 *     wait_for_completion: boolean, // Should the request should block until the delete by query is complete.
311
+	 *     requests_per_second: number, // The throttle for this request in sub-requests per second. -1 means no throttle.
312
+	 *     slices: number|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`.
313
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
314
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
315
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
316
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
317
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
318
+	 *     body: array, // (REQUIRED) The search definition using the Query DSL
319
+	 * } $params
320
+	 *
321
+	 * @throws MissingParameterException if a required parameter is missing
322
+	 * @throws NoNodeAvailableException if all the hosts are offline
323
+	 * @throws ClientResponseException if the status code of response is 4xx
324
+	 * @throws ServerResponseException if the status code of response is 5xx
325
+	 *
326
+	 * @return Elasticsearch|Promise
327
+	 */
328
+	public function deleteByQuery(array $params = [])
329
+	{
330
+		$this->checkRequiredParameters(['index', 'body'], $params);
331
+		$url = '/' . $this->encode($params['index']) . '/_delete_by_query';
332
+		$method = 'POST';
333
+		$url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'max_docs', 'sort', 'terminate_after', 'stats', 'version', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
334
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
335
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
336
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'delete_by_query');
337
+		return $this->sendRequest($request);
338
+	}
339
+	/**
340
+	 * Changes the number of requests per second for a particular Delete By Query operation.
341
+	 *
342
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html
343
+	 *
344
+	 * @param array{
345
+	 *     task_id: string, // (REQUIRED) The task id to rethrottle
346
+	 *     requests_per_second: number, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
347
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
348
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
349
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
350
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
351
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
352
+	 * } $params
353
+	 *
354
+	 * @throws MissingParameterException if a required parameter is missing
355
+	 * @throws NoNodeAvailableException if all the hosts are offline
356
+	 * @throws ClientResponseException if the status code of response is 4xx
357
+	 * @throws ServerResponseException if the status code of response is 5xx
358
+	 *
359
+	 * @return Elasticsearch|Promise
360
+	 */
361
+	public function deleteByQueryRethrottle(array $params = [])
362
+	{
363
+		$this->checkRequiredParameters(['task_id', 'requests_per_second'], $params);
364
+		$url = '/_delete_by_query/' . $this->encode($params['task_id']) . '/_rethrottle';
365
+		$method = 'POST';
366
+		$url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
367
+		$headers = ['Accept' => 'application/json'];
368
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
369
+		$request = $this->addOtelAttributes($params, ['task_id'], $request, 'delete_by_query_rethrottle');
370
+		return $this->sendRequest($request);
371
+	}
372
+	/**
373
+	 * Deletes a script.
374
+	 *
375
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html
376
+	 *
377
+	 * @param array{
378
+	 *     id: string, // (REQUIRED) Script ID
379
+	 *     timeout: time, // Explicit operation timeout
380
+	 *     master_timeout: time, // Specify timeout for connection to master
381
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
382
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
383
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
384
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
385
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
386
+	 * } $params
387
+	 *
388
+	 * @throws MissingParameterException if a required parameter is missing
389
+	 * @throws NoNodeAvailableException if all the hosts are offline
390
+	 * @throws ClientResponseException if the status code of response is 4xx
391
+	 * @throws ServerResponseException if the status code of response is 5xx
392
+	 *
393
+	 * @return Elasticsearch|Promise
394
+	 */
395
+	public function deleteScript(array $params = [])
396
+	{
397
+		$this->checkRequiredParameters(['id'], $params);
398
+		$url = '/_scripts/' . $this->encode($params['id']);
399
+		$method = 'DELETE';
400
+		$url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
401
+		$headers = ['Accept' => 'application/json'];
402
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
403
+		$request = $this->addOtelAttributes($params, ['id'], $request, 'delete_script');
404
+		return $this->sendRequest($request);
405
+	}
406
+	/**
407
+	 * Returns information about whether a document exists in an index.
408
+	 *
409
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html
410
+	 *
411
+	 * @param array{
412
+	 *     id: string, // (REQUIRED) The document ID
413
+	 *     index: string, // (REQUIRED) The name of the index
414
+	 *     stored_fields: list, // A comma-separated list of stored fields to return in the response
415
+	 *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
416
+	 *     realtime: boolean, // Specify whether to perform the operation in realtime or search mode
417
+	 *     refresh: boolean, // Refresh the shard containing the document before performing the operation
418
+	 *     routing: string, // Specific routing value
419
+	 *     _source: list, // True or false to return the _source field or not, or a list of fields to return
420
+	 *     _source_excludes: list, // A list of fields to exclude from the returned _source field
421
+	 *     _source_includes: list, // A list of fields to extract and return from the _source field
422
+	 *     version: number, // Explicit version number for concurrency control
423
+	 *     version_type: enum, // Specific version type
424
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
425
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
426
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
427
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
428
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
429
+	 * } $params
430
+	 *
431
+	 * @throws MissingParameterException if a required parameter is missing
432
+	 * @throws NoNodeAvailableException if all the hosts are offline
433
+	 * @throws ClientResponseException if the status code of response is 4xx
434
+	 * @throws ServerResponseException if the status code of response is 5xx
435
+	 *
436
+	 * @return Elasticsearch|Promise
437
+	 */
438
+	public function exists(array $params = [])
439
+	{
440
+		$this->checkRequiredParameters(['id', 'index'], $params);
441
+		$url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']);
442
+		$method = 'HEAD';
443
+		$url = $this->addQueryString($url, $params, ['stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
444
+		$headers = ['Accept' => 'application/json'];
445
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
446
+		$request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'exists');
447
+		return $this->sendRequest($request);
448
+	}
449
+	/**
450
+	 * Returns information about whether a document source exists in an index.
451
+	 *
452
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html
453
+	 *
454
+	 * @param array{
455
+	 *     id: string, // (REQUIRED) The document ID
456
+	 *     index: string, // (REQUIRED) The name of the index
457
+	 *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
458
+	 *     realtime: boolean, // Specify whether to perform the operation in realtime or search mode
459
+	 *     refresh: boolean, // Refresh the shard containing the document before performing the operation
460
+	 *     routing: string, // Specific routing value
461
+	 *     _source: list, // True or false to return the _source field or not, or a list of fields to return
462
+	 *     _source_excludes: list, // A list of fields to exclude from the returned _source field
463
+	 *     _source_includes: list, // A list of fields to extract and return from the _source field
464
+	 *     version: number, // Explicit version number for concurrency control
465
+	 *     version_type: enum, // Specific version type
466
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
467
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
468
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
469
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
470
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
471
+	 * } $params
472
+	 *
473
+	 * @throws MissingParameterException if a required parameter is missing
474
+	 * @throws NoNodeAvailableException if all the hosts are offline
475
+	 * @throws ClientResponseException if the status code of response is 4xx
476
+	 * @throws ServerResponseException if the status code of response is 5xx
477
+	 *
478
+	 * @return Elasticsearch|Promise
479
+	 */
480
+	public function existsSource(array $params = [])
481
+	{
482
+		$this->checkRequiredParameters(['id', 'index'], $params);
483
+		$url = '/' . $this->encode($params['index']) . '/_source/' . $this->encode($params['id']);
484
+		$method = 'HEAD';
485
+		$url = $this->addQueryString($url, $params, ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
486
+		$headers = ['Accept' => 'application/json'];
487
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
488
+		$request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'exists_source');
489
+		return $this->sendRequest($request);
490
+	}
491
+	/**
492
+	 * Returns information about why a specific matches (or doesn't match) a query.
493
+	 *
494
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html
495
+	 *
496
+	 * @param array{
497
+	 *     id: string, // (REQUIRED) The document ID
498
+	 *     index: string, // (REQUIRED) The name of the index
499
+	 *     analyze_wildcard: boolean, // Specify whether wildcards and prefix queries in the query string query should be analyzed (default: false)
500
+	 *     analyzer: string, // The analyzer for the query string query
501
+	 *     default_operator: enum, // The default operator for query string query (AND or OR)
502
+	 *     df: string, // The default field for query string query (default: _all)
503
+	 *     stored_fields: list, // A comma-separated list of stored fields to return in the response
504
+	 *     lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
505
+	 *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
506
+	 *     q: string, // Query in the Lucene query string syntax
507
+	 *     routing: string, // Specific routing value
508
+	 *     _source: list, // True or false to return the _source field or not, or a list of fields to return
509
+	 *     _source_excludes: list, // A list of fields to exclude from the returned _source field
510
+	 *     _source_includes: list, // A list of fields to extract and return from the _source field
511
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
512
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
513
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
514
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
515
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
516
+	 *     body: array, //  The query definition using the Query DSL
517
+	 * } $params
518
+	 *
519
+	 * @throws MissingParameterException if a required parameter is missing
520
+	 * @throws NoNodeAvailableException if all the hosts are offline
521
+	 * @throws ClientResponseException if the status code of response is 4xx
522
+	 * @throws ServerResponseException if the status code of response is 5xx
523
+	 *
524
+	 * @return Elasticsearch|Promise
525
+	 */
526
+	public function explain(array $params = [])
527
+	{
528
+		$this->checkRequiredParameters(['id', 'index'], $params);
529
+		$url = '/' . $this->encode($params['index']) . '/_explain/' . $this->encode($params['id']);
530
+		$method = empty($params['body']) ? 'GET' : 'POST';
531
+		$url = $this->addQueryString($url, $params, ['analyze_wildcard', 'analyzer', 'default_operator', 'df', 'stored_fields', 'lenient', 'preference', 'q', 'routing', '_source', '_source_excludes', '_source_includes', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
532
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
533
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
534
+		$request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'explain');
535
+		return $this->sendRequest($request);
536
+	}
537
+	/**
538
+	 * Returns the information about the capabilities of fields among multiple indices.
539
+	 *
540
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html
541
+	 *
542
+	 * @param array{
543
+	 *     index: list, //  A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
544
+	 *     fields: list, // A comma-separated list of field names
545
+	 *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
546
+	 *     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)
547
+	 *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
548
+	 *     include_unmapped: boolean, // Indicates whether unmapped fields should be included in the response.
549
+	 *     filters: list, // An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent
550
+	 *     types: list, // Only return results for fields that have one of the types in the list
551
+	 *     include_empty_fields: boolean, // Include empty fields in result
552
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
553
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
554
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
555
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
556
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
557
+	 *     body: array, //  An index filter specified with the Query DSL
558
+	 * } $params
559
+	 *
560
+	 * @throws NoNodeAvailableException if all the hosts are offline
561
+	 * @throws ClientResponseException if the status code of response is 4xx
562
+	 * @throws ServerResponseException if the status code of response is 5xx
563
+	 *
564
+	 * @return Elasticsearch|Promise
565
+	 */
566
+	public function fieldCaps(array $params = [])
567
+	{
568
+		if (isset($params['index'])) {
569
+			$url = '/' . $this->encode($params['index']) . '/_field_caps';
570
+			$method = empty($params['body']) ? 'GET' : 'POST';
571
+		} else {
572
+			$url = '/_field_caps';
573
+			$method = empty($params['body']) ? 'GET' : 'POST';
574
+		}
575
+		$url = $this->addQueryString($url, $params, ['fields', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'include_unmapped', 'filters', 'types', 'include_empty_fields', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
576
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
577
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
578
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'field_caps');
579
+		return $this->sendRequest($request);
580
+	}
581
+	/**
582
+	 * Returns a document.
583
+	 *
584
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html
585
+	 *
586
+	 * @param array{
587
+	 *     id: string, // (REQUIRED) The document ID
588
+	 *     index: string, // (REQUIRED) The name of the index
589
+	 *     force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index.
590
+	 *     stored_fields: list, // A comma-separated list of stored fields to return in the response
591
+	 *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
592
+	 *     realtime: boolean, // Specify whether to perform the operation in realtime or search mode
593
+	 *     refresh: boolean, // Refresh the shard containing the document before performing the operation
594
+	 *     routing: string, // Specific routing value
595
+	 *     _source: list, // True or false to return the _source field or not, or a list of fields to return
596
+	 *     _source_excludes: list, // A list of fields to exclude from the returned _source field
597
+	 *     _source_includes: list, // A list of fields to extract and return from the _source field
598
+	 *     version: number, // Explicit version number for concurrency control
599
+	 *     version_type: enum, // Specific version type
600
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
601
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
602
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
603
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
604
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
605
+	 * } $params
606
+	 *
607
+	 * @throws MissingParameterException if a required parameter is missing
608
+	 * @throws NoNodeAvailableException if all the hosts are offline
609
+	 * @throws ClientResponseException if the status code of response is 4xx
610
+	 * @throws ServerResponseException if the status code of response is 5xx
611
+	 *
612
+	 * @return Elasticsearch|Promise
613
+	 */
614
+	public function get(array $params = [])
615
+	{
616
+		$this->checkRequiredParameters(['id', 'index'], $params);
617
+		$url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']);
618
+		$method = 'GET';
619
+		$url = $this->addQueryString($url, $params, ['force_synthetic_source', 'stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
620
+		$headers = ['Accept' => 'application/json'];
621
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
622
+		$request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'get');
623
+		return $this->sendRequest($request);
624
+	}
625
+	/**
626
+	 * Returns a script.
627
+	 *
628
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html
629
+	 *
630
+	 * @param array{
631
+	 *     id: string, // (REQUIRED) Script ID
632
+	 *     master_timeout: time, // Specify timeout for connection to master
633
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
634
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
635
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
636
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
637
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
638
+	 * } $params
639
+	 *
640
+	 * @throws MissingParameterException if a required parameter is missing
641
+	 * @throws NoNodeAvailableException if all the hosts are offline
642
+	 * @throws ClientResponseException if the status code of response is 4xx
643
+	 * @throws ServerResponseException if the status code of response is 5xx
644
+	 *
645
+	 * @return Elasticsearch|Promise
646
+	 */
647
+	public function getScript(array $params = [])
648
+	{
649
+		$this->checkRequiredParameters(['id'], $params);
650
+		$url = '/_scripts/' . $this->encode($params['id']);
651
+		$method = 'GET';
652
+		$url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
653
+		$headers = ['Accept' => 'application/json'];
654
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
655
+		$request = $this->addOtelAttributes($params, ['id'], $request, 'get_script');
656
+		return $this->sendRequest($request);
657
+	}
658
+	/**
659
+	 * Returns all script contexts.
660
+	 *
661
+	 * @see https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-contexts.html
662
+	 *
663
+	 * @param array{
664
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
665
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
666
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
667
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
668
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
669
+	 * } $params
670
+	 *
671
+	 * @throws NoNodeAvailableException if all the hosts are offline
672
+	 * @throws ClientResponseException if the status code of response is 4xx
673
+	 * @throws ServerResponseException if the status code of response is 5xx
674
+	 *
675
+	 * @return Elasticsearch|Promise
676
+	 */
677
+	public function getScriptContext(array $params = [])
678
+	{
679
+		$url = '/_script_context';
680
+		$method = 'GET';
681
+		$url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
682
+		$headers = ['Accept' => 'application/json'];
683
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
684
+		$request = $this->addOtelAttributes($params, [], $request, 'get_script_context');
685
+		return $this->sendRequest($request);
686
+	}
687
+	/**
688
+	 * Returns available script types, languages and contexts
689
+	 *
690
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html
691
+	 *
692
+	 * @param array{
693
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
694
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
695
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
696
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
697
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
698
+	 * } $params
699
+	 *
700
+	 * @throws NoNodeAvailableException if all the hosts are offline
701
+	 * @throws ClientResponseException if the status code of response is 4xx
702
+	 * @throws ServerResponseException if the status code of response is 5xx
703
+	 *
704
+	 * @return Elasticsearch|Promise
705
+	 */
706
+	public function getScriptLanguages(array $params = [])
707
+	{
708
+		$url = '/_script_language';
709
+		$method = 'GET';
710
+		$url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
711
+		$headers = ['Accept' => 'application/json'];
712
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
713
+		$request = $this->addOtelAttributes($params, [], $request, 'get_script_languages');
714
+		return $this->sendRequest($request);
715
+	}
716
+	/**
717
+	 * Returns the source of a document.
718
+	 *
719
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html
720
+	 *
721
+	 * @param array{
722
+	 *     id: string, // (REQUIRED) The document ID
723
+	 *     index: string, // (REQUIRED) The name of the index
724
+	 *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
725
+	 *     realtime: boolean, // Specify whether to perform the operation in realtime or search mode
726
+	 *     refresh: boolean, // Refresh the shard containing the document before performing the operation
727
+	 *     routing: string, // Specific routing value
728
+	 *     _source: list, // True or false to return the _source field or not, or a list of fields to return
729
+	 *     _source_excludes: list, // A list of fields to exclude from the returned _source field
730
+	 *     _source_includes: list, // A list of fields to extract and return from the _source field
731
+	 *     version: number, // Explicit version number for concurrency control
732
+	 *     version_type: enum, // Specific version type
733
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
734
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
735
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
736
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
737
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
738
+	 * } $params
739
+	 *
740
+	 * @throws MissingParameterException if a required parameter is missing
741
+	 * @throws NoNodeAvailableException if all the hosts are offline
742
+	 * @throws ClientResponseException if the status code of response is 4xx
743
+	 * @throws ServerResponseException if the status code of response is 5xx
744
+	 *
745
+	 * @return Elasticsearch|Promise
746
+	 */
747
+	public function getSource(array $params = [])
748
+	{
749
+		$this->checkRequiredParameters(['id', 'index'], $params);
750
+		$url = '/' . $this->encode($params['index']) . '/_source/' . $this->encode($params['id']);
751
+		$method = 'GET';
752
+		$url = $this->addQueryString($url, $params, ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
753
+		$headers = ['Accept' => 'application/json'];
754
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
755
+		$request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'get_source');
756
+		return $this->sendRequest($request);
757
+	}
758
+	/**
759
+	 * Returns the health of the cluster.
760
+	 *
761
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/health-api.html
762
+	 *
763
+	 * @param array{
764
+	 *     feature: string, //  A feature of the cluster, as returned by the top-level health API
765
+	 *     timeout: time, // Explicit operation timeout
766
+	 *     verbose: boolean, // Opt in for more information about the health of the system
767
+	 *     size: int, // Limit the number of affected resources the health API returns
768
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
769
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
770
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
771
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
772
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
773
+	 * } $params
774
+	 *
775
+	 * @throws NoNodeAvailableException if all the hosts are offline
776
+	 * @throws ClientResponseException if the status code of response is 4xx
777
+	 * @throws ServerResponseException if the status code of response is 5xx
778
+	 *
779
+	 * @return Elasticsearch|Promise
780
+	 */
781
+	public function healthReport(array $params = [])
782
+	{
783
+		if (isset($params['feature'])) {
784
+			$url = '/_health_report/' . $this->encode($params['feature']);
785
+			$method = 'GET';
786
+		} else {
787
+			$url = '/_health_report';
788
+			$method = 'GET';
789
+		}
790
+		$url = $this->addQueryString($url, $params, ['timeout', 'verbose', 'size', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
791
+		$headers = ['Accept' => 'application/json'];
792
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
793
+		$request = $this->addOtelAttributes($params, ['feature'], $request, 'health_report');
794
+		return $this->sendRequest($request);
795
+	}
796
+	/**
797
+	 * Creates or updates a document in an index.
798
+	 *
799
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html
800
+	 *
801
+	 * @param array{
802
+	 *     id: string, //  Document ID
803
+	 *     index: string, // (REQUIRED) The name of the index
804
+	 *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
805
+	 *     op_type: enum, // Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID
806
+	 *     refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
807
+	 *     routing: string, // Specific routing value
808
+	 *     timeout: time, // Explicit operation timeout
809
+	 *     version: number, // Explicit version number for concurrency control
810
+	 *     version_type: enum, // Specific version type
811
+	 *     if_seq_no: number, // only perform the index operation if the last operation that has changed the document has the specified sequence number
812
+	 *     if_primary_term: number, // only perform the index operation if the last operation that has changed the document has the specified primary term
813
+	 *     pipeline: string, // The pipeline id to preprocess incoming documents with
814
+	 *     require_alias: boolean, // When true, requires destination to be an alias. Default is false
815
+	 *     require_data_stream: boolean, // When true, requires the destination to be a data stream (existing or to-be-created). Default is false
816
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
817
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
818
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
819
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
820
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
821
+	 *     body: array, // (REQUIRED) The document
822
+	 * } $params
823
+	 *
824
+	 * @throws MissingParameterException if a required parameter is missing
825
+	 * @throws NoNodeAvailableException if all the hosts are offline
826
+	 * @throws ClientResponseException if the status code of response is 4xx
827
+	 * @throws ServerResponseException if the status code of response is 5xx
828
+	 *
829
+	 * @return Elasticsearch|Promise
830
+	 */
831
+	public function index(array $params = [])
832
+	{
833
+		$this->checkRequiredParameters(['index', 'body'], $params);
834
+		if (isset($params['id'])) {
835
+			$url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']);
836
+			$method = 'PUT';
837
+		} else {
838
+			$url = '/' . $this->encode($params['index']) . '/_doc';
839
+			$method = 'POST';
840
+		}
841
+		$url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'op_type', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'if_seq_no', 'if_primary_term', 'pipeline', 'require_alias', 'require_data_stream', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
842
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
843
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
844
+		$request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'index');
845
+		return $this->sendRequest($request);
846
+	}
847
+	/**
848
+	 * Returns basic information about the cluster.
849
+	 *
850
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
851
+	 *
852
+	 * @param array{
853
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
854
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
855
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
856
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
857
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
858
+	 * } $params
859
+	 *
860
+	 * @throws NoNodeAvailableException if all the hosts are offline
861
+	 * @throws ClientResponseException if the status code of response is 4xx
862
+	 * @throws ServerResponseException if the status code of response is 5xx
863
+	 *
864
+	 * @return Elasticsearch|Promise
865
+	 */
866
+	public function info(array $params = [])
867
+	{
868
+		$url = '/';
869
+		$method = 'GET';
870
+		$url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
871
+		$headers = ['Accept' => 'application/json'];
872
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
873
+		$request = $this->addOtelAttributes($params, [], $request, 'info');
874
+		return $this->sendRequest($request);
875
+	}
876
+	/**
877
+	 * Performs a kNN search.
878
+	 *
879
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html
880
+	 * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
881
+	 *
882
+	 * @param array{
883
+	 *     index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` to perform the operation on all indices
884
+	 *     routing: list, // A comma-separated list of specific routing values
885
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
886
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
887
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
888
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
889
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
890
+	 *     body: array, //  The search definition
891
+	 * } $params
892
+	 *
893
+	 * @throws MissingParameterException if a required parameter is missing
894
+	 * @throws NoNodeAvailableException if all the hosts are offline
895
+	 * @throws ClientResponseException if the status code of response is 4xx
896
+	 * @throws ServerResponseException if the status code of response is 5xx
897
+	 *
898
+	 * @return Elasticsearch|Promise
899
+	 */
900
+	public function knnSearch(array $params = [])
901
+	{
902
+		$this->checkRequiredParameters(['index'], $params);
903
+		$url = '/' . $this->encode($params['index']) . '/_knn_search';
904
+		$method = empty($params['body']) ? 'GET' : 'POST';
905
+		$url = $this->addQueryString($url, $params, ['routing', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
906
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
907
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
908
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'knn_search');
909
+		return $this->sendRequest($request);
910
+	}
911
+	/**
912
+	 * Allows to get multiple documents in one request.
913
+	 *
914
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html
915
+	 *
916
+	 * @param array{
917
+	 *     index: string, //  The name of the index
918
+	 *     force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index.
919
+	 *     stored_fields: list, // A comma-separated list of stored fields to return in the response
920
+	 *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
921
+	 *     realtime: boolean, // Specify whether to perform the operation in realtime or search mode
922
+	 *     refresh: boolean, // Refresh the shard containing the document before performing the operation
923
+	 *     routing: string, // Specific routing value
924
+	 *     _source: list, // True or false to return the _source field or not, or a list of fields to return
925
+	 *     _source_excludes: list, // A list of fields to exclude from the returned _source field
926
+	 *     _source_includes: list, // A list of fields to extract and return from the _source field
927
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
928
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
929
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
930
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
931
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
932
+	 *     body: array, // (REQUIRED) Document identifiers; can be either `docs` (containing full document information) or `ids` (when index is provided in the URL.
933
+	 * } $params
934
+	 *
935
+	 * @throws NoNodeAvailableException if all the hosts are offline
936
+	 * @throws ClientResponseException if the status code of response is 4xx
937
+	 * @throws ServerResponseException if the status code of response is 5xx
938
+	 *
939
+	 * @return Elasticsearch|Promise
940
+	 */
941
+	public function mget(array $params = [])
942
+	{
943
+		$this->checkRequiredParameters(['body'], $params);
944
+		if (isset($params['index'])) {
945
+			$url = '/' . $this->encode($params['index']) . '/_mget';
946
+			$method = empty($params['body']) ? 'GET' : 'POST';
947
+		} else {
948
+			$url = '/_mget';
949
+			$method = empty($params['body']) ? 'GET' : 'POST';
950
+		}
951
+		$url = $this->addQueryString($url, $params, ['force_synthetic_source', 'stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
952
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
953
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
954
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'mget');
955
+		return $this->sendRequest($request);
956
+	}
957
+	/**
958
+	 * Allows to execute several search operations in one request.
959
+	 *
960
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html
961
+	 *
962
+	 * @param array{
963
+	 *     index: list, //  A comma-separated list of index names to use as default
964
+	 *     search_type: enum, // Search operation type
965
+	 *     max_concurrent_searches: number, // Controls the maximum number of concurrent searches the multi search api will execute
966
+	 *     typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response
967
+	 *     pre_filter_shard_size: number, // A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.
968
+	 *     max_concurrent_shard_requests: number, // The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests
969
+	 *     rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response
970
+	 *     ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
971
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
972
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
973
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
974
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
975
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
976
+	 *     body: array, // (REQUIRED) The request definitions (metadata-search request definition pairs), separated by newlines
977
+	 * } $params
978
+	 *
979
+	 * @throws NoNodeAvailableException if all the hosts are offline
980
+	 * @throws ClientResponseException if the status code of response is 4xx
981
+	 * @throws ServerResponseException if the status code of response is 5xx
982
+	 *
983
+	 * @return Elasticsearch|Promise
984
+	 */
985
+	public function msearch(array $params = [])
986
+	{
987
+		$this->checkRequiredParameters(['body'], $params);
988
+		if (isset($params['index'])) {
989
+			$url = '/' . $this->encode($params['index']) . '/_msearch';
990
+			$method = empty($params['body']) ? 'GET' : 'POST';
991
+		} else {
992
+			$url = '/_msearch';
993
+			$method = empty($params['body']) ? 'GET' : 'POST';
994
+		}
995
+		$url = $this->addQueryString($url, $params, ['search_type', 'max_concurrent_searches', 'typed_keys', 'pre_filter_shard_size', 'max_concurrent_shard_requests', 'rest_total_hits_as_int', 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
996
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson'];
997
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
998
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'msearch');
999
+		return $this->sendRequest($request);
1000
+	}
1001
+	/**
1002
+	 * Allows to execute several search template operations in one request.
1003
+	 *
1004
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html
1005
+	 *
1006
+	 * @param array{
1007
+	 *     index: list, //  A comma-separated list of index names to use as default
1008
+	 *     search_type: enum, // Search operation type
1009
+	 *     typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response
1010
+	 *     max_concurrent_searches: number, // Controls the maximum number of concurrent searches the multi search api will execute
1011
+	 *     rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response
1012
+	 *     ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
1013
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1014
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1015
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1016
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1017
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1018
+	 *     body: array, // (REQUIRED) The request definitions (metadata-search request definition pairs), separated by newlines
1019
+	 * } $params
1020
+	 *
1021
+	 * @throws NoNodeAvailableException if all the hosts are offline
1022
+	 * @throws ClientResponseException if the status code of response is 4xx
1023
+	 * @throws ServerResponseException if the status code of response is 5xx
1024
+	 *
1025
+	 * @return Elasticsearch|Promise
1026
+	 */
1027
+	public function msearchTemplate(array $params = [])
1028
+	{
1029
+		$this->checkRequiredParameters(['body'], $params);
1030
+		if (isset($params['index'])) {
1031
+			$url = '/' . $this->encode($params['index']) . '/_msearch/template';
1032
+			$method = empty($params['body']) ? 'GET' : 'POST';
1033
+		} else {
1034
+			$url = '/_msearch/template';
1035
+			$method = empty($params['body']) ? 'GET' : 'POST';
1036
+		}
1037
+		$url = $this->addQueryString($url, $params, ['search_type', 'typed_keys', 'max_concurrent_searches', 'rest_total_hits_as_int', 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1038
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson'];
1039
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1040
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'msearch_template');
1041
+		return $this->sendRequest($request);
1042
+	}
1043
+	/**
1044
+	 * Returns multiple termvectors in one request.
1045
+	 *
1046
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html
1047
+	 *
1048
+	 * @param array{
1049
+	 *     index: string, //  The index in which the document resides.
1050
+	 *     ids: list, // A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body
1051
+	 *     term_statistics: boolean, // Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
1052
+	 *     field_statistics: boolean, // Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
1053
+	 *     fields: list, // A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body "params" or "docs".
1054
+	 *     offsets: boolean, // Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
1055
+	 *     positions: boolean, // Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
1056
+	 *     payloads: boolean, // Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
1057
+	 *     preference: string, // Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body "params" or "docs".
1058
+	 *     routing: string, // Specific routing value. Applies to all returned documents unless otherwise specified in body "params" or "docs".
1059
+	 *     realtime: boolean, // Specifies if requests are real-time as opposed to near-real-time (default: true).
1060
+	 *     version: number, // Explicit version number for concurrency control
1061
+	 *     version_type: enum, // Specific version type
1062
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1063
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1064
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1065
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1066
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1067
+	 *     body: array, //  Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation.
1068
+	 * } $params
1069
+	 *
1070
+	 * @throws NoNodeAvailableException if all the hosts are offline
1071
+	 * @throws ClientResponseException if the status code of response is 4xx
1072
+	 * @throws ServerResponseException if the status code of response is 5xx
1073
+	 *
1074
+	 * @return Elasticsearch|Promise
1075
+	 */
1076
+	public function mtermvectors(array $params = [])
1077
+	{
1078
+		if (isset($params['index'])) {
1079
+			$url = '/' . $this->encode($params['index']) . '/_mtermvectors';
1080
+			$method = empty($params['body']) ? 'GET' : 'POST';
1081
+		} else {
1082
+			$url = '/_mtermvectors';
1083
+			$method = empty($params['body']) ? 'GET' : 'POST';
1084
+		}
1085
+		$url = $this->addQueryString($url, $params, ['ids', 'term_statistics', 'field_statistics', 'fields', 'offsets', 'positions', 'payloads', 'preference', 'routing', 'realtime', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1086
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1087
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1088
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'mtermvectors');
1089
+		return $this->sendRequest($request);
1090
+	}
1091
+	/**
1092
+	 * Open a point in time that can be used in subsequent searches
1093
+	 *
1094
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html
1095
+	 *
1096
+	 * @param array{
1097
+	 *     index: list, // (REQUIRED) A comma-separated list of index names to open point in time; use `_all` or empty string to perform the operation on all indices
1098
+	 *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
1099
+	 *     routing: string, // Specific routing value
1100
+	 *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
1101
+	 *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
1102
+	 *     keep_alive: string, // Specific the time to live for the point in time
1103
+	 *     allow_partial_search_results: boolean, // Specify whether to tolerate shards missing when creating the point-in-time, or otherwise throw an exception. (default: false)
1104
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1105
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1106
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1107
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1108
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1109
+	 *     body: array, //  An index_filter specified with the Query DSL
1110
+	 * } $params
1111
+	 *
1112
+	 * @throws MissingParameterException if a required parameter is missing
1113
+	 * @throws NoNodeAvailableException if all the hosts are offline
1114
+	 * @throws ClientResponseException if the status code of response is 4xx
1115
+	 * @throws ServerResponseException if the status code of response is 5xx
1116
+	 *
1117
+	 * @return Elasticsearch|Promise
1118
+	 */
1119
+	public function openPointInTime(array $params = [])
1120
+	{
1121
+		$this->checkRequiredParameters(['index', 'keep_alive'], $params);
1122
+		$url = '/' . $this->encode($params['index']) . '/_pit';
1123
+		$method = 'POST';
1124
+		$url = $this->addQueryString($url, $params, ['preference', 'routing', 'ignore_unavailable', 'expand_wildcards', 'keep_alive', 'allow_partial_search_results', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1125
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1126
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1127
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'open_point_in_time');
1128
+		return $this->sendRequest($request);
1129
+	}
1130
+	/**
1131
+	 * Returns whether the cluster is running.
1132
+	 *
1133
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
1134
+	 *
1135
+	 * @param array{
1136
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1137
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1138
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1139
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1140
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1141
+	 * } $params
1142
+	 *
1143
+	 * @throws NoNodeAvailableException if all the hosts are offline
1144
+	 * @throws ClientResponseException if the status code of response is 4xx
1145
+	 * @throws ServerResponseException if the status code of response is 5xx
1146
+	 *
1147
+	 * @return Elasticsearch|Promise
1148
+	 */
1149
+	public function ping(array $params = [])
1150
+	{
1151
+		$url = '/';
1152
+		$method = 'HEAD';
1153
+		$url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
1154
+		$headers = ['Accept' => 'application/json'];
1155
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1156
+		$request = $this->addOtelAttributes($params, [], $request, 'ping');
1157
+		return $this->sendRequest($request);
1158
+	}
1159
+	/**
1160
+	 * Creates or updates a script.
1161
+	 *
1162
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html
1163
+	 *
1164
+	 * @param array{
1165
+	 *     id: string, // (REQUIRED) Script ID
1166
+	 *     context: string, //  Script context
1167
+	 *     timeout: time, // Explicit operation timeout
1168
+	 *     master_timeout: time, // Specify timeout for connection to master
1169
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1170
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1171
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1172
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1173
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1174
+	 *     body: array, // (REQUIRED) The document
1175
+	 * } $params
1176
+	 *
1177
+	 * @throws MissingParameterException if a required parameter is missing
1178
+	 * @throws NoNodeAvailableException if all the hosts are offline
1179
+	 * @throws ClientResponseException if the status code of response is 4xx
1180
+	 * @throws ServerResponseException if the status code of response is 5xx
1181
+	 *
1182
+	 * @return Elasticsearch|Promise
1183
+	 */
1184
+	public function putScript(array $params = [])
1185
+	{
1186
+		$this->checkRequiredParameters(['id', 'body'], $params);
1187
+		if (isset($params['context'])) {
1188
+			$url = '/_scripts/' . $this->encode($params['id']) . '/' . $this->encode($params['context']);
1189
+			$method = 'PUT';
1190
+		} else {
1191
+			$url = '/_scripts/' . $this->encode($params['id']);
1192
+			$method = 'PUT';
1193
+		}
1194
+		$url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1195
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1196
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1197
+		$request = $this->addOtelAttributes($params, ['id', 'context'], $request, 'put_script');
1198
+		return $this->sendRequest($request);
1199
+	}
1200
+	/**
1201
+	 * Allows to evaluate the quality of ranked search results over a set of typical search queries
1202
+	 *
1203
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html
1204
+	 *
1205
+	 * @param array{
1206
+	 *     index: list, //  A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
1207
+	 *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
1208
+	 *     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)
1209
+	 *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
1210
+	 *     search_type: enum, // Search operation type
1211
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1212
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1213
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1214
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1215
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1216
+	 *     body: array, // (REQUIRED) The ranking evaluation search definition, including search requests, document ratings and ranking metric definition.
1217
+	 * } $params
1218
+	 *
1219
+	 * @throws NoNodeAvailableException if all the hosts are offline
1220
+	 * @throws ClientResponseException if the status code of response is 4xx
1221
+	 * @throws ServerResponseException if the status code of response is 5xx
1222
+	 *
1223
+	 * @return Elasticsearch|Promise
1224
+	 */
1225
+	public function rankEval(array $params = [])
1226
+	{
1227
+		$this->checkRequiredParameters(['body'], $params);
1228
+		if (isset($params['index'])) {
1229
+			$url = '/' . $this->encode($params['index']) . '/_rank_eval';
1230
+			$method = empty($params['body']) ? 'GET' : 'POST';
1231
+		} else {
1232
+			$url = '/_rank_eval';
1233
+			$method = empty($params['body']) ? 'GET' : 'POST';
1234
+		}
1235
+		$url = $this->addQueryString($url, $params, ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'search_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1236
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1237
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1238
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'rank_eval');
1239
+		return $this->sendRequest($request);
1240
+	}
1241
+	/**
1242
+	 * Allows to copy documents from one index to another, optionally filtering the source
1243
+	 * documents by a query, changing the destination index settings, or fetching the
1244
+	 * documents from a remote cluster.
1245
+	 *
1246
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html
1247
+	 *
1248
+	 * @param array{
1249
+	 *     refresh: boolean, // Should the affected indexes be refreshed?
1250
+	 *     timeout: time, // Time each individual bulk request should wait for shards that are unavailable.
1251
+	 *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
1252
+	 *     wait_for_completion: boolean, // Should the request should block until the reindex is complete.
1253
+	 *     requests_per_second: number, // The throttle to set on this request in sub-requests per second. -1 means no throttle.
1254
+	 *     scroll: time, // Control how long to keep the search context alive
1255
+	 *     slices: number|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`.
1256
+	 *     max_docs: number, // Maximum number of documents to process (default: all documents)
1257
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1258
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1259
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1260
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1261
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1262
+	 *     body: array, // (REQUIRED) The search definition using the Query DSL and the prototype for the index request.
1263
+	 * } $params
1264
+	 *
1265
+	 * @throws NoNodeAvailableException if all the hosts are offline
1266
+	 * @throws ClientResponseException if the status code of response is 4xx
1267
+	 * @throws ServerResponseException if the status code of response is 5xx
1268
+	 *
1269
+	 * @return Elasticsearch|Promise
1270
+	 */
1271
+	public function reindex(array $params = [])
1272
+	{
1273
+		$this->checkRequiredParameters(['body'], $params);
1274
+		$url = '/_reindex';
1275
+		$method = 'POST';
1276
+		$url = $this->addQueryString($url, $params, ['refresh', 'timeout', 'wait_for_active_shards', 'wait_for_completion', 'requests_per_second', 'scroll', 'slices', 'max_docs', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1277
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1278
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1279
+		$request = $this->addOtelAttributes($params, [], $request, 'reindex');
1280
+		return $this->sendRequest($request);
1281
+	}
1282
+	/**
1283
+	 * Changes the number of requests per second for a particular Reindex operation.
1284
+	 *
1285
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html
1286
+	 *
1287
+	 * @param array{
1288
+	 *     task_id: string, // (REQUIRED) The task id to rethrottle
1289
+	 *     requests_per_second: number, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
1290
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1291
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1292
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1293
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1294
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1295
+	 * } $params
1296
+	 *
1297
+	 * @throws MissingParameterException if a required parameter is missing
1298
+	 * @throws NoNodeAvailableException if all the hosts are offline
1299
+	 * @throws ClientResponseException if the status code of response is 4xx
1300
+	 * @throws ServerResponseException if the status code of response is 5xx
1301
+	 *
1302
+	 * @return Elasticsearch|Promise
1303
+	 */
1304
+	public function reindexRethrottle(array $params = [])
1305
+	{
1306
+		$this->checkRequiredParameters(['task_id', 'requests_per_second'], $params);
1307
+		$url = '/_reindex/' . $this->encode($params['task_id']) . '/_rethrottle';
1308
+		$method = 'POST';
1309
+		$url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1310
+		$headers = ['Accept' => 'application/json'];
1311
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1312
+		$request = $this->addOtelAttributes($params, ['task_id'], $request, 'reindex_rethrottle');
1313
+		return $this->sendRequest($request);
1314
+	}
1315
+	/**
1316
+	 * Allows to use the Mustache language to pre-render a search definition.
1317
+	 *
1318
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/render-search-template-api.html
1319
+	 *
1320
+	 * @param array{
1321
+	 *     id: string, //  The id of the stored search template
1322
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1323
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1324
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1325
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1326
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1327
+	 *     body: array, //  The search definition template and its params
1328
+	 * } $params
1329
+	 *
1330
+	 * @throws NoNodeAvailableException if all the hosts are offline
1331
+	 * @throws ClientResponseException if the status code of response is 4xx
1332
+	 * @throws ServerResponseException if the status code of response is 5xx
1333
+	 *
1334
+	 * @return Elasticsearch|Promise
1335
+	 */
1336
+	public function renderSearchTemplate(array $params = [])
1337
+	{
1338
+		if (isset($params['id'])) {
1339
+			$url = '/_render/template/' . $this->encode($params['id']);
1340
+			$method = empty($params['body']) ? 'GET' : 'POST';
1341
+		} else {
1342
+			$url = '/_render/template';
1343
+			$method = empty($params['body']) ? 'GET' : 'POST';
1344
+		}
1345
+		$url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
1346
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1347
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1348
+		$request = $this->addOtelAttributes($params, ['id'], $request, 'render_search_template');
1349
+		return $this->sendRequest($request);
1350
+	}
1351
+	/**
1352
+	 * Allows an arbitrary script to be executed and a result to be returned
1353
+	 *
1354
+	 * @see https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html
1355
+	 * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
1356
+	 *
1357
+	 * @param array{
1358
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1359
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1360
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1361
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1362
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1363
+	 *     body: array, //  The script to execute
1364
+	 * } $params
1365
+	 *
1366
+	 * @throws NoNodeAvailableException if all the hosts are offline
1367
+	 * @throws ClientResponseException if the status code of response is 4xx
1368
+	 * @throws ServerResponseException if the status code of response is 5xx
1369
+	 *
1370
+	 * @return Elasticsearch|Promise
1371
+	 */
1372
+	public function scriptsPainlessExecute(array $params = [])
1373
+	{
1374
+		$url = '/_scripts/painless/_execute';
1375
+		$method = empty($params['body']) ? 'GET' : 'POST';
1376
+		$url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
1377
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1378
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1379
+		$request = $this->addOtelAttributes($params, [], $request, 'scripts_painless_execute');
1380
+		return $this->sendRequest($request);
1381
+	}
1382
+	/**
1383
+	 * Allows to retrieve a large numbers of results from a single search request.
1384
+	 *
1385
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll
1386
+	 *
1387
+	 * @param array{
1388
+	 *     scroll_id: string, //  The scroll ID
1389
+	 *     scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search
1390
+	 *     rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response
1391
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1392
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1393
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1394
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1395
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1396
+	 *     body: array, //  The scroll ID if not passed by URL or query parameter.
1397
+	 * } $params
1398
+	 *
1399
+	 * @throws NoNodeAvailableException if all the hosts are offline
1400
+	 * @throws ClientResponseException if the status code of response is 4xx
1401
+	 * @throws ServerResponseException if the status code of response is 5xx
1402
+	 *
1403
+	 * @return Elasticsearch|Promise
1404
+	 */
1405
+	public function scroll(array $params = [])
1406
+	{
1407
+		if (isset($params['scroll_id'])) {
1408
+			$url = '/_search/scroll/' . $this->encode($params['scroll_id']);
1409
+			$method = empty($params['body']) ? 'GET' : 'POST';
1410
+		} else {
1411
+			$url = '/_search/scroll';
1412
+			$method = empty($params['body']) ? 'GET' : 'POST';
1413
+		}
1414
+		$url = $this->addQueryString($url, $params, ['scroll', 'rest_total_hits_as_int', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1415
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1416
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1417
+		$request = $this->addOtelAttributes($params, ['scroll_id'], $request, 'scroll');
1418
+		return $this->sendRequest($request);
1419
+	}
1420
+	/**
1421
+	 * Returns results matching a query.
1422
+	 *
1423
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html
1424
+	 *
1425
+	 * @param array{
1426
+	 *     index: list, //  A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
1427
+	 *     analyzer: string, // The analyzer to use for the query string
1428
+	 *     analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false)
1429
+	 *     ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
1430
+	 *     default_operator: enum, // The default operator for query string query (AND or OR)
1431
+	 *     df: string, // The field to use as default where no field prefix is given in the query string
1432
+	 *     explain: boolean, // Specify whether to return detailed information about score computation as part of a hit
1433
+	 *     stored_fields: list, // A comma-separated list of stored fields to return as part of a hit
1434
+	 *     docvalue_fields: list, // A comma-separated list of fields to return as the docvalue representation of a field for each hit
1435
+	 *     from: number, // Starting offset (default: 0)
1436
+	 *     force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index.
1437
+	 *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
1438
+	 *     ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled
1439
+	 *     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)
1440
+	 *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
1441
+	 *     lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
1442
+	 *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
1443
+	 *     q: string, // Query in the Lucene query string syntax
1444
+	 *     routing: list, // A comma-separated list of specific routing values
1445
+	 *     scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search
1446
+	 *     search_type: enum, // Search operation type
1447
+	 *     size: number, // Number of hits to return (default: 10)
1448
+	 *     sort: list, // A comma-separated list of <field>:<direction> pairs
1449
+	 *     _source: list, // True or false to return the _source field or not, or a list of fields to return
1450
+	 *     _source_excludes: list, // A list of fields to exclude from the returned _source field
1451
+	 *     _source_includes: list, // A list of fields to extract and return from the _source field
1452
+	 *     terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
1453
+	 *     stats: list, // Specific 'tag' of the request for logging and statistical purposes
1454
+	 *     suggest_field: string, // Specify which field to use for suggestions
1455
+	 *     suggest_mode: enum, // Specify suggest mode
1456
+	 *     suggest_size: number, // How many suggestions to return in response
1457
+	 *     suggest_text: string, // The source text for which the suggestions should be returned
1458
+	 *     timeout: time, // Explicit operation timeout
1459
+	 *     track_scores: boolean, // Whether to calculate and return scores even if they are not used for sorting
1460
+	 *     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.
1461
+	 *     allow_partial_search_results: boolean, // Indicate if an error should be returned if there is a partial search failure or timeout
1462
+	 *     typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response
1463
+	 *     version: boolean, // Specify whether to return document version as part of a hit
1464
+	 *     seq_no_primary_term: boolean, // Specify whether to return sequence number and primary term of the last modification of each hit
1465
+	 *     request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to index level setting
1466
+	 *     batched_reduce_size: number, // The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.
1467
+	 *     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
1468
+	 *     pre_filter_shard_size: number, // A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.
1469
+	 *     rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response
1470
+	 *     min_compatible_shard_node: string, // The minimum compatible version that all shards involved in search should have for this request to be successful
1471
+	 *     include_named_queries_score: boolean, // Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false)
1472
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1473
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1474
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1475
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1476
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1477
+	 *     body: array, //  The search definition using the Query DSL
1478
+	 * } $params
1479
+	 *
1480
+	 * @throws NoNodeAvailableException if all the hosts are offline
1481
+	 * @throws ClientResponseException if the status code of response is 4xx
1482
+	 * @throws ServerResponseException if the status code of response is 5xx
1483
+	 *
1484
+	 * @return Elasticsearch|Promise
1485
+	 */
1486
+	public function search(array $params = [])
1487
+	{
1488
+		if (isset($params['index'])) {
1489
+			$url = '/' . $this->encode($params['index']) . '/_search';
1490
+			$method = empty($params['body']) ? 'GET' : 'POST';
1491
+		} else {
1492
+			$url = '/_search';
1493
+			$method = empty($params['body']) ? 'GET' : 'POST';
1494
+		}
1495
+		$url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'ccs_minimize_roundtrips', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'force_synthetic_source', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'size', 'sort', '_source', '_source_excludes', '_source_includes', 'terminate_after', 'stats', 'suggest_field', 'suggest_mode', 'suggest_size', 'suggest_text', 'timeout', 'track_scores', 'track_total_hits', 'allow_partial_search_results', 'typed_keys', 'version', 'seq_no_primary_term', 'request_cache', 'batched_reduce_size', 'max_concurrent_shard_requests', 'pre_filter_shard_size', 'rest_total_hits_as_int', 'min_compatible_shard_node', 'include_named_queries_score', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1496
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1497
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1498
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'search');
1499
+		return $this->sendRequest($request);
1500
+	}
1501
+	/**
1502
+	 * Searches a vector tile for geospatial values. Returns results as a binary Mapbox vector tile.
1503
+	 *
1504
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-vector-tile-api.html
1505
+	 * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
1506
+	 *
1507
+	 * @param array{
1508
+	 *     index: list, // (REQUIRED) Comma-separated list of data streams, indices, or aliases to search
1509
+	 *     field: string, // (REQUIRED) Field containing geospatial data to return
1510
+	 *     zoom: int, // (REQUIRED) Zoom level for the vector tile to search
1511
+	 *     x: int, // (REQUIRED) X coordinate for the vector tile to search
1512
+	 *     y: int, // (REQUIRED) Y coordinate for the vector tile to search
1513
+	 *     exact_bounds: boolean, // If false, the meta layer's feature is the bounding box of the tile. If true, the meta layer's feature is a bounding box resulting from a `geo_bounds` aggregation.
1514
+	 *     extent: int, // Size, in pixels, of a side of the vector tile.
1515
+	 *     grid_precision: int, // Additional zoom levels available through the aggs layer. Accepts 0-8.
1516
+	 *     grid_type: enum, // Determines the geometry type for features in the aggs layer.
1517
+	 *     size: int, // Maximum number of features to return in the hits layer. Accepts 0-10000.
1518
+	 *     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.
1519
+	 *     with_labels: boolean, // If true, the hits and aggs layers will contain additional point features with suggested label positions for the original features.
1520
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1521
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1522
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1523
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1524
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1525
+	 *     body: array, //  Search request body.
1526
+	 * } $params
1527
+	 *
1528
+	 * @throws MissingParameterException if a required parameter is missing
1529
+	 * @throws NoNodeAvailableException if all the hosts are offline
1530
+	 * @throws ClientResponseException if the status code of response is 4xx
1531
+	 * @throws ServerResponseException if the status code of response is 5xx
1532
+	 *
1533
+	 * @return Elasticsearch|Promise
1534
+	 */
1535
+	public function searchMvt(array $params = [])
1536
+	{
1537
+		$this->checkRequiredParameters(['index', 'field', 'zoom', 'x', 'y'], $params);
1538
+		$url = '/' . $this->encode($params['index']) . '/_mvt/' . $this->encode($params['field']) . '/' . $this->encode($params['zoom']) . '/' . $this->encode($params['x']) . '/' . $this->encode($params['y']);
1539
+		$method = empty($params['body']) ? 'GET' : 'POST';
1540
+		$url = $this->addQueryString($url, $params, ['exact_bounds', 'extent', 'grid_precision', 'grid_type', 'size', 'track_total_hits', 'with_labels', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1541
+		$headers = ['Accept' => 'application/vnd.mapbox-vector-tile', 'Content-Type' => 'application/json'];
1542
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1543
+		$request = $this->addOtelAttributes($params, ['index', 'field', 'zoom', 'x', 'y'], $request, 'search_mvt');
1544
+		return $this->sendRequest($request);
1545
+	}
1546
+	/**
1547
+	 * Returns information about the indices and shards that a search request would be executed against.
1548
+	 *
1549
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html
1550
+	 *
1551
+	 * @param array{
1552
+	 *     index: list, //  A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
1553
+	 *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
1554
+	 *     routing: string, // Specific routing value
1555
+	 *     local: boolean, // Return local information, do not retrieve the state from master node (default: false)
1556
+	 *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
1557
+	 *     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)
1558
+	 *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
1559
+	 *     master_timeout: time, // Explicit operation timeout for connection to master node
1560
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1561
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1562
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1563
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1564
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1565
+	 * } $params
1566
+	 *
1567
+	 * @throws NoNodeAvailableException if all the hosts are offline
1568
+	 * @throws ClientResponseException if the status code of response is 4xx
1569
+	 * @throws ServerResponseException if the status code of response is 5xx
1570
+	 *
1571
+	 * @return Elasticsearch|Promise
1572
+	 */
1573
+	public function searchShards(array $params = [])
1574
+	{
1575
+		if (isset($params['index'])) {
1576
+			$url = '/' . $this->encode($params['index']) . '/_search_shards';
1577
+			$method = empty($params['body']) ? 'GET' : 'POST';
1578
+		} else {
1579
+			$url = '/_search_shards';
1580
+			$method = empty($params['body']) ? 'GET' : 'POST';
1581
+		}
1582
+		$url = $this->addQueryString($url, $params, ['preference', 'routing', 'local', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1583
+		$headers = ['Accept' => 'application/json'];
1584
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1585
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'search_shards');
1586
+		return $this->sendRequest($request);
1587
+	}
1588
+	/**
1589
+	 * Allows to use the Mustache language to pre-render a search definition.
1590
+	 *
1591
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html
1592
+	 *
1593
+	 * @param array{
1594
+	 *     index: list, //  A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
1595
+	 *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
1596
+	 *     ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled
1597
+	 *     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)
1598
+	 *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
1599
+	 *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
1600
+	 *     routing: list, // A comma-separated list of specific routing values
1601
+	 *     scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search
1602
+	 *     search_type: enum, // Search operation type
1603
+	 *     explain: boolean, // Specify whether to return detailed information about score computation as part of a hit
1604
+	 *     profile: boolean, // Specify whether to profile the query execution
1605
+	 *     typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response
1606
+	 *     rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response
1607
+	 *     ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
1608
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1609
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1610
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1611
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1612
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1613
+	 *     body: array, // (REQUIRED) The search definition template and its params
1614
+	 * } $params
1615
+	 *
1616
+	 * @throws NoNodeAvailableException if all the hosts are offline
1617
+	 * @throws ClientResponseException if the status code of response is 4xx
1618
+	 * @throws ServerResponseException if the status code of response is 5xx
1619
+	 *
1620
+	 * @return Elasticsearch|Promise
1621
+	 */
1622
+	public function searchTemplate(array $params = [])
1623
+	{
1624
+		$this->checkRequiredParameters(['body'], $params);
1625
+		if (isset($params['index'])) {
1626
+			$url = '/' . $this->encode($params['index']) . '/_search/template';
1627
+			$method = empty($params['body']) ? 'GET' : 'POST';
1628
+		} else {
1629
+			$url = '/_search/template';
1630
+			$method = empty($params['body']) ? 'GET' : 'POST';
1631
+		}
1632
+		$url = $this->addQueryString($url, $params, ['ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'preference', 'routing', 'scroll', 'search_type', 'explain', 'profile', 'typed_keys', 'rest_total_hits_as_int', 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1633
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1634
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1635
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'search_template');
1636
+		return $this->sendRequest($request);
1637
+	}
1638
+	/**
1639
+	 * The terms enum API  can be used to discover terms in the index that begin with the provided string. It is designed for low-latency look-ups used in auto-complete scenarios.
1640
+	 *
1641
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-terms-enum.html
1642
+	 *
1643
+	 * @param array{
1644
+	 *     index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
1645
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1646
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1647
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1648
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1649
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1650
+	 *     body: array, //  field name, string which is the prefix expected in matching terms, timeout and size for max number of results
1651
+	 * } $params
1652
+	 *
1653
+	 * @throws MissingParameterException if a required parameter is missing
1654
+	 * @throws NoNodeAvailableException if all the hosts are offline
1655
+	 * @throws ClientResponseException if the status code of response is 4xx
1656
+	 * @throws ServerResponseException if the status code of response is 5xx
1657
+	 *
1658
+	 * @return Elasticsearch|Promise
1659
+	 */
1660
+	public function termsEnum(array $params = [])
1661
+	{
1662
+		$this->checkRequiredParameters(['index'], $params);
1663
+		$url = '/' . $this->encode($params['index']) . '/_terms_enum';
1664
+		$method = empty($params['body']) ? 'GET' : 'POST';
1665
+		$url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
1666
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1667
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1668
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'terms_enum');
1669
+		return $this->sendRequest($request);
1670
+	}
1671
+	/**
1672
+	 * Returns information and statistics about terms in the fields of a particular document.
1673
+	 *
1674
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html
1675
+	 *
1676
+	 * @param array{
1677
+	 *     index: string, // (REQUIRED) The index in which the document resides.
1678
+	 *     id: string, //  The id of the document, when not specified a doc param should be supplied.
1679
+	 *     term_statistics: boolean, // Specifies if total term frequency and document frequency should be returned.
1680
+	 *     field_statistics: boolean, // Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned.
1681
+	 *     fields: list, // A comma-separated list of fields to return.
1682
+	 *     offsets: boolean, // Specifies if term offsets should be returned.
1683
+	 *     positions: boolean, // Specifies if term positions should be returned.
1684
+	 *     payloads: boolean, // Specifies if term payloads should be returned.
1685
+	 *     preference: string, // Specify the node or shard the operation should be performed on (default: random).
1686
+	 *     routing: string, // Specific routing value.
1687
+	 *     realtime: boolean, // Specifies if request is real-time as opposed to near-real-time (default: true).
1688
+	 *     version: number, // Explicit version number for concurrency control
1689
+	 *     version_type: enum, // Specific version type
1690
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1691
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1692
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1693
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1694
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1695
+	 *     body: array, //  Define parameters and or supply a document to get termvectors for. See documentation.
1696
+	 * } $params
1697
+	 *
1698
+	 * @throws MissingParameterException if a required parameter is missing
1699
+	 * @throws NoNodeAvailableException if all the hosts are offline
1700
+	 * @throws ClientResponseException if the status code of response is 4xx
1701
+	 * @throws ServerResponseException if the status code of response is 5xx
1702
+	 *
1703
+	 * @return Elasticsearch|Promise
1704
+	 */
1705
+	public function termvectors(array $params = [])
1706
+	{
1707
+		$this->checkRequiredParameters(['index'], $params);
1708
+		if (isset($params['id'])) {
1709
+			$url = '/' . $this->encode($params['index']) . '/_termvectors/' . $this->encode($params['id']);
1710
+			$method = empty($params['body']) ? 'GET' : 'POST';
1711
+		} else {
1712
+			$url = '/' . $this->encode($params['index']) . '/_termvectors';
1713
+			$method = empty($params['body']) ? 'GET' : 'POST';
1714
+		}
1715
+		$url = $this->addQueryString($url, $params, ['term_statistics', 'field_statistics', 'fields', 'offsets', 'positions', 'payloads', 'preference', 'routing', 'realtime', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1716
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1717
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1718
+		$request = $this->addOtelAttributes($params, ['index', 'id'], $request, 'termvectors');
1719
+		return $this->sendRequest($request);
1720
+	}
1721
+	/**
1722
+	 * Updates a document with a script or partial document.
1723
+	 *
1724
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html
1725
+	 *
1726
+	 * @param array{
1727
+	 *     id: string, // (REQUIRED) Document ID
1728
+	 *     index: string, // (REQUIRED) The name of the index
1729
+	 *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
1730
+	 *     _source: list, // True or false to return the _source field or not, or a list of fields to return
1731
+	 *     _source_excludes: list, // A list of fields to exclude from the returned _source field
1732
+	 *     _source_includes: list, // A list of fields to extract and return from the _source field
1733
+	 *     lang: string, // The script language (default: painless)
1734
+	 *     refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
1735
+	 *     retry_on_conflict: number, // Specify how many times should the operation be retried when a conflict occurs (default: 0)
1736
+	 *     routing: string, // Specific routing value
1737
+	 *     timeout: time, // Explicit operation timeout
1738
+	 *     if_seq_no: number, // only perform the update operation if the last operation that has changed the document has the specified sequence number
1739
+	 *     if_primary_term: number, // only perform the update operation if the last operation that has changed the document has the specified primary term
1740
+	 *     require_alias: boolean, // When true, requires destination is an alias. Default is false
1741
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1742
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1743
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1744
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1745
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1746
+	 *     body: array, // (REQUIRED) The request definition requires either `script` or partial `doc`
1747
+	 * } $params
1748
+	 *
1749
+	 * @throws MissingParameterException if a required parameter is missing
1750
+	 * @throws NoNodeAvailableException if all the hosts are offline
1751
+	 * @throws ClientResponseException if the status code of response is 4xx
1752
+	 * @throws ServerResponseException if the status code of response is 5xx
1753
+	 *
1754
+	 * @return Elasticsearch|Promise
1755
+	 */
1756
+	public function update(array $params = [])
1757
+	{
1758
+		$this->checkRequiredParameters(['id', 'index', 'body'], $params);
1759
+		$url = '/' . $this->encode($params['index']) . '/_update/' . $this->encode($params['id']);
1760
+		$method = 'POST';
1761
+		$url = $this->addQueryString($url, $params, ['wait_for_active_shards', '_source', '_source_excludes', '_source_includes', 'lang', 'refresh', 'retry_on_conflict', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1762
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1763
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1764
+		$request = $this->addOtelAttributes($params, ['id', 'index'], $request, 'update');
1765
+		return $this->sendRequest($request);
1766
+	}
1767
+	/**
1768
+	 * Performs an update on every document in the index without changing the source,
1769
+	 * for example to pick up a mapping change.
1770
+	 *
1771
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html
1772
+	 *
1773
+	 * @param array{
1774
+	 *     index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
1775
+	 *     analyzer: string, // The analyzer to use for the query string
1776
+	 *     analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false)
1777
+	 *     default_operator: enum, // The default operator for query string query (AND or OR)
1778
+	 *     df: string, // The field to use as default where no field prefix is given in the query string
1779
+	 *     from: number, // Starting offset (default: 0)
1780
+	 *     ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
1781
+	 *     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)
1782
+	 *     conflicts: enum, // What to do when the update by query hits version conflicts?
1783
+	 *     expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
1784
+	 *     lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
1785
+	 *     pipeline: string, // Ingest pipeline to set on index requests made by this action. (default: none)
1786
+	 *     preference: string, // Specify the node or shard the operation should be performed on (default: random)
1787
+	 *     q: string, // Query in the Lucene query string syntax
1788
+	 *     routing: list, // A comma-separated list of specific routing values
1789
+	 *     scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search
1790
+	 *     search_type: enum, // Search operation type
1791
+	 *     search_timeout: time, // Explicit timeout for each search request. Defaults to no timeout.
1792
+	 *     max_docs: number, // Maximum number of documents to process (default: all documents)
1793
+	 *     sort: list, // A comma-separated list of <field>:<direction> pairs
1794
+	 *     terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
1795
+	 *     stats: list, // Specific 'tag' of the request for logging and statistical purposes
1796
+	 *     version: boolean, // Specify whether to return document version as part of a hit
1797
+	 *     version_type: boolean, // Should the document increment the version number (internal) on hit or not (reindex)
1798
+	 *     request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to index level setting
1799
+	 *     refresh: boolean, // Should the affected indexes be refreshed?
1800
+	 *     timeout: time, // Time each individual bulk request should wait for shards that are unavailable.
1801
+	 *     wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the update by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
1802
+	 *     scroll_size: number, // Size on the scroll request powering the update by query
1803
+	 *     wait_for_completion: boolean, // Should the request should block until the update by query operation is complete.
1804
+	 *     requests_per_second: number, // The throttle to set on this request in sub-requests per second. -1 means no throttle.
1805
+	 *     slices: number|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`.
1806
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1807
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1808
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1809
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1810
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
1811
+	 *     body: array, //  The search definition using the Query DSL
1812
+	 * } $params
1813
+	 *
1814
+	 * @throws MissingParameterException if a required parameter is missing
1815
+	 * @throws NoNodeAvailableException if all the hosts are offline
1816
+	 * @throws ClientResponseException if the status code of response is 4xx
1817
+	 * @throws ServerResponseException if the status code of response is 5xx
1818
+	 *
1819
+	 * @return Elasticsearch|Promise
1820
+	 */
1821
+	public function updateByQuery(array $params = [])
1822
+	{
1823
+		$this->checkRequiredParameters(['index'], $params);
1824
+		$url = '/' . $this->encode($params['index']) . '/_update_by_query';
1825
+		$method = 'POST';
1826
+		$url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'pipeline', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'max_docs', 'sort', 'terminate_after', 'stats', 'version', 'version_type', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1827
+		$headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
1828
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1829
+		$request = $this->addOtelAttributes($params, ['index'], $request, 'update_by_query');
1830
+		return $this->sendRequest($request);
1831
+	}
1832
+	/**
1833
+	 * Changes the number of requests per second for a particular Update By Query operation.
1834
+	 *
1835
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html
1836
+	 *
1837
+	 * @param array{
1838
+	 *     task_id: string, // (REQUIRED) The task id to rethrottle
1839
+	 *     requests_per_second: number, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
1840
+	 *     pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
1841
+	 *     human: boolean, // Return human readable values for statistics. (DEFAULT: true)
1842
+	 *     error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
1843
+	 *     source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
1844
+	 *     filter_path: list, // A comma-separated list of filters used to reduce the response.
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 updateByQueryRethrottle(array $params = [])
1855
+	{
1856
+		$this->checkRequiredParameters(['task_id', 'requests_per_second'], $params);
1857
+		$url = '/_update_by_query/' . $this->encode($params['task_id']) . '/_rethrottle';
1858
+		$method = 'POST';
1859
+		$url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1860
+		$headers = ['Accept' => 'application/json'];
1861
+		$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
1862
+		$request = $this->addOtelAttributes($params, ['task_id'], $request, 'update_by_query_rethrottle');
1863
+		return $this->sendRequest($request);
1864
+	}
1865 1865
 }
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * Elasticsearch B.V licenses this file to you under the MIT License.
12 12
  * See the LICENSE file in the project root for more information.
13 13
  */
14
-declare (strict_types=1);
14
+declare(strict_types=1);
15 15
 namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Traits;
16 16
 
17 17
 use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Exception\ClientResponseException;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     {
63 63
         $this->checkRequiredParameters(['body'], $params);
64 64
         if (isset($params['index'])) {
65
-            $url = '/' . $this->encode($params['index']) . '/_bulk';
65
+            $url = '/'.$this->encode($params['index']).'/_bulk';
66 66
             $method = 'POST';
67 67
         } else {
68 68
             $url = '/_bulk';
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     public function clearScroll(array $params = [])
99 99
     {
100 100
         if (isset($params['scroll_id'])) {
101
-            $url = '/_search/scroll/' . $this->encode($params['scroll_id']);
101
+            $url = '/_search/scroll/'.$this->encode($params['scroll_id']);
102 102
             $method = 'DELETE';
103 103
         } else {
104 104
             $url = '/_search/scroll';
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     public function count(array $params = [])
179 179
     {
180 180
         if (isset($params['index'])) {
181
-            $url = '/' . $this->encode($params['index']) . '/_count';
181
+            $url = '/'.$this->encode($params['index']).'/_count';
182 182
             $method = empty($params['body']) ? 'GET' : 'POST';
183 183
         } else {
184 184
             $url = '/_count';
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     public function create(array $params = [])
226 226
     {
227 227
         $this->checkRequiredParameters(['id', 'index', 'body'], $params);
228
-        $url = '/' . $this->encode($params['index']) . '/_create/' . $this->encode($params['id']);
228
+        $url = '/'.$this->encode($params['index']).'/_create/'.$this->encode($params['id']);
229 229
         $method = 'PUT';
230 230
         $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'pipeline', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
231 231
         $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
     public function delete(array $params = [])
267 267
     {
268 268
         $this->checkRequiredParameters(['id', 'index'], $params);
269
-        $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']);
269
+        $url = '/'.$this->encode($params['index']).'/_doc/'.$this->encode($params['id']);
270 270
         $method = 'DELETE';
271 271
         $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
272 272
         $headers = ['Accept' => 'application/json'];
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
     public function deleteByQuery(array $params = [])
329 329
     {
330 330
         $this->checkRequiredParameters(['index', 'body'], $params);
331
-        $url = '/' . $this->encode($params['index']) . '/_delete_by_query';
331
+        $url = '/'.$this->encode($params['index']).'/_delete_by_query';
332 332
         $method = 'POST';
333 333
         $url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'max_docs', 'sort', 'terminate_after', 'stats', 'version', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
334 334
         $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
     public function deleteByQueryRethrottle(array $params = [])
362 362
     {
363 363
         $this->checkRequiredParameters(['task_id', 'requests_per_second'], $params);
364
-        $url = '/_delete_by_query/' . $this->encode($params['task_id']) . '/_rethrottle';
364
+        $url = '/_delete_by_query/'.$this->encode($params['task_id']).'/_rethrottle';
365 365
         $method = 'POST';
366 366
         $url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
367 367
         $headers = ['Accept' => 'application/json'];
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
     public function deleteScript(array $params = [])
396 396
     {
397 397
         $this->checkRequiredParameters(['id'], $params);
398
-        $url = '/_scripts/' . $this->encode($params['id']);
398
+        $url = '/_scripts/'.$this->encode($params['id']);
399 399
         $method = 'DELETE';
400 400
         $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
401 401
         $headers = ['Accept' => 'application/json'];
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
     public function exists(array $params = [])
439 439
     {
440 440
         $this->checkRequiredParameters(['id', 'index'], $params);
441
-        $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']);
441
+        $url = '/'.$this->encode($params['index']).'/_doc/'.$this->encode($params['id']);
442 442
         $method = 'HEAD';
443 443
         $url = $this->addQueryString($url, $params, ['stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
444 444
         $headers = ['Accept' => 'application/json'];
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
     public function existsSource(array $params = [])
481 481
     {
482 482
         $this->checkRequiredParameters(['id', 'index'], $params);
483
-        $url = '/' . $this->encode($params['index']) . '/_source/' . $this->encode($params['id']);
483
+        $url = '/'.$this->encode($params['index']).'/_source/'.$this->encode($params['id']);
484 484
         $method = 'HEAD';
485 485
         $url = $this->addQueryString($url, $params, ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
486 486
         $headers = ['Accept' => 'application/json'];
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
     public function explain(array $params = [])
527 527
     {
528 528
         $this->checkRequiredParameters(['id', 'index'], $params);
529
-        $url = '/' . $this->encode($params['index']) . '/_explain/' . $this->encode($params['id']);
529
+        $url = '/'.$this->encode($params['index']).'/_explain/'.$this->encode($params['id']);
530 530
         $method = empty($params['body']) ? 'GET' : 'POST';
531 531
         $url = $this->addQueryString($url, $params, ['analyze_wildcard', 'analyzer', 'default_operator', 'df', 'stored_fields', 'lenient', 'preference', 'q', 'routing', '_source', '_source_excludes', '_source_includes', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
532 532
         $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
     public function fieldCaps(array $params = [])
567 567
     {
568 568
         if (isset($params['index'])) {
569
-            $url = '/' . $this->encode($params['index']) . '/_field_caps';
569
+            $url = '/'.$this->encode($params['index']).'/_field_caps';
570 570
             $method = empty($params['body']) ? 'GET' : 'POST';
571 571
         } else {
572 572
             $url = '/_field_caps';
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
     public function get(array $params = [])
615 615
     {
616 616
         $this->checkRequiredParameters(['id', 'index'], $params);
617
-        $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']);
617
+        $url = '/'.$this->encode($params['index']).'/_doc/'.$this->encode($params['id']);
618 618
         $method = 'GET';
619 619
         $url = $this->addQueryString($url, $params, ['force_synthetic_source', 'stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
620 620
         $headers = ['Accept' => 'application/json'];
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
     public function getScript(array $params = [])
648 648
     {
649 649
         $this->checkRequiredParameters(['id'], $params);
650
-        $url = '/_scripts/' . $this->encode($params['id']);
650
+        $url = '/_scripts/'.$this->encode($params['id']);
651 651
         $method = 'GET';
652 652
         $url = $this->addQueryString($url, $params, ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
653 653
         $headers = ['Accept' => 'application/json'];
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
     public function getSource(array $params = [])
748 748
     {
749 749
         $this->checkRequiredParameters(['id', 'index'], $params);
750
-        $url = '/' . $this->encode($params['index']) . '/_source/' . $this->encode($params['id']);
750
+        $url = '/'.$this->encode($params['index']).'/_source/'.$this->encode($params['id']);
751 751
         $method = 'GET';
752 752
         $url = $this->addQueryString($url, $params, ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
753 753
         $headers = ['Accept' => 'application/json'];
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
     public function healthReport(array $params = [])
782 782
     {
783 783
         if (isset($params['feature'])) {
784
-            $url = '/_health_report/' . $this->encode($params['feature']);
784
+            $url = '/_health_report/'.$this->encode($params['feature']);
785 785
             $method = 'GET';
786 786
         } else {
787 787
             $url = '/_health_report';
@@ -832,10 +832,10 @@  discard block
 block discarded – undo
832 832
     {
833 833
         $this->checkRequiredParameters(['index', 'body'], $params);
834 834
         if (isset($params['id'])) {
835
-            $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']);
835
+            $url = '/'.$this->encode($params['index']).'/_doc/'.$this->encode($params['id']);
836 836
             $method = 'PUT';
837 837
         } else {
838
-            $url = '/' . $this->encode($params['index']) . '/_doc';
838
+            $url = '/'.$this->encode($params['index']).'/_doc';
839 839
             $method = 'POST';
840 840
         }
841 841
         $url = $this->addQueryString($url, $params, ['wait_for_active_shards', 'op_type', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'if_seq_no', 'if_primary_term', 'pipeline', 'require_alias', 'require_data_stream', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
     public function knnSearch(array $params = [])
901 901
     {
902 902
         $this->checkRequiredParameters(['index'], $params);
903
-        $url = '/' . $this->encode($params['index']) . '/_knn_search';
903
+        $url = '/'.$this->encode($params['index']).'/_knn_search';
904 904
         $method = empty($params['body']) ? 'GET' : 'POST';
905 905
         $url = $this->addQueryString($url, $params, ['routing', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
906 906
         $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
     {
943 943
         $this->checkRequiredParameters(['body'], $params);
944 944
         if (isset($params['index'])) {
945
-            $url = '/' . $this->encode($params['index']) . '/_mget';
945
+            $url = '/'.$this->encode($params['index']).'/_mget';
946 946
             $method = empty($params['body']) ? 'GET' : 'POST';
947 947
         } else {
948 948
             $url = '/_mget';
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
     {
987 987
         $this->checkRequiredParameters(['body'], $params);
988 988
         if (isset($params['index'])) {
989
-            $url = '/' . $this->encode($params['index']) . '/_msearch';
989
+            $url = '/'.$this->encode($params['index']).'/_msearch';
990 990
             $method = empty($params['body']) ? 'GET' : 'POST';
991 991
         } else {
992 992
             $url = '/_msearch';
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
     {
1029 1029
         $this->checkRequiredParameters(['body'], $params);
1030 1030
         if (isset($params['index'])) {
1031
-            $url = '/' . $this->encode($params['index']) . '/_msearch/template';
1031
+            $url = '/'.$this->encode($params['index']).'/_msearch/template';
1032 1032
             $method = empty($params['body']) ? 'GET' : 'POST';
1033 1033
         } else {
1034 1034
             $url = '/_msearch/template';
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
     public function mtermvectors(array $params = [])
1077 1077
     {
1078 1078
         if (isset($params['index'])) {
1079
-            $url = '/' . $this->encode($params['index']) . '/_mtermvectors';
1079
+            $url = '/'.$this->encode($params['index']).'/_mtermvectors';
1080 1080
             $method = empty($params['body']) ? 'GET' : 'POST';
1081 1081
         } else {
1082 1082
             $url = '/_mtermvectors';
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
     public function openPointInTime(array $params = [])
1120 1120
     {
1121 1121
         $this->checkRequiredParameters(['index', 'keep_alive'], $params);
1122
-        $url = '/' . $this->encode($params['index']) . '/_pit';
1122
+        $url = '/'.$this->encode($params['index']).'/_pit';
1123 1123
         $method = 'POST';
1124 1124
         $url = $this->addQueryString($url, $params, ['preference', 'routing', 'ignore_unavailable', 'expand_wildcards', 'keep_alive', 'allow_partial_search_results', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1125 1125
         $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
@@ -1185,10 +1185,10 @@  discard block
 block discarded – undo
1185 1185
     {
1186 1186
         $this->checkRequiredParameters(['id', 'body'], $params);
1187 1187
         if (isset($params['context'])) {
1188
-            $url = '/_scripts/' . $this->encode($params['id']) . '/' . $this->encode($params['context']);
1188
+            $url = '/_scripts/'.$this->encode($params['id']).'/'.$this->encode($params['context']);
1189 1189
             $method = 'PUT';
1190 1190
         } else {
1191
-            $url = '/_scripts/' . $this->encode($params['id']);
1191
+            $url = '/_scripts/'.$this->encode($params['id']);
1192 1192
             $method = 'PUT';
1193 1193
         }
1194 1194
         $url = $this->addQueryString($url, $params, ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
     {
1227 1227
         $this->checkRequiredParameters(['body'], $params);
1228 1228
         if (isset($params['index'])) {
1229
-            $url = '/' . $this->encode($params['index']) . '/_rank_eval';
1229
+            $url = '/'.$this->encode($params['index']).'/_rank_eval';
1230 1230
             $method = empty($params['body']) ? 'GET' : 'POST';
1231 1231
         } else {
1232 1232
             $url = '/_rank_eval';
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
     public function reindexRethrottle(array $params = [])
1305 1305
     {
1306 1306
         $this->checkRequiredParameters(['task_id', 'requests_per_second'], $params);
1307
-        $url = '/_reindex/' . $this->encode($params['task_id']) . '/_rethrottle';
1307
+        $url = '/_reindex/'.$this->encode($params['task_id']).'/_rethrottle';
1308 1308
         $method = 'POST';
1309 1309
         $url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1310 1310
         $headers = ['Accept' => 'application/json'];
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
     public function renderSearchTemplate(array $params = [])
1337 1337
     {
1338 1338
         if (isset($params['id'])) {
1339
-            $url = '/_render/template/' . $this->encode($params['id']);
1339
+            $url = '/_render/template/'.$this->encode($params['id']);
1340 1340
             $method = empty($params['body']) ? 'GET' : 'POST';
1341 1341
         } else {
1342 1342
             $url = '/_render/template';
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
     public function scroll(array $params = [])
1406 1406
     {
1407 1407
         if (isset($params['scroll_id'])) {
1408
-            $url = '/_search/scroll/' . $this->encode($params['scroll_id']);
1408
+            $url = '/_search/scroll/'.$this->encode($params['scroll_id']);
1409 1409
             $method = empty($params['body']) ? 'GET' : 'POST';
1410 1410
         } else {
1411 1411
             $url = '/_search/scroll';
@@ -1486,7 +1486,7 @@  discard block
 block discarded – undo
1486 1486
     public function search(array $params = [])
1487 1487
     {
1488 1488
         if (isset($params['index'])) {
1489
-            $url = '/' . $this->encode($params['index']) . '/_search';
1489
+            $url = '/'.$this->encode($params['index']).'/_search';
1490 1490
             $method = empty($params['body']) ? 'GET' : 'POST';
1491 1491
         } else {
1492 1492
             $url = '/_search';
@@ -1535,7 +1535,7 @@  discard block
 block discarded – undo
1535 1535
     public function searchMvt(array $params = [])
1536 1536
     {
1537 1537
         $this->checkRequiredParameters(['index', 'field', 'zoom', 'x', 'y'], $params);
1538
-        $url = '/' . $this->encode($params['index']) . '/_mvt/' . $this->encode($params['field']) . '/' . $this->encode($params['zoom']) . '/' . $this->encode($params['x']) . '/' . $this->encode($params['y']);
1538
+        $url = '/'.$this->encode($params['index']).'/_mvt/'.$this->encode($params['field']).'/'.$this->encode($params['zoom']).'/'.$this->encode($params['x']).'/'.$this->encode($params['y']);
1539 1539
         $method = empty($params['body']) ? 'GET' : 'POST';
1540 1540
         $url = $this->addQueryString($url, $params, ['exact_bounds', 'extent', 'grid_precision', 'grid_type', 'size', 'track_total_hits', 'with_labels', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1541 1541
         $headers = ['Accept' => 'application/vnd.mapbox-vector-tile', 'Content-Type' => 'application/json'];
@@ -1573,7 +1573,7 @@  discard block
 block discarded – undo
1573 1573
     public function searchShards(array $params = [])
1574 1574
     {
1575 1575
         if (isset($params['index'])) {
1576
-            $url = '/' . $this->encode($params['index']) . '/_search_shards';
1576
+            $url = '/'.$this->encode($params['index']).'/_search_shards';
1577 1577
             $method = empty($params['body']) ? 'GET' : 'POST';
1578 1578
         } else {
1579 1579
             $url = '/_search_shards';
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
     {
1624 1624
         $this->checkRequiredParameters(['body'], $params);
1625 1625
         if (isset($params['index'])) {
1626
-            $url = '/' . $this->encode($params['index']) . '/_search/template';
1626
+            $url = '/'.$this->encode($params['index']).'/_search/template';
1627 1627
             $method = empty($params['body']) ? 'GET' : 'POST';
1628 1628
         } else {
1629 1629
             $url = '/_search/template';
@@ -1660,7 +1660,7 @@  discard block
 block discarded – undo
1660 1660
     public function termsEnum(array $params = [])
1661 1661
     {
1662 1662
         $this->checkRequiredParameters(['index'], $params);
1663
-        $url = '/' . $this->encode($params['index']) . '/_terms_enum';
1663
+        $url = '/'.$this->encode($params['index']).'/_terms_enum';
1664 1664
         $method = empty($params['body']) ? 'GET' : 'POST';
1665 1665
         $url = $this->addQueryString($url, $params, ['pretty', 'human', 'error_trace', 'source', 'filter_path']);
1666 1666
         $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
@@ -1706,10 +1706,10 @@  discard block
 block discarded – undo
1706 1706
     {
1707 1707
         $this->checkRequiredParameters(['index'], $params);
1708 1708
         if (isset($params['id'])) {
1709
-            $url = '/' . $this->encode($params['index']) . '/_termvectors/' . $this->encode($params['id']);
1709
+            $url = '/'.$this->encode($params['index']).'/_termvectors/'.$this->encode($params['id']);
1710 1710
             $method = empty($params['body']) ? 'GET' : 'POST';
1711 1711
         } else {
1712
-            $url = '/' . $this->encode($params['index']) . '/_termvectors';
1712
+            $url = '/'.$this->encode($params['index']).'/_termvectors';
1713 1713
             $method = empty($params['body']) ? 'GET' : 'POST';
1714 1714
         }
1715 1715
         $url = $this->addQueryString($url, $params, ['term_statistics', 'field_statistics', 'fields', 'offsets', 'positions', 'payloads', 'preference', 'routing', 'realtime', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
@@ -1756,7 +1756,7 @@  discard block
 block discarded – undo
1756 1756
     public function update(array $params = [])
1757 1757
     {
1758 1758
         $this->checkRequiredParameters(['id', 'index', 'body'], $params);
1759
-        $url = '/' . $this->encode($params['index']) . '/_update/' . $this->encode($params['id']);
1759
+        $url = '/'.$this->encode($params['index']).'/_update/'.$this->encode($params['id']);
1760 1760
         $method = 'POST';
1761 1761
         $url = $this->addQueryString($url, $params, ['wait_for_active_shards', '_source', '_source_excludes', '_source_includes', 'lang', 'refresh', 'retry_on_conflict', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1762 1762
         $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
@@ -1821,7 +1821,7 @@  discard block
 block discarded – undo
1821 1821
     public function updateByQuery(array $params = [])
1822 1822
     {
1823 1823
         $this->checkRequiredParameters(['index'], $params);
1824
-        $url = '/' . $this->encode($params['index']) . '/_update_by_query';
1824
+        $url = '/'.$this->encode($params['index']).'/_update_by_query';
1825 1825
         $method = 'POST';
1826 1826
         $url = $this->addQueryString($url, $params, ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'pipeline', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'max_docs', 'sort', 'terminate_after', 'stats', 'version', 'version_type', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1827 1827
         $headers = ['Accept' => 'application/json', 'Content-Type' => 'application/json'];
@@ -1854,7 +1854,7 @@  discard block
 block discarded – undo
1854 1854
     public function updateByQueryRethrottle(array $params = [])
1855 1855
     {
1856 1856
         $this->checkRequiredParameters(['task_id', 'requests_per_second'], $params);
1857
-        $url = '/_update_by_query/' . $this->encode($params['task_id']) . '/_rethrottle';
1857
+        $url = '/_update_by_query/'.$this->encode($params['task_id']).'/_rethrottle';
1858 1858
         $method = 'POST';
1859 1859
         $url = $this->addQueryString($url, $params, ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']);
1860 1860
         $headers = ['Accept' => 'application/json'];
Please login to merge, or discard this patch.
lib/Vendor/Elastic/Elasticsearch/Traits/NamespaceTrait.php 1 patch
Indentation   +289 added lines, -289 removed lines patch added patch discarded remove patch
@@ -60,293 +60,293 @@
 block discarded – undo
60 60
  */
61 61
 trait NamespaceTrait
62 62
 {
63
-    /** The endpoint namespace storage */
64
-    protected array $namespace;
65
-    public function asyncSearch() : AsyncSearch
66
-    {
67
-        if (!isset($this->namespace['AsyncSearch'])) {
68
-            $this->namespace['AsyncSearch'] = new AsyncSearch($this);
69
-        }
70
-        return $this->namespace['AsyncSearch'];
71
-    }
72
-    public function autoscaling() : Autoscaling
73
-    {
74
-        if (!isset($this->namespace['Autoscaling'])) {
75
-            $this->namespace['Autoscaling'] = new Autoscaling($this);
76
-        }
77
-        return $this->namespace['Autoscaling'];
78
-    }
79
-    public function cat() : Cat
80
-    {
81
-        if (!isset($this->namespace['Cat'])) {
82
-            $this->namespace['Cat'] = new Cat($this);
83
-        }
84
-        return $this->namespace['Cat'];
85
-    }
86
-    public function ccr() : Ccr
87
-    {
88
-        if (!isset($this->namespace['Ccr'])) {
89
-            $this->namespace['Ccr'] = new Ccr($this);
90
-        }
91
-        return $this->namespace['Ccr'];
92
-    }
93
-    public function cluster() : Cluster
94
-    {
95
-        if (!isset($this->namespace['Cluster'])) {
96
-            $this->namespace['Cluster'] = new Cluster($this);
97
-        }
98
-        return $this->namespace['Cluster'];
99
-    }
100
-    public function connector() : Connector
101
-    {
102
-        if (!isset($this->namespace['Connector'])) {
103
-            $this->namespace['Connector'] = new Connector($this);
104
-        }
105
-        return $this->namespace['Connector'];
106
-    }
107
-    public function danglingIndices() : DanglingIndices
108
-    {
109
-        if (!isset($this->namespace['DanglingIndices'])) {
110
-            $this->namespace['DanglingIndices'] = new DanglingIndices($this);
111
-        }
112
-        return $this->namespace['DanglingIndices'];
113
-    }
114
-    public function enrich() : Enrich
115
-    {
116
-        if (!isset($this->namespace['Enrich'])) {
117
-            $this->namespace['Enrich'] = new Enrich($this);
118
-        }
119
-        return $this->namespace['Enrich'];
120
-    }
121
-    public function eql() : Eql
122
-    {
123
-        if (!isset($this->namespace['Eql'])) {
124
-            $this->namespace['Eql'] = new Eql($this);
125
-        }
126
-        return $this->namespace['Eql'];
127
-    }
128
-    public function esql() : Esql
129
-    {
130
-        if (!isset($this->namespace['Esql'])) {
131
-            $this->namespace['Esql'] = new Esql($this);
132
-        }
133
-        return $this->namespace['Esql'];
134
-    }
135
-    public function features() : Features
136
-    {
137
-        if (!isset($this->namespace['Features'])) {
138
-            $this->namespace['Features'] = new Features($this);
139
-        }
140
-        return $this->namespace['Features'];
141
-    }
142
-    public function fleet() : Fleet
143
-    {
144
-        if (!isset($this->namespace['Fleet'])) {
145
-            $this->namespace['Fleet'] = new Fleet($this);
146
-        }
147
-        return $this->namespace['Fleet'];
148
-    }
149
-    public function graph() : Graph
150
-    {
151
-        if (!isset($this->namespace['Graph'])) {
152
-            $this->namespace['Graph'] = new Graph($this);
153
-        }
154
-        return $this->namespace['Graph'];
155
-    }
156
-    public function ilm() : Ilm
157
-    {
158
-        if (!isset($this->namespace['Ilm'])) {
159
-            $this->namespace['Ilm'] = new Ilm($this);
160
-        }
161
-        return $this->namespace['Ilm'];
162
-    }
163
-    public function indices() : Indices
164
-    {
165
-        if (!isset($this->namespace['Indices'])) {
166
-            $this->namespace['Indices'] = new Indices($this);
167
-        }
168
-        return $this->namespace['Indices'];
169
-    }
170
-    public function inference() : Inference
171
-    {
172
-        if (!isset($this->namespace['Inference'])) {
173
-            $this->namespace['Inference'] = new Inference($this);
174
-        }
175
-        return $this->namespace['Inference'];
176
-    }
177
-    public function ingest() : Ingest
178
-    {
179
-        if (!isset($this->namespace['Ingest'])) {
180
-            $this->namespace['Ingest'] = new Ingest($this);
181
-        }
182
-        return $this->namespace['Ingest'];
183
-    }
184
-    public function license() : License
185
-    {
186
-        if (!isset($this->namespace['License'])) {
187
-            $this->namespace['License'] = new License($this);
188
-        }
189
-        return $this->namespace['License'];
190
-    }
191
-    public function logstash() : Logstash
192
-    {
193
-        if (!isset($this->namespace['Logstash'])) {
194
-            $this->namespace['Logstash'] = new Logstash($this);
195
-        }
196
-        return $this->namespace['Logstash'];
197
-    }
198
-    public function migration() : Migration
199
-    {
200
-        if (!isset($this->namespace['Migration'])) {
201
-            $this->namespace['Migration'] = new Migration($this);
202
-        }
203
-        return $this->namespace['Migration'];
204
-    }
205
-    public function ml() : Ml
206
-    {
207
-        if (!isset($this->namespace['Ml'])) {
208
-            $this->namespace['Ml'] = new Ml($this);
209
-        }
210
-        return $this->namespace['Ml'];
211
-    }
212
-    public function monitoring() : Monitoring
213
-    {
214
-        if (!isset($this->namespace['Monitoring'])) {
215
-            $this->namespace['Monitoring'] = new Monitoring($this);
216
-        }
217
-        return $this->namespace['Monitoring'];
218
-    }
219
-    public function nodes() : Nodes
220
-    {
221
-        if (!isset($this->namespace['Nodes'])) {
222
-            $this->namespace['Nodes'] = new Nodes($this);
223
-        }
224
-        return $this->namespace['Nodes'];
225
-    }
226
-    public function profiling() : Profiling
227
-    {
228
-        if (!isset($this->namespace['Profiling'])) {
229
-            $this->namespace['Profiling'] = new Profiling($this);
230
-        }
231
-        return $this->namespace['Profiling'];
232
-    }
233
-    public function queryRules() : QueryRules
234
-    {
235
-        if (!isset($this->namespace['QueryRules'])) {
236
-            $this->namespace['QueryRules'] = new QueryRules($this);
237
-        }
238
-        return $this->namespace['QueryRules'];
239
-    }
240
-    public function rollup() : Rollup
241
-    {
242
-        if (!isset($this->namespace['Rollup'])) {
243
-            $this->namespace['Rollup'] = new Rollup($this);
244
-        }
245
-        return $this->namespace['Rollup'];
246
-    }
247
-    public function searchApplication() : SearchApplication
248
-    {
249
-        if (!isset($this->namespace['SearchApplication'])) {
250
-            $this->namespace['SearchApplication'] = new SearchApplication($this);
251
-        }
252
-        return $this->namespace['SearchApplication'];
253
-    }
254
-    public function searchableSnapshots() : SearchableSnapshots
255
-    {
256
-        if (!isset($this->namespace['SearchableSnapshots'])) {
257
-            $this->namespace['SearchableSnapshots'] = new SearchableSnapshots($this);
258
-        }
259
-        return $this->namespace['SearchableSnapshots'];
260
-    }
261
-    public function security() : Security
262
-    {
263
-        if (!isset($this->namespace['Security'])) {
264
-            $this->namespace['Security'] = new Security($this);
265
-        }
266
-        return $this->namespace['Security'];
267
-    }
268
-    public function shutdown() : Shutdown
269
-    {
270
-        if (!isset($this->namespace['Shutdown'])) {
271
-            $this->namespace['Shutdown'] = new Shutdown($this);
272
-        }
273
-        return $this->namespace['Shutdown'];
274
-    }
275
-    public function simulate() : Simulate
276
-    {
277
-        if (!isset($this->namespace['Simulate'])) {
278
-            $this->namespace['Simulate'] = new Simulate($this);
279
-        }
280
-        return $this->namespace['Simulate'];
281
-    }
282
-    public function slm() : Slm
283
-    {
284
-        if (!isset($this->namespace['Slm'])) {
285
-            $this->namespace['Slm'] = new Slm($this);
286
-        }
287
-        return $this->namespace['Slm'];
288
-    }
289
-    public function snapshot() : Snapshot
290
-    {
291
-        if (!isset($this->namespace['Snapshot'])) {
292
-            $this->namespace['Snapshot'] = new Snapshot($this);
293
-        }
294
-        return $this->namespace['Snapshot'];
295
-    }
296
-    public function sql() : Sql
297
-    {
298
-        if (!isset($this->namespace['Sql'])) {
299
-            $this->namespace['Sql'] = new Sql($this);
300
-        }
301
-        return $this->namespace['Sql'];
302
-    }
303
-    public function ssl() : Ssl
304
-    {
305
-        if (!isset($this->namespace['Ssl'])) {
306
-            $this->namespace['Ssl'] = new Ssl($this);
307
-        }
308
-        return $this->namespace['Ssl'];
309
-    }
310
-    public function synonyms() : Synonyms
311
-    {
312
-        if (!isset($this->namespace['Synonyms'])) {
313
-            $this->namespace['Synonyms'] = new Synonyms($this);
314
-        }
315
-        return $this->namespace['Synonyms'];
316
-    }
317
-    public function tasks() : Tasks
318
-    {
319
-        if (!isset($this->namespace['Tasks'])) {
320
-            $this->namespace['Tasks'] = new Tasks($this);
321
-        }
322
-        return $this->namespace['Tasks'];
323
-    }
324
-    public function textStructure() : TextStructure
325
-    {
326
-        if (!isset($this->namespace['TextStructure'])) {
327
-            $this->namespace['TextStructure'] = new TextStructure($this);
328
-        }
329
-        return $this->namespace['TextStructure'];
330
-    }
331
-    public function transform() : Transform
332
-    {
333
-        if (!isset($this->namespace['Transform'])) {
334
-            $this->namespace['Transform'] = new Transform($this);
335
-        }
336
-        return $this->namespace['Transform'];
337
-    }
338
-    public function watcher() : Watcher
339
-    {
340
-        if (!isset($this->namespace['Watcher'])) {
341
-            $this->namespace['Watcher'] = new Watcher($this);
342
-        }
343
-        return $this->namespace['Watcher'];
344
-    }
345
-    public function xpack() : Xpack
346
-    {
347
-        if (!isset($this->namespace['Xpack'])) {
348
-            $this->namespace['Xpack'] = new Xpack($this);
349
-        }
350
-        return $this->namespace['Xpack'];
351
-    }
63
+	/** The endpoint namespace storage */
64
+	protected array $namespace;
65
+	public function asyncSearch() : AsyncSearch
66
+	{
67
+		if (!isset($this->namespace['AsyncSearch'])) {
68
+			$this->namespace['AsyncSearch'] = new AsyncSearch($this);
69
+		}
70
+		return $this->namespace['AsyncSearch'];
71
+	}
72
+	public function autoscaling() : Autoscaling
73
+	{
74
+		if (!isset($this->namespace['Autoscaling'])) {
75
+			$this->namespace['Autoscaling'] = new Autoscaling($this);
76
+		}
77
+		return $this->namespace['Autoscaling'];
78
+	}
79
+	public function cat() : Cat
80
+	{
81
+		if (!isset($this->namespace['Cat'])) {
82
+			$this->namespace['Cat'] = new Cat($this);
83
+		}
84
+		return $this->namespace['Cat'];
85
+	}
86
+	public function ccr() : Ccr
87
+	{
88
+		if (!isset($this->namespace['Ccr'])) {
89
+			$this->namespace['Ccr'] = new Ccr($this);
90
+		}
91
+		return $this->namespace['Ccr'];
92
+	}
93
+	public function cluster() : Cluster
94
+	{
95
+		if (!isset($this->namespace['Cluster'])) {
96
+			$this->namespace['Cluster'] = new Cluster($this);
97
+		}
98
+		return $this->namespace['Cluster'];
99
+	}
100
+	public function connector() : Connector
101
+	{
102
+		if (!isset($this->namespace['Connector'])) {
103
+			$this->namespace['Connector'] = new Connector($this);
104
+		}
105
+		return $this->namespace['Connector'];
106
+	}
107
+	public function danglingIndices() : DanglingIndices
108
+	{
109
+		if (!isset($this->namespace['DanglingIndices'])) {
110
+			$this->namespace['DanglingIndices'] = new DanglingIndices($this);
111
+		}
112
+		return $this->namespace['DanglingIndices'];
113
+	}
114
+	public function enrich() : Enrich
115
+	{
116
+		if (!isset($this->namespace['Enrich'])) {
117
+			$this->namespace['Enrich'] = new Enrich($this);
118
+		}
119
+		return $this->namespace['Enrich'];
120
+	}
121
+	public function eql() : Eql
122
+	{
123
+		if (!isset($this->namespace['Eql'])) {
124
+			$this->namespace['Eql'] = new Eql($this);
125
+		}
126
+		return $this->namespace['Eql'];
127
+	}
128
+	public function esql() : Esql
129
+	{
130
+		if (!isset($this->namespace['Esql'])) {
131
+			$this->namespace['Esql'] = new Esql($this);
132
+		}
133
+		return $this->namespace['Esql'];
134
+	}
135
+	public function features() : Features
136
+	{
137
+		if (!isset($this->namespace['Features'])) {
138
+			$this->namespace['Features'] = new Features($this);
139
+		}
140
+		return $this->namespace['Features'];
141
+	}
142
+	public function fleet() : Fleet
143
+	{
144
+		if (!isset($this->namespace['Fleet'])) {
145
+			$this->namespace['Fleet'] = new Fleet($this);
146
+		}
147
+		return $this->namespace['Fleet'];
148
+	}
149
+	public function graph() : Graph
150
+	{
151
+		if (!isset($this->namespace['Graph'])) {
152
+			$this->namespace['Graph'] = new Graph($this);
153
+		}
154
+		return $this->namespace['Graph'];
155
+	}
156
+	public function ilm() : Ilm
157
+	{
158
+		if (!isset($this->namespace['Ilm'])) {
159
+			$this->namespace['Ilm'] = new Ilm($this);
160
+		}
161
+		return $this->namespace['Ilm'];
162
+	}
163
+	public function indices() : Indices
164
+	{
165
+		if (!isset($this->namespace['Indices'])) {
166
+			$this->namespace['Indices'] = new Indices($this);
167
+		}
168
+		return $this->namespace['Indices'];
169
+	}
170
+	public function inference() : Inference
171
+	{
172
+		if (!isset($this->namespace['Inference'])) {
173
+			$this->namespace['Inference'] = new Inference($this);
174
+		}
175
+		return $this->namespace['Inference'];
176
+	}
177
+	public function ingest() : Ingest
178
+	{
179
+		if (!isset($this->namespace['Ingest'])) {
180
+			$this->namespace['Ingest'] = new Ingest($this);
181
+		}
182
+		return $this->namespace['Ingest'];
183
+	}
184
+	public function license() : License
185
+	{
186
+		if (!isset($this->namespace['License'])) {
187
+			$this->namespace['License'] = new License($this);
188
+		}
189
+		return $this->namespace['License'];
190
+	}
191
+	public function logstash() : Logstash
192
+	{
193
+		if (!isset($this->namespace['Logstash'])) {
194
+			$this->namespace['Logstash'] = new Logstash($this);
195
+		}
196
+		return $this->namespace['Logstash'];
197
+	}
198
+	public function migration() : Migration
199
+	{
200
+		if (!isset($this->namespace['Migration'])) {
201
+			$this->namespace['Migration'] = new Migration($this);
202
+		}
203
+		return $this->namespace['Migration'];
204
+	}
205
+	public function ml() : Ml
206
+	{
207
+		if (!isset($this->namespace['Ml'])) {
208
+			$this->namespace['Ml'] = new Ml($this);
209
+		}
210
+		return $this->namespace['Ml'];
211
+	}
212
+	public function monitoring() : Monitoring
213
+	{
214
+		if (!isset($this->namespace['Monitoring'])) {
215
+			$this->namespace['Monitoring'] = new Monitoring($this);
216
+		}
217
+		return $this->namespace['Monitoring'];
218
+	}
219
+	public function nodes() : Nodes
220
+	{
221
+		if (!isset($this->namespace['Nodes'])) {
222
+			$this->namespace['Nodes'] = new Nodes($this);
223
+		}
224
+		return $this->namespace['Nodes'];
225
+	}
226
+	public function profiling() : Profiling
227
+	{
228
+		if (!isset($this->namespace['Profiling'])) {
229
+			$this->namespace['Profiling'] = new Profiling($this);
230
+		}
231
+		return $this->namespace['Profiling'];
232
+	}
233
+	public function queryRules() : QueryRules
234
+	{
235
+		if (!isset($this->namespace['QueryRules'])) {
236
+			$this->namespace['QueryRules'] = new QueryRules($this);
237
+		}
238
+		return $this->namespace['QueryRules'];
239
+	}
240
+	public function rollup() : Rollup
241
+	{
242
+		if (!isset($this->namespace['Rollup'])) {
243
+			$this->namespace['Rollup'] = new Rollup($this);
244
+		}
245
+		return $this->namespace['Rollup'];
246
+	}
247
+	public function searchApplication() : SearchApplication
248
+	{
249
+		if (!isset($this->namespace['SearchApplication'])) {
250
+			$this->namespace['SearchApplication'] = new SearchApplication($this);
251
+		}
252
+		return $this->namespace['SearchApplication'];
253
+	}
254
+	public function searchableSnapshots() : SearchableSnapshots
255
+	{
256
+		if (!isset($this->namespace['SearchableSnapshots'])) {
257
+			$this->namespace['SearchableSnapshots'] = new SearchableSnapshots($this);
258
+		}
259
+		return $this->namespace['SearchableSnapshots'];
260
+	}
261
+	public function security() : Security
262
+	{
263
+		if (!isset($this->namespace['Security'])) {
264
+			$this->namespace['Security'] = new Security($this);
265
+		}
266
+		return $this->namespace['Security'];
267
+	}
268
+	public function shutdown() : Shutdown
269
+	{
270
+		if (!isset($this->namespace['Shutdown'])) {
271
+			$this->namespace['Shutdown'] = new Shutdown($this);
272
+		}
273
+		return $this->namespace['Shutdown'];
274
+	}
275
+	public function simulate() : Simulate
276
+	{
277
+		if (!isset($this->namespace['Simulate'])) {
278
+			$this->namespace['Simulate'] = new Simulate($this);
279
+		}
280
+		return $this->namespace['Simulate'];
281
+	}
282
+	public function slm() : Slm
283
+	{
284
+		if (!isset($this->namespace['Slm'])) {
285
+			$this->namespace['Slm'] = new Slm($this);
286
+		}
287
+		return $this->namespace['Slm'];
288
+	}
289
+	public function snapshot() : Snapshot
290
+	{
291
+		if (!isset($this->namespace['Snapshot'])) {
292
+			$this->namespace['Snapshot'] = new Snapshot($this);
293
+		}
294
+		return $this->namespace['Snapshot'];
295
+	}
296
+	public function sql() : Sql
297
+	{
298
+		if (!isset($this->namespace['Sql'])) {
299
+			$this->namespace['Sql'] = new Sql($this);
300
+		}
301
+		return $this->namespace['Sql'];
302
+	}
303
+	public function ssl() : Ssl
304
+	{
305
+		if (!isset($this->namespace['Ssl'])) {
306
+			$this->namespace['Ssl'] = new Ssl($this);
307
+		}
308
+		return $this->namespace['Ssl'];
309
+	}
310
+	public function synonyms() : Synonyms
311
+	{
312
+		if (!isset($this->namespace['Synonyms'])) {
313
+			$this->namespace['Synonyms'] = new Synonyms($this);
314
+		}
315
+		return $this->namespace['Synonyms'];
316
+	}
317
+	public function tasks() : Tasks
318
+	{
319
+		if (!isset($this->namespace['Tasks'])) {
320
+			$this->namespace['Tasks'] = new Tasks($this);
321
+		}
322
+		return $this->namespace['Tasks'];
323
+	}
324
+	public function textStructure() : TextStructure
325
+	{
326
+		if (!isset($this->namespace['TextStructure'])) {
327
+			$this->namespace['TextStructure'] = new TextStructure($this);
328
+		}
329
+		return $this->namespace['TextStructure'];
330
+	}
331
+	public function transform() : Transform
332
+	{
333
+		if (!isset($this->namespace['Transform'])) {
334
+			$this->namespace['Transform'] = new Transform($this);
335
+		}
336
+		return $this->namespace['Transform'];
337
+	}
338
+	public function watcher() : Watcher
339
+	{
340
+		if (!isset($this->namespace['Watcher'])) {
341
+			$this->namespace['Watcher'] = new Watcher($this);
342
+		}
343
+		return $this->namespace['Watcher'];
344
+	}
345
+	public function xpack() : Xpack
346
+	{
347
+		if (!isset($this->namespace['Xpack'])) {
348
+			$this->namespace['Xpack'] = new Xpack($this);
349
+		}
350
+		return $this->namespace['Xpack'];
351
+	}
352 352
 }
Please login to merge, or discard this patch.
lib/Vendor/Elastic/Elasticsearch/Traits/EndpointTrait.php 1 patch
Indentation   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -29,170 +29,170 @@
 block discarded – undo
29 29
 use function sprintf;
30 30
 trait EndpointTrait
31 31
 {
32
-    /**
33
-     * Check if an array containts nested array
34
-     */
35
-    private function isNestedArray(array $a) : bool
36
-    {
37
-        foreach ($a as $v) {
38
-            if (\is_array($v)) {
39
-                return \true;
40
-            }
41
-        }
42
-        return \false;
43
-    }
44
-    /**
45
-     * Check if an array is associative, i.e. has a string as key
46
-     */
47
-    protected function isAssociativeArray(array $array) : bool
48
-    {
49
-        foreach ($array as $k => $v) {
50
-            if (\is_string($k)) {
51
-                return \true;
52
-            }
53
-        }
54
-        return \false;
55
-    }
56
-    /**
57
-     * Converts array to comma-separated list;
58
-     * Converts boolean value to true', 'false' string
59
-     * 
60
-     * @param mixed $value
61
-     */
62
-    private function convertValue($value) : string
63
-    {
64
-        // Convert a boolean value in 'true' or 'false' string
65
-        if (\is_bool($value)) {
66
-            return $value ? 'true' : 'false';
67
-            // Convert to comma-separated list if array
68
-        } elseif (\is_array($value) && $this->isNestedArray($value) === \false) {
69
-            return \implode(',', $value);
70
-        }
71
-        return (string) $value;
72
-    }
73
-    /**
74
-     * Encode a value for a valid URL
75
-     * 
76
-     * @param mixed $value
77
-     */
78
-    protected function encode($value) : string
79
-    {
80
-        return Utility::urlencode($this->convertValue($value));
81
-    }
82
-    /**
83
-     * Returns the URL with the query string from $params
84
-     * extracting the array keys specified in $keys
85
-     */
86
-    protected function addQueryString(string $url, array $params, array $keys) : string
87
-    {
88
-        $queryParams = [];
89
-        foreach ($keys as $k) {
90
-            if (isset($params[$k])) {
91
-                $queryParams[$k] = $this->convertValue($params[$k]);
92
-            }
93
-        }
94
-        if (empty($queryParams)) {
95
-            return $url;
96
-        }
97
-        return $url . '?' . http_build_query($queryParams);
98
-    }
99
-    /**
100
-     * Serialize the body using the Content-Type
101
-     * 
102
-     * @param mixed $body
103
-     */
104
-    protected function bodySerialize($body, string $contentType) : string
105
-    {
106
-        if (strpos($contentType, 'application/x-ndjson') !== \false || strpos($contentType, 'application/vnd.elasticsearch+x-ndjson') !== \false) {
107
-            return NDJsonSerializer::serialize($body, ['remove_null' => \false]);
108
-        }
109
-        if (strpos($contentType, 'application/json') !== \false || strpos($contentType, 'application/vnd.elasticsearch+json') !== \false) {
110
-            return JsonSerializer::serialize($body, ['remove_null' => \false]);
111
-        }
112
-        throw new ContentTypeException(sprintf("The Content-Type %s is not managed by Elasticsearch serializer", $contentType));
113
-    }
114
-    /**
115
-     * Create a PSR-7 request
116
-     * 
117
-     * @param array|string $body
118
-     */
119
-    protected function createRequest(string $method, string $url, array $headers, $body = null) : RequestInterface
120
-    {
121
-        $requestFactory = Psr17FactoryDiscovery::findServerRequestFactory();
122
-        $streamFactory = Psr17FactoryDiscovery::findStreamFactory();
123
-        $request = $requestFactory->createServerRequest($method, $url);
124
-        // Body request
125
-        if (!empty($body)) {
126
-            if (!isset($headers['Content-Type'])) {
127
-                throw new ContentTypeException(sprintf("The Content-Type is missing for %s %s", $method, $url));
128
-            }
129
-            $content = \is_string($body) ? $body : $this->bodySerialize($body, $headers['Content-Type']);
130
-            $request = $request->withBody($streamFactory->createStream($content));
131
-        }
132
-        $headers = $this->buildCompatibilityHeaders($headers);
133
-        // Headers
134
-        foreach ($headers as $name => $value) {
135
-            $request = $request->withHeader($name, $value);
136
-        }
137
-        return $request;
138
-    }
139
-    /**
140
-     * Build the API compatibility headers
141
-     * transfrom Content-Type and Accept adding vnd.elasticsearch+ and compatible-with
142
-     * 
143
-     * @see https://github.com/elastic/elasticsearch-php/pull/1142
144
-     */
145
-    protected function buildCompatibilityHeaders(array $headers) : array
146
-    {
147
-        if (isset($headers['Content-Type'])) {
148
-            if (\preg_match('/application\\/([^,]+)$/', $headers['Content-Type'], $matches)) {
149
-                $headers['Content-Type'] = sprintf(Client::API_COMPATIBILITY_HEADER, 'application', $matches[1]);
150
-            }
151
-        }
152
-        if (isset($headers['Accept'])) {
153
-            $values = \explode(',', $headers['Accept']);
154
-            foreach ($values as &$value) {
155
-                if (\preg_match('/(application|text)\\/([^,]+)/', $value, $matches)) {
156
-                    $value = sprintf(Client::API_COMPATIBILITY_HEADER, $matches[1], $matches[2]);
157
-                }
158
-            }
159
-            $headers['Accept'] = \implode(',', $values);
160
-        }
161
-        return $headers;
162
-    }
163
-    /**
164
-     * Check if the $required parameters are present in $params
165
-     * @throws MissingParameterException
166
-     */
167
-    protected function checkRequiredParameters(array $required, array $params) : void
168
-    {
169
-        foreach ($required as $req) {
170
-            if (!isset($params[$req])) {
171
-                throw new MissingParameterException(sprintf('The parameter %s is required', $req));
172
-            }
173
-        }
174
-    }
175
-    /**
176
-     * Add the OpenTelemetry attributes to the PSR-7 ServerRequest
177
-     */
178
-    protected function addOtelAttributes(array $params, array $requiredPathParts, ServerRequestInterface $request, string $endpoint) : ServerRequestInterface
179
-    {
180
-        // Check if OpenTelemetry instrumentation is enbaled
181
-        if (!\getenv(OpenTelemetry::ENV_VARIABLE_ENABLED)) {
182
-            return $request;
183
-        }
184
-        $otel = [];
185
-        foreach ($requiredPathParts as $part) {
186
-            if (isset($params[$part])) {
187
-                $otel["db.elasticsearch.path_parts.{$part}"] = $params[$part];
188
-            }
189
-        }
190
-        if (\in_array($endpoint, Client::SEARCH_ENDPOINTS)) {
191
-            $body = $request->getBody()->getContents();
192
-            if (!empty($body)) {
193
-                $otel['db.query.text'] = OpenTelemetry::redactBody($body);
194
-            }
195
-        }
196
-        return $request->withAttribute(OpenTelemetry::PSR7_OTEL_ATTRIBUTE_NAME, \array_merge($otel, ['db.system' => 'elasticsearch', 'db.operation.name' => $endpoint]));
197
-    }
32
+	/**
33
+	 * Check if an array containts nested array
34
+	 */
35
+	private function isNestedArray(array $a) : bool
36
+	{
37
+		foreach ($a as $v) {
38
+			if (\is_array($v)) {
39
+				return \true;
40
+			}
41
+		}
42
+		return \false;
43
+	}
44
+	/**
45
+	 * Check if an array is associative, i.e. has a string as key
46
+	 */
47
+	protected function isAssociativeArray(array $array) : bool
48
+	{
49
+		foreach ($array as $k => $v) {
50
+			if (\is_string($k)) {
51
+				return \true;
52
+			}
53
+		}
54
+		return \false;
55
+	}
56
+	/**
57
+	 * Converts array to comma-separated list;
58
+	 * Converts boolean value to true', 'false' string
59
+	 * 
60
+	 * @param mixed $value
61
+	 */
62
+	private function convertValue($value) : string
63
+	{
64
+		// Convert a boolean value in 'true' or 'false' string
65
+		if (\is_bool($value)) {
66
+			return $value ? 'true' : 'false';
67
+			// Convert to comma-separated list if array
68
+		} elseif (\is_array($value) && $this->isNestedArray($value) === \false) {
69
+			return \implode(',', $value);
70
+		}
71
+		return (string) $value;
72
+	}
73
+	/**
74
+	 * Encode a value for a valid URL
75
+	 * 
76
+	 * @param mixed $value
77
+	 */
78
+	protected function encode($value) : string
79
+	{
80
+		return Utility::urlencode($this->convertValue($value));
81
+	}
82
+	/**
83
+	 * Returns the URL with the query string from $params
84
+	 * extracting the array keys specified in $keys
85
+	 */
86
+	protected function addQueryString(string $url, array $params, array $keys) : string
87
+	{
88
+		$queryParams = [];
89
+		foreach ($keys as $k) {
90
+			if (isset($params[$k])) {
91
+				$queryParams[$k] = $this->convertValue($params[$k]);
92
+			}
93
+		}
94
+		if (empty($queryParams)) {
95
+			return $url;
96
+		}
97
+		return $url . '?' . http_build_query($queryParams);
98
+	}
99
+	/**
100
+	 * Serialize the body using the Content-Type
101
+	 * 
102
+	 * @param mixed $body
103
+	 */
104
+	protected function bodySerialize($body, string $contentType) : string
105
+	{
106
+		if (strpos($contentType, 'application/x-ndjson') !== \false || strpos($contentType, 'application/vnd.elasticsearch+x-ndjson') !== \false) {
107
+			return NDJsonSerializer::serialize($body, ['remove_null' => \false]);
108
+		}
109
+		if (strpos($contentType, 'application/json') !== \false || strpos($contentType, 'application/vnd.elasticsearch+json') !== \false) {
110
+			return JsonSerializer::serialize($body, ['remove_null' => \false]);
111
+		}
112
+		throw new ContentTypeException(sprintf("The Content-Type %s is not managed by Elasticsearch serializer", $contentType));
113
+	}
114
+	/**
115
+	 * Create a PSR-7 request
116
+	 * 
117
+	 * @param array|string $body
118
+	 */
119
+	protected function createRequest(string $method, string $url, array $headers, $body = null) : RequestInterface
120
+	{
121
+		$requestFactory = Psr17FactoryDiscovery::findServerRequestFactory();
122
+		$streamFactory = Psr17FactoryDiscovery::findStreamFactory();
123
+		$request = $requestFactory->createServerRequest($method, $url);
124
+		// Body request
125
+		if (!empty($body)) {
126
+			if (!isset($headers['Content-Type'])) {
127
+				throw new ContentTypeException(sprintf("The Content-Type is missing for %s %s", $method, $url));
128
+			}
129
+			$content = \is_string($body) ? $body : $this->bodySerialize($body, $headers['Content-Type']);
130
+			$request = $request->withBody($streamFactory->createStream($content));
131
+		}
132
+		$headers = $this->buildCompatibilityHeaders($headers);
133
+		// Headers
134
+		foreach ($headers as $name => $value) {
135
+			$request = $request->withHeader($name, $value);
136
+		}
137
+		return $request;
138
+	}
139
+	/**
140
+	 * Build the API compatibility headers
141
+	 * transfrom Content-Type and Accept adding vnd.elasticsearch+ and compatible-with
142
+	 * 
143
+	 * @see https://github.com/elastic/elasticsearch-php/pull/1142
144
+	 */
145
+	protected function buildCompatibilityHeaders(array $headers) : array
146
+	{
147
+		if (isset($headers['Content-Type'])) {
148
+			if (\preg_match('/application\\/([^,]+)$/', $headers['Content-Type'], $matches)) {
149
+				$headers['Content-Type'] = sprintf(Client::API_COMPATIBILITY_HEADER, 'application', $matches[1]);
150
+			}
151
+		}
152
+		if (isset($headers['Accept'])) {
153
+			$values = \explode(',', $headers['Accept']);
154
+			foreach ($values as &$value) {
155
+				if (\preg_match('/(application|text)\\/([^,]+)/', $value, $matches)) {
156
+					$value = sprintf(Client::API_COMPATIBILITY_HEADER, $matches[1], $matches[2]);
157
+				}
158
+			}
159
+			$headers['Accept'] = \implode(',', $values);
160
+		}
161
+		return $headers;
162
+	}
163
+	/**
164
+	 * Check if the $required parameters are present in $params
165
+	 * @throws MissingParameterException
166
+	 */
167
+	protected function checkRequiredParameters(array $required, array $params) : void
168
+	{
169
+		foreach ($required as $req) {
170
+			if (!isset($params[$req])) {
171
+				throw new MissingParameterException(sprintf('The parameter %s is required', $req));
172
+			}
173
+		}
174
+	}
175
+	/**
176
+	 * Add the OpenTelemetry attributes to the PSR-7 ServerRequest
177
+	 */
178
+	protected function addOtelAttributes(array $params, array $requiredPathParts, ServerRequestInterface $request, string $endpoint) : ServerRequestInterface
179
+	{
180
+		// Check if OpenTelemetry instrumentation is enbaled
181
+		if (!\getenv(OpenTelemetry::ENV_VARIABLE_ENABLED)) {
182
+			return $request;
183
+		}
184
+		$otel = [];
185
+		foreach ($requiredPathParts as $part) {
186
+			if (isset($params[$part])) {
187
+				$otel["db.elasticsearch.path_parts.{$part}"] = $params[$part];
188
+			}
189
+		}
190
+		if (\in_array($endpoint, Client::SEARCH_ENDPOINTS)) {
191
+			$body = $request->getBody()->getContents();
192
+			if (!empty($body)) {
193
+				$otel['db.query.text'] = OpenTelemetry::redactBody($body);
194
+			}
195
+		}
196
+		return $request->withAttribute(OpenTelemetry::PSR7_OTEL_ATTRIBUTE_NAME, \array_merge($otel, ['db.system' => 'elasticsearch', 'db.operation.name' => $endpoint]));
197
+	}
198 198
 }
Please login to merge, or discard this patch.
lib/Vendor/Elastic/Elasticsearch/ClientBuilder.php 1 patch
Indentation   +375 added lines, -375 removed lines patch added patch discarded remove patch
@@ -32,379 +32,379 @@
 block discarded – undo
32 32
 use ReflectionClass;
33 33
 class ClientBuilder
34 34
 {
35
-    const DEFAULT_HOST = 'localhost:9200';
36
-    /**
37
-     * PSR-18 client
38
-     */
39
-    private ClientInterface $httpClient;
40
-    /**
41
-     * The HTTP async client
42
-     */
43
-    private HttpAsyncClient $asyncHttpClient;
44
-    /**
45
-     * PSR-3 Logger
46
-     */
47
-    private LoggerInterface $logger;
48
-    /**
49
-     * The NodelPool
50
-     */
51
-    private NodePoolInterface $nodePool;
52
-    /**
53
-     * Hosts (elasticsearch nodes)
54
-     */
55
-    private array $hosts;
56
-    /**
57
-     * Elasticsearch API key
58
-     */
59
-    private string $apiKey;
60
-    /**
61
-     * Basic authentication username
62
-     */
63
-    private string $username;
64
-    /**
65
-     * Basic authentication password
66
-     */
67
-    private string $password;
68
-    /**
69
-     * Elastic cloud Id
70
-     */
71
-    private string $cloudId;
72
-    /**
73
-     * Retries
74
-     * 
75
-     * The default value is calculated during the client build
76
-     * and it is equal to the number of hosts
77
-     */
78
-    private int $retries;
79
-    /**
80
-     * SSL certificate 
81
-     * @var array [$cert, $password] $cert is the name of a file containing a PEM formatted certificate,
82
-     *              $password if the certificate requires a password 
83
-     */
84
-    private array $sslCert;
85
-    /**
86
-     * SSL key
87
-     * @var array [$key, $password] $key is the name of a file containing a private SSL key,
88
-     *              $password if the private key requires a password
89
-     */
90
-    private array $sslKey;
91
-    /**
92
-     * SSL verification
93
-     * 
94
-     * Enable or disable the SSL verfiication (default is true)
95
-     */
96
-    private bool $sslVerification = \true;
97
-    /**
98
-     * SSL CA bundle
99
-     */
100
-    private string $sslCA;
101
-    /**
102
-     * Elastic meta header
103
-     * 
104
-     * Enable or disable the x-elastic-client-meta header (default is true)
105
-     */
106
-    private bool $elasticMetaHeader = \true;
107
-    /**
108
-     * HTTP client options
109
-     */
110
-    private array $httpClientOptions = [];
111
-    /**
112
-     * Make the constructor final so cannot be overwritten
113
-     */
114
-    public final function __construct()
115
-    {
116
-    }
117
-    /**
118
-     * Create an instance of ClientBuilder
119
-     */
120
-    public static function create() : ClientBuilder
121
-    {
122
-        return new static();
123
-    }
124
-    /**
125
-     * Build a new client from the provided config.  Hash keys
126
-     * should correspond to the method name e.g. ['nodePool']
127
-     * corresponds to setNodePool().
128
-     *
129
-     * Missing keys will use the default for that setting if applicable
130
-     *
131
-     * Unknown keys will throw an exception by default, but this can be silenced
132
-     * by setting `quiet` to true
133
-     *
134
-     * @param  array $config
135
-     * @param  bool $quiet False if unknown settings throw exception, true to silently
136
-     *                     ignore unknown settings
137
-     * @throws ConfigException
138
-     */
139
-    public static function fromConfig(array $config, bool $quiet = \false) : Client
140
-    {
141
-        $builder = new static();
142
-        foreach ($config as $key => $value) {
143
-            $method = "set{$key}";
144
-            $reflection = new ReflectionClass($builder);
145
-            if ($reflection->hasMethod($method)) {
146
-                $func = $reflection->getMethod($method);
147
-                if ($func->getNumberOfParameters() > 1) {
148
-                    $builder->{$method}(...$value);
149
-                } else {
150
-                    $builder->{$method}($value);
151
-                }
152
-                unset($config[$key]);
153
-            }
154
-        }
155
-        if ($quiet === \false && \count($config) > 0) {
156
-            $unknown = \implode(\array_keys($config));
157
-            throw new ConfigException("Unknown parameters provided: {$unknown}");
158
-        }
159
-        return $builder->build();
160
-    }
161
-    public function setHttpClient(ClientInterface $httpClient) : ClientBuilder
162
-    {
163
-        $this->httpClient = $httpClient;
164
-        return $this;
165
-    }
166
-    public function setAsyncHttpClient(HttpAsyncClient $asyncHttpClient) : ClientBuilder
167
-    {
168
-        $this->asyncHttpClient = $asyncHttpClient;
169
-        return $this;
170
-    }
171
-    /**
172
-     * Set the PSR-3 Logger
173
-     */
174
-    public function setLogger(LoggerInterface $logger) : ClientBuilder
175
-    {
176
-        $this->logger = $logger;
177
-        return $this;
178
-    }
179
-    /**
180
-     * Set the NodePool
181
-     */
182
-    public function setNodePool(NodePoolInterface $nodePool) : ClientBuilder
183
-    {
184
-        $this->nodePool = $nodePool;
185
-        return $this;
186
-    }
187
-    /**
188
-     * Set the hosts (nodes)
189
-     */
190
-    public function setHosts(array $hosts) : ClientBuilder
191
-    {
192
-        $this->hosts = $hosts;
193
-        return $this;
194
-    }
195
-    /**
196
-     * Set the ApiKey
197
-     * If the id is not specified we store the ApiKey otherwise
198
-     * we store as Base64(id:ApiKey)
199
-     *
200
-     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html
201
-     */
202
-    public function setApiKey(string $apiKey, ?string $id = null) : ClientBuilder
203
-    {
204
-        if (empty($id)) {
205
-            $this->apiKey = $apiKey;
206
-        } else {
207
-            $this->apiKey = \base64_encode($id . ':' . $apiKey);
208
-        }
209
-        return $this;
210
-    }
211
-    /**
212
-     * Set the Basic Authentication
213
-     */
214
-    public function setBasicAuthentication(string $username, string $password) : ClientBuilder
215
-    {
216
-        $this->username = $username;
217
-        $this->password = $password;
218
-        return $this;
219
-    }
220
-    public function setElasticCloudId(string $cloudId)
221
-    {
222
-        $this->cloudId = $cloudId;
223
-        return $this;
224
-    }
225
-    /**
226
-     * Set number or retries
227
-     * 
228
-     * @param int $retries
229
-     */
230
-    public function setRetries(int $retries) : ClientBuilder
231
-    {
232
-        if ($retries < 0) {
233
-            throw new InvalidArgumentException('The retries number must be >= 0');
234
-        }
235
-        $this->retries = $retries;
236
-        return $this;
237
-    }
238
-    /**
239
-     * Set SSL certificate
240
-     * 
241
-     * @param string $cert The name of a file containing a PEM formatted certificate
242
-     * @param string $password if the certificate requires a password
243
-     */
244
-    public function setSSLCert(string $cert, ?string $password = null) : ClientBuilder
245
-    {
246
-        $this->sslCert = [$cert, $password];
247
-        return $this;
248
-    }
249
-    /**
250
-     * Set the Certificate Authority (CA) bundle 
251
-     * 
252
-     * @param string $cert The name of a file containing a PEM formatted certificate
253
-     */
254
-    public function setCABundle(string $cert) : ClientBuilder
255
-    {
256
-        $this->sslCA = $cert;
257
-        return $this;
258
-    }
259
-    /**
260
-     * Set SSL key
261
-     * 
262
-     * @param string $key The name of a file containing a private SSL key
263
-     * @param string $password if the private key requires a password
264
-     */
265
-    public function setSSLKey(string $key, ?string $password = null) : ClientBuilder
266
-    {
267
-        $this->sslKey = [$key, $password];
268
-        return $this;
269
-    }
270
-    /**
271
-     * Enable or disable the SSL verification 
272
-     */
273
-    public function setSSLVerification(bool $value = \true) : ClientBuilder
274
-    {
275
-        $this->sslVerification = $value;
276
-        return $this;
277
-    }
278
-    /**
279
-     * Enable or disable the x-elastic-client-meta header
280
-     */
281
-    public function setElasticMetaHeader(bool $value = \true) : ClientBuilder
282
-    {
283
-        $this->elasticMetaHeader = $value;
284
-        return $this;
285
-    }
286
-    public function setHttpClientOptions(array $options) : ClientBuilder
287
-    {
288
-        $this->httpClientOptions = $options;
289
-        return $this;
290
-    }
291
-    /**
292
-     * Build and returns the Client object
293
-     */
294
-    public function build() : Client
295
-    {
296
-        // Transport builder
297
-        $builder = TransportBuilder::create();
298
-        // Set the default hosts if empty
299
-        if (empty($this->hosts)) {
300
-            $this->hosts = [self::DEFAULT_HOST];
301
-        }
302
-        $builder->setHosts($this->hosts);
303
-        // Logger
304
-        if (!empty($this->logger)) {
305
-            $builder->setLogger($this->logger);
306
-        }
307
-        // Http client
308
-        if (!empty($this->httpClient)) {
309
-            $builder->setClient($this->httpClient);
310
-        }
311
-        // Set HTTP client options
312
-        $builder->setClient($this->setOptions($builder->getClient(), $this->getConfig(), $this->httpClientOptions));
313
-        // Cloud id
314
-        if (!empty($this->cloudId)) {
315
-            $builder->setCloudId($this->cloudId);
316
-        }
317
-        // Node Pool
318
-        if (!empty($this->nodePool)) {
319
-            $builder->setNodePool($this->nodePool);
320
-        }
321
-        $transport = $builder->build();
322
-        // The default retries is equal to the number of hosts
323
-        if (empty($this->retries)) {
324
-            $this->retries = \count($this->hosts);
325
-        }
326
-        $transport->setRetries($this->retries);
327
-        // Async client
328
-        if (!empty($this->asyncHttpClient)) {
329
-            $transport->setAsyncClient($this->asyncHttpClient);
330
-        }
331
-        // Basic authentication
332
-        if (!empty($this->username) && !empty($this->password)) {
333
-            $transport->setUserInfo($this->username, $this->password);
334
-        }
335
-        // API key
336
-        if (!empty($this->apiKey)) {
337
-            if (!empty($this->username)) {
338
-                throw new AuthenticationException('You cannot use APIKey and Basic Authenication together');
339
-            }
340
-            $transport->setHeader('Authorization', \sprintf("ApiKey %s", $this->apiKey));
341
-        }
342
-        /**
343
-         * Elastic cloud optimized with gzip
344
-         * @see https://github.com/elastic/elasticsearch-php/issues/1241 omit for Symfony HTTP Client    
345
-         */
346
-        if (!empty($this->cloudId) && !$this->isSymfonyHttpClient($transport)) {
347
-            $transport->setHeader('Accept-Encoding', 'gzip');
348
-        }
349
-        $client = new Client($transport, $transport->getLogger());
350
-        // Enable or disable the x-elastic-client-meta header
351
-        $client->setElasticMetaHeader($this->elasticMetaHeader);
352
-        return $client;
353
-    }
354
-    /**
355
-     * Returns true if the transport HTTP client is Symfony
356
-     */
357
-    protected function isSymfonyHttpClient(Transport $transport) : bool
358
-    {
359
-        if (\false !== \strpos(\get_class($transport->getClient()), 'OCA\\FullTextSearch_Elasticsearch\\Vendor\\Symfony\\Component\\HttpClient')) {
360
-            return \true;
361
-        }
362
-        try {
363
-            if (\false !== \strpos(\get_class($transport->getAsyncClient()), 'OCA\\FullTextSearch_Elasticsearch\\Vendor\\Symfony\\Component\\HttpClient')) {
364
-                return \true;
365
-            }
366
-        } catch (NoAsyncClientException $e) {
367
-            return \false;
368
-        }
369
-        return \false;
370
-    }
371
-    /**
372
-     * Returns the configuration to be used in the HTTP client
373
-     */
374
-    protected function getConfig() : array
375
-    {
376
-        $config = [];
377
-        if (!empty($this->sslCert)) {
378
-            $config[RequestOptions::SSL_CERT] = $this->sslCert;
379
-        }
380
-        if (!empty($this->sslKey)) {
381
-            $config[RequestOptions::SSL_KEY] = $this->sslKey;
382
-        }
383
-        if (!$this->sslVerification) {
384
-            $config[RequestOptions::SSL_VERIFY] = \false;
385
-        }
386
-        if (!empty($this->sslCA)) {
387
-            $config[RequestOptions::SSL_CA] = $this->sslCA;
388
-        }
389
-        return $config;
390
-    }
391
-    /**
392
-     * Set the configuration for the specific HTTP client using an adapter
393
-     */
394
-    protected function setOptions(ClientInterface $client, array $config, array $clientOptions = []) : ClientInterface
395
-    {
396
-        if (empty($config) && empty($clientOptions)) {
397
-            return $client;
398
-        }
399
-        $class = \get_class($client);
400
-        if (!isset(AdapterOptions::HTTP_ADAPTERS[$class])) {
401
-            throw new HttpClientException(\sprintf("The HTTP client %s is not supported for custom options", $class));
402
-        }
403
-        $adapterClass = AdapterOptions::HTTP_ADAPTERS[$class];
404
-        if (!\class_exists($adapterClass) || !\in_array(AdapterInterface::class, \class_implements($adapterClass))) {
405
-            throw new HttpClientException(\sprintf("The class %s does not exists or does not implement %s", $adapterClass, AdapterInterface::class));
406
-        }
407
-        $adapter = new $adapterClass();
408
-        return $adapter->setConfig($client, $config, $clientOptions);
409
-    }
35
+	const DEFAULT_HOST = 'localhost:9200';
36
+	/**
37
+	 * PSR-18 client
38
+	 */
39
+	private ClientInterface $httpClient;
40
+	/**
41
+	 * The HTTP async client
42
+	 */
43
+	private HttpAsyncClient $asyncHttpClient;
44
+	/**
45
+	 * PSR-3 Logger
46
+	 */
47
+	private LoggerInterface $logger;
48
+	/**
49
+	 * The NodelPool
50
+	 */
51
+	private NodePoolInterface $nodePool;
52
+	/**
53
+	 * Hosts (elasticsearch nodes)
54
+	 */
55
+	private array $hosts;
56
+	/**
57
+	 * Elasticsearch API key
58
+	 */
59
+	private string $apiKey;
60
+	/**
61
+	 * Basic authentication username
62
+	 */
63
+	private string $username;
64
+	/**
65
+	 * Basic authentication password
66
+	 */
67
+	private string $password;
68
+	/**
69
+	 * Elastic cloud Id
70
+	 */
71
+	private string $cloudId;
72
+	/**
73
+	 * Retries
74
+	 * 
75
+	 * The default value is calculated during the client build
76
+	 * and it is equal to the number of hosts
77
+	 */
78
+	private int $retries;
79
+	/**
80
+	 * SSL certificate 
81
+	 * @var array [$cert, $password] $cert is the name of a file containing a PEM formatted certificate,
82
+	 *              $password if the certificate requires a password 
83
+	 */
84
+	private array $sslCert;
85
+	/**
86
+	 * SSL key
87
+	 * @var array [$key, $password] $key is the name of a file containing a private SSL key,
88
+	 *              $password if the private key requires a password
89
+	 */
90
+	private array $sslKey;
91
+	/**
92
+	 * SSL verification
93
+	 * 
94
+	 * Enable or disable the SSL verfiication (default is true)
95
+	 */
96
+	private bool $sslVerification = \true;
97
+	/**
98
+	 * SSL CA bundle
99
+	 */
100
+	private string $sslCA;
101
+	/**
102
+	 * Elastic meta header
103
+	 * 
104
+	 * Enable or disable the x-elastic-client-meta header (default is true)
105
+	 */
106
+	private bool $elasticMetaHeader = \true;
107
+	/**
108
+	 * HTTP client options
109
+	 */
110
+	private array $httpClientOptions = [];
111
+	/**
112
+	 * Make the constructor final so cannot be overwritten
113
+	 */
114
+	public final function __construct()
115
+	{
116
+	}
117
+	/**
118
+	 * Create an instance of ClientBuilder
119
+	 */
120
+	public static function create() : ClientBuilder
121
+	{
122
+		return new static();
123
+	}
124
+	/**
125
+	 * Build a new client from the provided config.  Hash keys
126
+	 * should correspond to the method name e.g. ['nodePool']
127
+	 * corresponds to setNodePool().
128
+	 *
129
+	 * Missing keys will use the default for that setting if applicable
130
+	 *
131
+	 * Unknown keys will throw an exception by default, but this can be silenced
132
+	 * by setting `quiet` to true
133
+	 *
134
+	 * @param  array $config
135
+	 * @param  bool $quiet False if unknown settings throw exception, true to silently
136
+	 *                     ignore unknown settings
137
+	 * @throws ConfigException
138
+	 */
139
+	public static function fromConfig(array $config, bool $quiet = \false) : Client
140
+	{
141
+		$builder = new static();
142
+		foreach ($config as $key => $value) {
143
+			$method = "set{$key}";
144
+			$reflection = new ReflectionClass($builder);
145
+			if ($reflection->hasMethod($method)) {
146
+				$func = $reflection->getMethod($method);
147
+				if ($func->getNumberOfParameters() > 1) {
148
+					$builder->{$method}(...$value);
149
+				} else {
150
+					$builder->{$method}($value);
151
+				}
152
+				unset($config[$key]);
153
+			}
154
+		}
155
+		if ($quiet === \false && \count($config) > 0) {
156
+			$unknown = \implode(\array_keys($config));
157
+			throw new ConfigException("Unknown parameters provided: {$unknown}");
158
+		}
159
+		return $builder->build();
160
+	}
161
+	public function setHttpClient(ClientInterface $httpClient) : ClientBuilder
162
+	{
163
+		$this->httpClient = $httpClient;
164
+		return $this;
165
+	}
166
+	public function setAsyncHttpClient(HttpAsyncClient $asyncHttpClient) : ClientBuilder
167
+	{
168
+		$this->asyncHttpClient = $asyncHttpClient;
169
+		return $this;
170
+	}
171
+	/**
172
+	 * Set the PSR-3 Logger
173
+	 */
174
+	public function setLogger(LoggerInterface $logger) : ClientBuilder
175
+	{
176
+		$this->logger = $logger;
177
+		return $this;
178
+	}
179
+	/**
180
+	 * Set the NodePool
181
+	 */
182
+	public function setNodePool(NodePoolInterface $nodePool) : ClientBuilder
183
+	{
184
+		$this->nodePool = $nodePool;
185
+		return $this;
186
+	}
187
+	/**
188
+	 * Set the hosts (nodes)
189
+	 */
190
+	public function setHosts(array $hosts) : ClientBuilder
191
+	{
192
+		$this->hosts = $hosts;
193
+		return $this;
194
+	}
195
+	/**
196
+	 * Set the ApiKey
197
+	 * If the id is not specified we store the ApiKey otherwise
198
+	 * we store as Base64(id:ApiKey)
199
+	 *
200
+	 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html
201
+	 */
202
+	public function setApiKey(string $apiKey, ?string $id = null) : ClientBuilder
203
+	{
204
+		if (empty($id)) {
205
+			$this->apiKey = $apiKey;
206
+		} else {
207
+			$this->apiKey = \base64_encode($id . ':' . $apiKey);
208
+		}
209
+		return $this;
210
+	}
211
+	/**
212
+	 * Set the Basic Authentication
213
+	 */
214
+	public function setBasicAuthentication(string $username, string $password) : ClientBuilder
215
+	{
216
+		$this->username = $username;
217
+		$this->password = $password;
218
+		return $this;
219
+	}
220
+	public function setElasticCloudId(string $cloudId)
221
+	{
222
+		$this->cloudId = $cloudId;
223
+		return $this;
224
+	}
225
+	/**
226
+	 * Set number or retries
227
+	 * 
228
+	 * @param int $retries
229
+	 */
230
+	public function setRetries(int $retries) : ClientBuilder
231
+	{
232
+		if ($retries < 0) {
233
+			throw new InvalidArgumentException('The retries number must be >= 0');
234
+		}
235
+		$this->retries = $retries;
236
+		return $this;
237
+	}
238
+	/**
239
+	 * Set SSL certificate
240
+	 * 
241
+	 * @param string $cert The name of a file containing a PEM formatted certificate
242
+	 * @param string $password if the certificate requires a password
243
+	 */
244
+	public function setSSLCert(string $cert, ?string $password = null) : ClientBuilder
245
+	{
246
+		$this->sslCert = [$cert, $password];
247
+		return $this;
248
+	}
249
+	/**
250
+	 * Set the Certificate Authority (CA) bundle 
251
+	 * 
252
+	 * @param string $cert The name of a file containing a PEM formatted certificate
253
+	 */
254
+	public function setCABundle(string $cert) : ClientBuilder
255
+	{
256
+		$this->sslCA = $cert;
257
+		return $this;
258
+	}
259
+	/**
260
+	 * Set SSL key
261
+	 * 
262
+	 * @param string $key The name of a file containing a private SSL key
263
+	 * @param string $password if the private key requires a password
264
+	 */
265
+	public function setSSLKey(string $key, ?string $password = null) : ClientBuilder
266
+	{
267
+		$this->sslKey = [$key, $password];
268
+		return $this;
269
+	}
270
+	/**
271
+	 * Enable or disable the SSL verification 
272
+	 */
273
+	public function setSSLVerification(bool $value = \true) : ClientBuilder
274
+	{
275
+		$this->sslVerification = $value;
276
+		return $this;
277
+	}
278
+	/**
279
+	 * Enable or disable the x-elastic-client-meta header
280
+	 */
281
+	public function setElasticMetaHeader(bool $value = \true) : ClientBuilder
282
+	{
283
+		$this->elasticMetaHeader = $value;
284
+		return $this;
285
+	}
286
+	public function setHttpClientOptions(array $options) : ClientBuilder
287
+	{
288
+		$this->httpClientOptions = $options;
289
+		return $this;
290
+	}
291
+	/**
292
+	 * Build and returns the Client object
293
+	 */
294
+	public function build() : Client
295
+	{
296
+		// Transport builder
297
+		$builder = TransportBuilder::create();
298
+		// Set the default hosts if empty
299
+		if (empty($this->hosts)) {
300
+			$this->hosts = [self::DEFAULT_HOST];
301
+		}
302
+		$builder->setHosts($this->hosts);
303
+		// Logger
304
+		if (!empty($this->logger)) {
305
+			$builder->setLogger($this->logger);
306
+		}
307
+		// Http client
308
+		if (!empty($this->httpClient)) {
309
+			$builder->setClient($this->httpClient);
310
+		}
311
+		// Set HTTP client options
312
+		$builder->setClient($this->setOptions($builder->getClient(), $this->getConfig(), $this->httpClientOptions));
313
+		// Cloud id
314
+		if (!empty($this->cloudId)) {
315
+			$builder->setCloudId($this->cloudId);
316
+		}
317
+		// Node Pool
318
+		if (!empty($this->nodePool)) {
319
+			$builder->setNodePool($this->nodePool);
320
+		}
321
+		$transport = $builder->build();
322
+		// The default retries is equal to the number of hosts
323
+		if (empty($this->retries)) {
324
+			$this->retries = \count($this->hosts);
325
+		}
326
+		$transport->setRetries($this->retries);
327
+		// Async client
328
+		if (!empty($this->asyncHttpClient)) {
329
+			$transport->setAsyncClient($this->asyncHttpClient);
330
+		}
331
+		// Basic authentication
332
+		if (!empty($this->username) && !empty($this->password)) {
333
+			$transport->setUserInfo($this->username, $this->password);
334
+		}
335
+		// API key
336
+		if (!empty($this->apiKey)) {
337
+			if (!empty($this->username)) {
338
+				throw new AuthenticationException('You cannot use APIKey and Basic Authenication together');
339
+			}
340
+			$transport->setHeader('Authorization', \sprintf("ApiKey %s", $this->apiKey));
341
+		}
342
+		/**
343
+		 * Elastic cloud optimized with gzip
344
+		 * @see https://github.com/elastic/elasticsearch-php/issues/1241 omit for Symfony HTTP Client    
345
+		 */
346
+		if (!empty($this->cloudId) && !$this->isSymfonyHttpClient($transport)) {
347
+			$transport->setHeader('Accept-Encoding', 'gzip');
348
+		}
349
+		$client = new Client($transport, $transport->getLogger());
350
+		// Enable or disable the x-elastic-client-meta header
351
+		$client->setElasticMetaHeader($this->elasticMetaHeader);
352
+		return $client;
353
+	}
354
+	/**
355
+	 * Returns true if the transport HTTP client is Symfony
356
+	 */
357
+	protected function isSymfonyHttpClient(Transport $transport) : bool
358
+	{
359
+		if (\false !== \strpos(\get_class($transport->getClient()), 'OCA\\FullTextSearch_Elasticsearch\\Vendor\\Symfony\\Component\\HttpClient')) {
360
+			return \true;
361
+		}
362
+		try {
363
+			if (\false !== \strpos(\get_class($transport->getAsyncClient()), 'OCA\\FullTextSearch_Elasticsearch\\Vendor\\Symfony\\Component\\HttpClient')) {
364
+				return \true;
365
+			}
366
+		} catch (NoAsyncClientException $e) {
367
+			return \false;
368
+		}
369
+		return \false;
370
+	}
371
+	/**
372
+	 * Returns the configuration to be used in the HTTP client
373
+	 */
374
+	protected function getConfig() : array
375
+	{
376
+		$config = [];
377
+		if (!empty($this->sslCert)) {
378
+			$config[RequestOptions::SSL_CERT] = $this->sslCert;
379
+		}
380
+		if (!empty($this->sslKey)) {
381
+			$config[RequestOptions::SSL_KEY] = $this->sslKey;
382
+		}
383
+		if (!$this->sslVerification) {
384
+			$config[RequestOptions::SSL_VERIFY] = \false;
385
+		}
386
+		if (!empty($this->sslCA)) {
387
+			$config[RequestOptions::SSL_CA] = $this->sslCA;
388
+		}
389
+		return $config;
390
+	}
391
+	/**
392
+	 * Set the configuration for the specific HTTP client using an adapter
393
+	 */
394
+	protected function setOptions(ClientInterface $client, array $config, array $clientOptions = []) : ClientInterface
395
+	{
396
+		if (empty($config) && empty($clientOptions)) {
397
+			return $client;
398
+		}
399
+		$class = \get_class($client);
400
+		if (!isset(AdapterOptions::HTTP_ADAPTERS[$class])) {
401
+			throw new HttpClientException(\sprintf("The HTTP client %s is not supported for custom options", $class));
402
+		}
403
+		$adapterClass = AdapterOptions::HTTP_ADAPTERS[$class];
404
+		if (!\class_exists($adapterClass) || !\in_array(AdapterInterface::class, \class_implements($adapterClass))) {
405
+			throw new HttpClientException(\sprintf("The class %s does not exists or does not implement %s", $adapterClass, AdapterInterface::class));
406
+		}
407
+		$adapter = new $adapterClass();
408
+		return $adapter->setConfig($client, $config, $clientOptions);
409
+	}
410 410
 }
Please login to merge, or discard this patch.
vendor-bin/php-scoper/vendor/composer/ClassLoader.php 3 patches
Indentation   +534 added lines, -534 removed lines patch added patch discarded remove patch
@@ -42,538 +42,538 @@
 block discarded – undo
42 42
  */
43 43
 class ClassLoader
44 44
 {
45
-    /** @var \Closure(string):void */
46
-    private static $includeFile;
47
-
48
-    /** @var string|null */
49
-    private $vendorDir;
50
-
51
-    // PSR-4
52
-    /**
53
-     * @var array<string, array<string, int>>
54
-     */
55
-    private $prefixLengthsPsr4 = array();
56
-    /**
57
-     * @var array<string, list<string>>
58
-     */
59
-    private $prefixDirsPsr4 = array();
60
-    /**
61
-     * @var list<string>
62
-     */
63
-    private $fallbackDirsPsr4 = array();
64
-
65
-    // PSR-0
66
-    /**
67
-     * List of PSR-0 prefixes
68
-     *
69
-     * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
70
-     *
71
-     * @var array<string, array<string, list<string>>>
72
-     */
73
-    private $prefixesPsr0 = array();
74
-    /**
75
-     * @var list<string>
76
-     */
77
-    private $fallbackDirsPsr0 = array();
78
-
79
-    /** @var bool */
80
-    private $useIncludePath = false;
81
-
82
-    /**
83
-     * @var array<string, string>
84
-     */
85
-    private $classMap = array();
86
-
87
-    /** @var bool */
88
-    private $classMapAuthoritative = false;
89
-
90
-    /**
91
-     * @var array<string, bool>
92
-     */
93
-    private $missingClasses = array();
94
-
95
-    /** @var string|null */
96
-    private $apcuPrefix;
97
-
98
-    /**
99
-     * @var array<string, self>
100
-     */
101
-    private static $registeredLoaders = array();
102
-
103
-    /**
104
-     * @param string|null $vendorDir
105
-     */
106
-    public function __construct($vendorDir = null)
107
-    {
108
-        $this->vendorDir = $vendorDir;
109
-        self::initializeIncludeClosure();
110
-    }
111
-
112
-    /**
113
-     * @return array<string, list<string>>
114
-     */
115
-    public function getPrefixes()
116
-    {
117
-        if (!empty($this->prefixesPsr0)) {
118
-            return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
119
-        }
120
-
121
-        return array();
122
-    }
123
-
124
-    /**
125
-     * @return array<string, list<string>>
126
-     */
127
-    public function getPrefixesPsr4()
128
-    {
129
-        return $this->prefixDirsPsr4;
130
-    }
131
-
132
-    /**
133
-     * @return list<string>
134
-     */
135
-    public function getFallbackDirs()
136
-    {
137
-        return $this->fallbackDirsPsr0;
138
-    }
139
-
140
-    /**
141
-     * @return list<string>
142
-     */
143
-    public function getFallbackDirsPsr4()
144
-    {
145
-        return $this->fallbackDirsPsr4;
146
-    }
147
-
148
-    /**
149
-     * @return array<string, string> Array of classname => path
150
-     */
151
-    public function getClassMap()
152
-    {
153
-        return $this->classMap;
154
-    }
155
-
156
-    /**
157
-     * @param array<string, string> $classMap Class to filename map
158
-     *
159
-     * @return void
160
-     */
161
-    public function addClassMap(array $classMap)
162
-    {
163
-        if ($this->classMap) {
164
-            $this->classMap = array_merge($this->classMap, $classMap);
165
-        } else {
166
-            $this->classMap = $classMap;
167
-        }
168
-    }
169
-
170
-    /**
171
-     * Registers a set of PSR-0 directories for a given prefix, either
172
-     * appending or prepending to the ones previously set for this prefix.
173
-     *
174
-     * @param string              $prefix  The prefix
175
-     * @param list<string>|string $paths   The PSR-0 root directories
176
-     * @param bool                $prepend Whether to prepend the directories
177
-     *
178
-     * @return void
179
-     */
180
-    public function add($prefix, $paths, $prepend = false)
181
-    {
182
-        $paths = (array) $paths;
183
-        if (!$prefix) {
184
-            if ($prepend) {
185
-                $this->fallbackDirsPsr0 = array_merge(
186
-                    $paths,
187
-                    $this->fallbackDirsPsr0
188
-                );
189
-            } else {
190
-                $this->fallbackDirsPsr0 = array_merge(
191
-                    $this->fallbackDirsPsr0,
192
-                    $paths
193
-                );
194
-            }
195
-
196
-            return;
197
-        }
198
-
199
-        $first = $prefix[0];
200
-        if (!isset($this->prefixesPsr0[$first][$prefix])) {
201
-            $this->prefixesPsr0[$first][$prefix] = $paths;
202
-
203
-            return;
204
-        }
205
-        if ($prepend) {
206
-            $this->prefixesPsr0[$first][$prefix] = array_merge(
207
-                $paths,
208
-                $this->prefixesPsr0[$first][$prefix]
209
-            );
210
-        } else {
211
-            $this->prefixesPsr0[$first][$prefix] = array_merge(
212
-                $this->prefixesPsr0[$first][$prefix],
213
-                $paths
214
-            );
215
-        }
216
-    }
217
-
218
-    /**
219
-     * Registers a set of PSR-4 directories for a given namespace, either
220
-     * appending or prepending to the ones previously set for this namespace.
221
-     *
222
-     * @param string              $prefix  The prefix/namespace, with trailing '\\'
223
-     * @param list<string>|string $paths   The PSR-4 base directories
224
-     * @param bool                $prepend Whether to prepend the directories
225
-     *
226
-     * @throws \InvalidArgumentException
227
-     *
228
-     * @return void
229
-     */
230
-    public function addPsr4($prefix, $paths, $prepend = false)
231
-    {
232
-        $paths = (array) $paths;
233
-        if (!$prefix) {
234
-            // Register directories for the root namespace.
235
-            if ($prepend) {
236
-                $this->fallbackDirsPsr4 = array_merge(
237
-                    $paths,
238
-                    $this->fallbackDirsPsr4
239
-                );
240
-            } else {
241
-                $this->fallbackDirsPsr4 = array_merge(
242
-                    $this->fallbackDirsPsr4,
243
-                    $paths
244
-                );
245
-            }
246
-        } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
247
-            // Register directories for a new namespace.
248
-            $length = strlen($prefix);
249
-            if ('\\' !== $prefix[$length - 1]) {
250
-                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
251
-            }
252
-            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
253
-            $this->prefixDirsPsr4[$prefix] = $paths;
254
-        } elseif ($prepend) {
255
-            // Prepend directories for an already registered namespace.
256
-            $this->prefixDirsPsr4[$prefix] = array_merge(
257
-                $paths,
258
-                $this->prefixDirsPsr4[$prefix]
259
-            );
260
-        } else {
261
-            // Append directories for an already registered namespace.
262
-            $this->prefixDirsPsr4[$prefix] = array_merge(
263
-                $this->prefixDirsPsr4[$prefix],
264
-                $paths
265
-            );
266
-        }
267
-    }
268
-
269
-    /**
270
-     * Registers a set of PSR-0 directories for a given prefix,
271
-     * replacing any others previously set for this prefix.
272
-     *
273
-     * @param string              $prefix The prefix
274
-     * @param list<string>|string $paths  The PSR-0 base directories
275
-     *
276
-     * @return void
277
-     */
278
-    public function set($prefix, $paths)
279
-    {
280
-        if (!$prefix) {
281
-            $this->fallbackDirsPsr0 = (array) $paths;
282
-        } else {
283
-            $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
284
-        }
285
-    }
286
-
287
-    /**
288
-     * Registers a set of PSR-4 directories for a given namespace,
289
-     * replacing any others previously set for this namespace.
290
-     *
291
-     * @param string              $prefix The prefix/namespace, with trailing '\\'
292
-     * @param list<string>|string $paths  The PSR-4 base directories
293
-     *
294
-     * @throws \InvalidArgumentException
295
-     *
296
-     * @return void
297
-     */
298
-    public function setPsr4($prefix, $paths)
299
-    {
300
-        if (!$prefix) {
301
-            $this->fallbackDirsPsr4 = (array) $paths;
302
-        } else {
303
-            $length = strlen($prefix);
304
-            if ('\\' !== $prefix[$length - 1]) {
305
-                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
306
-            }
307
-            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
308
-            $this->prefixDirsPsr4[$prefix] = (array) $paths;
309
-        }
310
-    }
311
-
312
-    /**
313
-     * Turns on searching the include path for class files.
314
-     *
315
-     * @param bool $useIncludePath
316
-     *
317
-     * @return void
318
-     */
319
-    public function setUseIncludePath($useIncludePath)
320
-    {
321
-        $this->useIncludePath = $useIncludePath;
322
-    }
323
-
324
-    /**
325
-     * Can be used to check if the autoloader uses the include path to check
326
-     * for classes.
327
-     *
328
-     * @return bool
329
-     */
330
-    public function getUseIncludePath()
331
-    {
332
-        return $this->useIncludePath;
333
-    }
334
-
335
-    /**
336
-     * Turns off searching the prefix and fallback directories for classes
337
-     * that have not been registered with the class map.
338
-     *
339
-     * @param bool $classMapAuthoritative
340
-     *
341
-     * @return void
342
-     */
343
-    public function setClassMapAuthoritative($classMapAuthoritative)
344
-    {
345
-        $this->classMapAuthoritative = $classMapAuthoritative;
346
-    }
347
-
348
-    /**
349
-     * Should class lookup fail if not found in the current class map?
350
-     *
351
-     * @return bool
352
-     */
353
-    public function isClassMapAuthoritative()
354
-    {
355
-        return $this->classMapAuthoritative;
356
-    }
357
-
358
-    /**
359
-     * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
360
-     *
361
-     * @param string|null $apcuPrefix
362
-     *
363
-     * @return void
364
-     */
365
-    public function setApcuPrefix($apcuPrefix)
366
-    {
367
-        $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
368
-    }
369
-
370
-    /**
371
-     * The APCu prefix in use, or null if APCu caching is not enabled.
372
-     *
373
-     * @return string|null
374
-     */
375
-    public function getApcuPrefix()
376
-    {
377
-        return $this->apcuPrefix;
378
-    }
379
-
380
-    /**
381
-     * Registers this instance as an autoloader.
382
-     *
383
-     * @param bool $prepend Whether to prepend the autoloader or not
384
-     *
385
-     * @return void
386
-     */
387
-    public function register($prepend = false)
388
-    {
389
-        spl_autoload_register(array($this, 'loadClass'), true, $prepend);
390
-
391
-        if (null === $this->vendorDir) {
392
-            return;
393
-        }
394
-
395
-        if ($prepend) {
396
-            self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
397
-        } else {
398
-            unset(self::$registeredLoaders[$this->vendorDir]);
399
-            self::$registeredLoaders[$this->vendorDir] = $this;
400
-        }
401
-    }
402
-
403
-    /**
404
-     * Unregisters this instance as an autoloader.
405
-     *
406
-     * @return void
407
-     */
408
-    public function unregister()
409
-    {
410
-        spl_autoload_unregister(array($this, 'loadClass'));
411
-
412
-        if (null !== $this->vendorDir) {
413
-            unset(self::$registeredLoaders[$this->vendorDir]);
414
-        }
415
-    }
416
-
417
-    /**
418
-     * Loads the given class or interface.
419
-     *
420
-     * @param  string    $class The name of the class
421
-     * @return true|null True if loaded, null otherwise
422
-     */
423
-    public function loadClass($class)
424
-    {
425
-        if ($file = $this->findFile($class)) {
426
-            $includeFile = self::$includeFile;
427
-            $includeFile($file);
428
-
429
-            return true;
430
-        }
431
-
432
-        return null;
433
-    }
434
-
435
-    /**
436
-     * Finds the path to the file where the class is defined.
437
-     *
438
-     * @param string $class The name of the class
439
-     *
440
-     * @return string|false The path if found, false otherwise
441
-     */
442
-    public function findFile($class)
443
-    {
444
-        // class map lookup
445
-        if (isset($this->classMap[$class])) {
446
-            return $this->classMap[$class];
447
-        }
448
-        if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
449
-            return false;
450
-        }
451
-        if (null !== $this->apcuPrefix) {
452
-            $file = apcu_fetch($this->apcuPrefix.$class, $hit);
453
-            if ($hit) {
454
-                return $file;
455
-            }
456
-        }
457
-
458
-        $file = $this->findFileWithExtension($class, '.php');
459
-
460
-        // Search for Hack files if we are running on HHVM
461
-        if (false === $file && defined('HHVM_VERSION')) {
462
-            $file = $this->findFileWithExtension($class, '.hh');
463
-        }
464
-
465
-        if (null !== $this->apcuPrefix) {
466
-            apcu_add($this->apcuPrefix.$class, $file);
467
-        }
468
-
469
-        if (false === $file) {
470
-            // Remember that this class does not exist.
471
-            $this->missingClasses[$class] = true;
472
-        }
473
-
474
-        return $file;
475
-    }
476
-
477
-    /**
478
-     * Returns the currently registered loaders keyed by their corresponding vendor directories.
479
-     *
480
-     * @return array<string, self>
481
-     */
482
-    public static function getRegisteredLoaders()
483
-    {
484
-        return self::$registeredLoaders;
485
-    }
486
-
487
-    /**
488
-     * @param  string       $class
489
-     * @param  string       $ext
490
-     * @return string|false
491
-     */
492
-    private function findFileWithExtension($class, $ext)
493
-    {
494
-        // PSR-4 lookup
495
-        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
496
-
497
-        $first = $class[0];
498
-        if (isset($this->prefixLengthsPsr4[$first])) {
499
-            $subPath = $class;
500
-            while (false !== $lastPos = strrpos($subPath, '\\')) {
501
-                $subPath = substr($subPath, 0, $lastPos);
502
-                $search = $subPath . '\\';
503
-                if (isset($this->prefixDirsPsr4[$search])) {
504
-                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
505
-                    foreach ($this->prefixDirsPsr4[$search] as $dir) {
506
-                        if (file_exists($file = $dir . $pathEnd)) {
507
-                            return $file;
508
-                        }
509
-                    }
510
-                }
511
-            }
512
-        }
513
-
514
-        // PSR-4 fallback dirs
515
-        foreach ($this->fallbackDirsPsr4 as $dir) {
516
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
517
-                return $file;
518
-            }
519
-        }
520
-
521
-        // PSR-0 lookup
522
-        if (false !== $pos = strrpos($class, '\\')) {
523
-            // namespaced class name
524
-            $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
525
-                . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
526
-        } else {
527
-            // PEAR-like class name
528
-            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
529
-        }
530
-
531
-        if (isset($this->prefixesPsr0[$first])) {
532
-            foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
533
-                if (0 === strpos($class, $prefix)) {
534
-                    foreach ($dirs as $dir) {
535
-                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
536
-                            return $file;
537
-                        }
538
-                    }
539
-                }
540
-            }
541
-        }
542
-
543
-        // PSR-0 fallback dirs
544
-        foreach ($this->fallbackDirsPsr0 as $dir) {
545
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
546
-                return $file;
547
-            }
548
-        }
549
-
550
-        // PSR-0 include paths.
551
-        if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
552
-            return $file;
553
-        }
554
-
555
-        return false;
556
-    }
557
-
558
-    /**
559
-     * @return void
560
-     */
561
-    private static function initializeIncludeClosure()
562
-    {
563
-        if (self::$includeFile !== null) {
564
-            return;
565
-        }
566
-
567
-        /**
568
-         * Scope isolated include.
569
-         *
570
-         * Prevents access to $this/self from included files.
571
-         *
572
-         * @param  string $file
573
-         * @return void
574
-         */
575
-        self::$includeFile = \Closure::bind(static function($file) {
576
-            include $file;
577
-        }, null, null);
578
-    }
45
+	/** @var \Closure(string):void */
46
+	private static $includeFile;
47
+
48
+	/** @var string|null */
49
+	private $vendorDir;
50
+
51
+	// PSR-4
52
+	/**
53
+	 * @var array<string, array<string, int>>
54
+	 */
55
+	private $prefixLengthsPsr4 = array();
56
+	/**
57
+	 * @var array<string, list<string>>
58
+	 */
59
+	private $prefixDirsPsr4 = array();
60
+	/**
61
+	 * @var list<string>
62
+	 */
63
+	private $fallbackDirsPsr4 = array();
64
+
65
+	// PSR-0
66
+	/**
67
+	 * List of PSR-0 prefixes
68
+	 *
69
+	 * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
70
+	 *
71
+	 * @var array<string, array<string, list<string>>>
72
+	 */
73
+	private $prefixesPsr0 = array();
74
+	/**
75
+	 * @var list<string>
76
+	 */
77
+	private $fallbackDirsPsr0 = array();
78
+
79
+	/** @var bool */
80
+	private $useIncludePath = false;
81
+
82
+	/**
83
+	 * @var array<string, string>
84
+	 */
85
+	private $classMap = array();
86
+
87
+	/** @var bool */
88
+	private $classMapAuthoritative = false;
89
+
90
+	/**
91
+	 * @var array<string, bool>
92
+	 */
93
+	private $missingClasses = array();
94
+
95
+	/** @var string|null */
96
+	private $apcuPrefix;
97
+
98
+	/**
99
+	 * @var array<string, self>
100
+	 */
101
+	private static $registeredLoaders = array();
102
+
103
+	/**
104
+	 * @param string|null $vendorDir
105
+	 */
106
+	public function __construct($vendorDir = null)
107
+	{
108
+		$this->vendorDir = $vendorDir;
109
+		self::initializeIncludeClosure();
110
+	}
111
+
112
+	/**
113
+	 * @return array<string, list<string>>
114
+	 */
115
+	public function getPrefixes()
116
+	{
117
+		if (!empty($this->prefixesPsr0)) {
118
+			return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
119
+		}
120
+
121
+		return array();
122
+	}
123
+
124
+	/**
125
+	 * @return array<string, list<string>>
126
+	 */
127
+	public function getPrefixesPsr4()
128
+	{
129
+		return $this->prefixDirsPsr4;
130
+	}
131
+
132
+	/**
133
+	 * @return list<string>
134
+	 */
135
+	public function getFallbackDirs()
136
+	{
137
+		return $this->fallbackDirsPsr0;
138
+	}
139
+
140
+	/**
141
+	 * @return list<string>
142
+	 */
143
+	public function getFallbackDirsPsr4()
144
+	{
145
+		return $this->fallbackDirsPsr4;
146
+	}
147
+
148
+	/**
149
+	 * @return array<string, string> Array of classname => path
150
+	 */
151
+	public function getClassMap()
152
+	{
153
+		return $this->classMap;
154
+	}
155
+
156
+	/**
157
+	 * @param array<string, string> $classMap Class to filename map
158
+	 *
159
+	 * @return void
160
+	 */
161
+	public function addClassMap(array $classMap)
162
+	{
163
+		if ($this->classMap) {
164
+			$this->classMap = array_merge($this->classMap, $classMap);
165
+		} else {
166
+			$this->classMap = $classMap;
167
+		}
168
+	}
169
+
170
+	/**
171
+	 * Registers a set of PSR-0 directories for a given prefix, either
172
+	 * appending or prepending to the ones previously set for this prefix.
173
+	 *
174
+	 * @param string              $prefix  The prefix
175
+	 * @param list<string>|string $paths   The PSR-0 root directories
176
+	 * @param bool                $prepend Whether to prepend the directories
177
+	 *
178
+	 * @return void
179
+	 */
180
+	public function add($prefix, $paths, $prepend = false)
181
+	{
182
+		$paths = (array) $paths;
183
+		if (!$prefix) {
184
+			if ($prepend) {
185
+				$this->fallbackDirsPsr0 = array_merge(
186
+					$paths,
187
+					$this->fallbackDirsPsr0
188
+				);
189
+			} else {
190
+				$this->fallbackDirsPsr0 = array_merge(
191
+					$this->fallbackDirsPsr0,
192
+					$paths
193
+				);
194
+			}
195
+
196
+			return;
197
+		}
198
+
199
+		$first = $prefix[0];
200
+		if (!isset($this->prefixesPsr0[$first][$prefix])) {
201
+			$this->prefixesPsr0[$first][$prefix] = $paths;
202
+
203
+			return;
204
+		}
205
+		if ($prepend) {
206
+			$this->prefixesPsr0[$first][$prefix] = array_merge(
207
+				$paths,
208
+				$this->prefixesPsr0[$first][$prefix]
209
+			);
210
+		} else {
211
+			$this->prefixesPsr0[$first][$prefix] = array_merge(
212
+				$this->prefixesPsr0[$first][$prefix],
213
+				$paths
214
+			);
215
+		}
216
+	}
217
+
218
+	/**
219
+	 * Registers a set of PSR-4 directories for a given namespace, either
220
+	 * appending or prepending to the ones previously set for this namespace.
221
+	 *
222
+	 * @param string              $prefix  The prefix/namespace, with trailing '\\'
223
+	 * @param list<string>|string $paths   The PSR-4 base directories
224
+	 * @param bool                $prepend Whether to prepend the directories
225
+	 *
226
+	 * @throws \InvalidArgumentException
227
+	 *
228
+	 * @return void
229
+	 */
230
+	public function addPsr4($prefix, $paths, $prepend = false)
231
+	{
232
+		$paths = (array) $paths;
233
+		if (!$prefix) {
234
+			// Register directories for the root namespace.
235
+			if ($prepend) {
236
+				$this->fallbackDirsPsr4 = array_merge(
237
+					$paths,
238
+					$this->fallbackDirsPsr4
239
+				);
240
+			} else {
241
+				$this->fallbackDirsPsr4 = array_merge(
242
+					$this->fallbackDirsPsr4,
243
+					$paths
244
+				);
245
+			}
246
+		} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
247
+			// Register directories for a new namespace.
248
+			$length = strlen($prefix);
249
+			if ('\\' !== $prefix[$length - 1]) {
250
+				throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
251
+			}
252
+			$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
253
+			$this->prefixDirsPsr4[$prefix] = $paths;
254
+		} elseif ($prepend) {
255
+			// Prepend directories for an already registered namespace.
256
+			$this->prefixDirsPsr4[$prefix] = array_merge(
257
+				$paths,
258
+				$this->prefixDirsPsr4[$prefix]
259
+			);
260
+		} else {
261
+			// Append directories for an already registered namespace.
262
+			$this->prefixDirsPsr4[$prefix] = array_merge(
263
+				$this->prefixDirsPsr4[$prefix],
264
+				$paths
265
+			);
266
+		}
267
+	}
268
+
269
+	/**
270
+	 * Registers a set of PSR-0 directories for a given prefix,
271
+	 * replacing any others previously set for this prefix.
272
+	 *
273
+	 * @param string              $prefix The prefix
274
+	 * @param list<string>|string $paths  The PSR-0 base directories
275
+	 *
276
+	 * @return void
277
+	 */
278
+	public function set($prefix, $paths)
279
+	{
280
+		if (!$prefix) {
281
+			$this->fallbackDirsPsr0 = (array) $paths;
282
+		} else {
283
+			$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
284
+		}
285
+	}
286
+
287
+	/**
288
+	 * Registers a set of PSR-4 directories for a given namespace,
289
+	 * replacing any others previously set for this namespace.
290
+	 *
291
+	 * @param string              $prefix The prefix/namespace, with trailing '\\'
292
+	 * @param list<string>|string $paths  The PSR-4 base directories
293
+	 *
294
+	 * @throws \InvalidArgumentException
295
+	 *
296
+	 * @return void
297
+	 */
298
+	public function setPsr4($prefix, $paths)
299
+	{
300
+		if (!$prefix) {
301
+			$this->fallbackDirsPsr4 = (array) $paths;
302
+		} else {
303
+			$length = strlen($prefix);
304
+			if ('\\' !== $prefix[$length - 1]) {
305
+				throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
306
+			}
307
+			$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
308
+			$this->prefixDirsPsr4[$prefix] = (array) $paths;
309
+		}
310
+	}
311
+
312
+	/**
313
+	 * Turns on searching the include path for class files.
314
+	 *
315
+	 * @param bool $useIncludePath
316
+	 *
317
+	 * @return void
318
+	 */
319
+	public function setUseIncludePath($useIncludePath)
320
+	{
321
+		$this->useIncludePath = $useIncludePath;
322
+	}
323
+
324
+	/**
325
+	 * Can be used to check if the autoloader uses the include path to check
326
+	 * for classes.
327
+	 *
328
+	 * @return bool
329
+	 */
330
+	public function getUseIncludePath()
331
+	{
332
+		return $this->useIncludePath;
333
+	}
334
+
335
+	/**
336
+	 * Turns off searching the prefix and fallback directories for classes
337
+	 * that have not been registered with the class map.
338
+	 *
339
+	 * @param bool $classMapAuthoritative
340
+	 *
341
+	 * @return void
342
+	 */
343
+	public function setClassMapAuthoritative($classMapAuthoritative)
344
+	{
345
+		$this->classMapAuthoritative = $classMapAuthoritative;
346
+	}
347
+
348
+	/**
349
+	 * Should class lookup fail if not found in the current class map?
350
+	 *
351
+	 * @return bool
352
+	 */
353
+	public function isClassMapAuthoritative()
354
+	{
355
+		return $this->classMapAuthoritative;
356
+	}
357
+
358
+	/**
359
+	 * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
360
+	 *
361
+	 * @param string|null $apcuPrefix
362
+	 *
363
+	 * @return void
364
+	 */
365
+	public function setApcuPrefix($apcuPrefix)
366
+	{
367
+		$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
368
+	}
369
+
370
+	/**
371
+	 * The APCu prefix in use, or null if APCu caching is not enabled.
372
+	 *
373
+	 * @return string|null
374
+	 */
375
+	public function getApcuPrefix()
376
+	{
377
+		return $this->apcuPrefix;
378
+	}
379
+
380
+	/**
381
+	 * Registers this instance as an autoloader.
382
+	 *
383
+	 * @param bool $prepend Whether to prepend the autoloader or not
384
+	 *
385
+	 * @return void
386
+	 */
387
+	public function register($prepend = false)
388
+	{
389
+		spl_autoload_register(array($this, 'loadClass'), true, $prepend);
390
+
391
+		if (null === $this->vendorDir) {
392
+			return;
393
+		}
394
+
395
+		if ($prepend) {
396
+			self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
397
+		} else {
398
+			unset(self::$registeredLoaders[$this->vendorDir]);
399
+			self::$registeredLoaders[$this->vendorDir] = $this;
400
+		}
401
+	}
402
+
403
+	/**
404
+	 * Unregisters this instance as an autoloader.
405
+	 *
406
+	 * @return void
407
+	 */
408
+	public function unregister()
409
+	{
410
+		spl_autoload_unregister(array($this, 'loadClass'));
411
+
412
+		if (null !== $this->vendorDir) {
413
+			unset(self::$registeredLoaders[$this->vendorDir]);
414
+		}
415
+	}
416
+
417
+	/**
418
+	 * Loads the given class or interface.
419
+	 *
420
+	 * @param  string    $class The name of the class
421
+	 * @return true|null True if loaded, null otherwise
422
+	 */
423
+	public function loadClass($class)
424
+	{
425
+		if ($file = $this->findFile($class)) {
426
+			$includeFile = self::$includeFile;
427
+			$includeFile($file);
428
+
429
+			return true;
430
+		}
431
+
432
+		return null;
433
+	}
434
+
435
+	/**
436
+	 * Finds the path to the file where the class is defined.
437
+	 *
438
+	 * @param string $class The name of the class
439
+	 *
440
+	 * @return string|false The path if found, false otherwise
441
+	 */
442
+	public function findFile($class)
443
+	{
444
+		// class map lookup
445
+		if (isset($this->classMap[$class])) {
446
+			return $this->classMap[$class];
447
+		}
448
+		if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
449
+			return false;
450
+		}
451
+		if (null !== $this->apcuPrefix) {
452
+			$file = apcu_fetch($this->apcuPrefix.$class, $hit);
453
+			if ($hit) {
454
+				return $file;
455
+			}
456
+		}
457
+
458
+		$file = $this->findFileWithExtension($class, '.php');
459
+
460
+		// Search for Hack files if we are running on HHVM
461
+		if (false === $file && defined('HHVM_VERSION')) {
462
+			$file = $this->findFileWithExtension($class, '.hh');
463
+		}
464
+
465
+		if (null !== $this->apcuPrefix) {
466
+			apcu_add($this->apcuPrefix.$class, $file);
467
+		}
468
+
469
+		if (false === $file) {
470
+			// Remember that this class does not exist.
471
+			$this->missingClasses[$class] = true;
472
+		}
473
+
474
+		return $file;
475
+	}
476
+
477
+	/**
478
+	 * Returns the currently registered loaders keyed by their corresponding vendor directories.
479
+	 *
480
+	 * @return array<string, self>
481
+	 */
482
+	public static function getRegisteredLoaders()
483
+	{
484
+		return self::$registeredLoaders;
485
+	}
486
+
487
+	/**
488
+	 * @param  string       $class
489
+	 * @param  string       $ext
490
+	 * @return string|false
491
+	 */
492
+	private function findFileWithExtension($class, $ext)
493
+	{
494
+		// PSR-4 lookup
495
+		$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
496
+
497
+		$first = $class[0];
498
+		if (isset($this->prefixLengthsPsr4[$first])) {
499
+			$subPath = $class;
500
+			while (false !== $lastPos = strrpos($subPath, '\\')) {
501
+				$subPath = substr($subPath, 0, $lastPos);
502
+				$search = $subPath . '\\';
503
+				if (isset($this->prefixDirsPsr4[$search])) {
504
+					$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
505
+					foreach ($this->prefixDirsPsr4[$search] as $dir) {
506
+						if (file_exists($file = $dir . $pathEnd)) {
507
+							return $file;
508
+						}
509
+					}
510
+				}
511
+			}
512
+		}
513
+
514
+		// PSR-4 fallback dirs
515
+		foreach ($this->fallbackDirsPsr4 as $dir) {
516
+			if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
517
+				return $file;
518
+			}
519
+		}
520
+
521
+		// PSR-0 lookup
522
+		if (false !== $pos = strrpos($class, '\\')) {
523
+			// namespaced class name
524
+			$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
525
+				. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
526
+		} else {
527
+			// PEAR-like class name
528
+			$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
529
+		}
530
+
531
+		if (isset($this->prefixesPsr0[$first])) {
532
+			foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
533
+				if (0 === strpos($class, $prefix)) {
534
+					foreach ($dirs as $dir) {
535
+						if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
536
+							return $file;
537
+						}
538
+					}
539
+				}
540
+			}
541
+		}
542
+
543
+		// PSR-0 fallback dirs
544
+		foreach ($this->fallbackDirsPsr0 as $dir) {
545
+			if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
546
+				return $file;
547
+			}
548
+		}
549
+
550
+		// PSR-0 include paths.
551
+		if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
552
+			return $file;
553
+		}
554
+
555
+		return false;
556
+	}
557
+
558
+	/**
559
+	 * @return void
560
+	 */
561
+	private static function initializeIncludeClosure()
562
+	{
563
+		if (self::$includeFile !== null) {
564
+			return;
565
+		}
566
+
567
+		/**
568
+		 * Scope isolated include.
569
+		 *
570
+		 * Prevents access to $this/self from included files.
571
+		 *
572
+		 * @param  string $file
573
+		 * @return void
574
+		 */
575
+		self::$includeFile = \Closure::bind(static function($file) {
576
+			include $file;
577
+		}, null, null);
578
+	}
579 579
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
      */
180 180
     public function add($prefix, $paths, $prepend = false)
181 181
     {
182
-        $paths = (array) $paths;
182
+        $paths = (array)$paths;
183 183
         if (!$prefix) {
184 184
             if ($prepend) {
185 185
                 $this->fallbackDirsPsr0 = array_merge(
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      */
230 230
     public function addPsr4($prefix, $paths, $prepend = false)
231 231
     {
232
-        $paths = (array) $paths;
232
+        $paths = (array)$paths;
233 233
         if (!$prefix) {
234 234
             // Register directories for the root namespace.
235 235
             if ($prepend) {
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
     public function set($prefix, $paths)
279 279
     {
280 280
         if (!$prefix) {
281
-            $this->fallbackDirsPsr0 = (array) $paths;
281
+            $this->fallbackDirsPsr0 = (array)$paths;
282 282
         } else {
283
-            $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
283
+            $this->prefixesPsr0[$prefix[0]][$prefix] = (array)$paths;
284 284
         }
285 285
     }
286 286
 
@@ -298,14 +298,14 @@  discard block
 block discarded – undo
298 298
     public function setPsr4($prefix, $paths)
299 299
     {
300 300
         if (!$prefix) {
301
-            $this->fallbackDirsPsr4 = (array) $paths;
301
+            $this->fallbackDirsPsr4 = (array)$paths;
302 302
         } else {
303 303
             $length = strlen($prefix);
304 304
             if ('\\' !== $prefix[$length - 1]) {
305 305
                 throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
306 306
             }
307 307
             $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
308
-            $this->prefixDirsPsr4[$prefix] = (array) $paths;
308
+            $this->prefixDirsPsr4[$prefix] = (array)$paths;
309 309
         }
310 310
     }
311 311
 
@@ -492,18 +492,18 @@  discard block
 block discarded – undo
492 492
     private function findFileWithExtension($class, $ext)
493 493
     {
494 494
         // PSR-4 lookup
495
-        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
495
+        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext;
496 496
 
497 497
         $first = $class[0];
498 498
         if (isset($this->prefixLengthsPsr4[$first])) {
499 499
             $subPath = $class;
500 500
             while (false !== $lastPos = strrpos($subPath, '\\')) {
501 501
                 $subPath = substr($subPath, 0, $lastPos);
502
-                $search = $subPath . '\\';
502
+                $search = $subPath.'\\';
503 503
                 if (isset($this->prefixDirsPsr4[$search])) {
504
-                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
504
+                    $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1);
505 505
                     foreach ($this->prefixDirsPsr4[$search] as $dir) {
506
-                        if (file_exists($file = $dir . $pathEnd)) {
506
+                        if (file_exists($file = $dir.$pathEnd)) {
507 507
                             return $file;
508 508
                         }
509 509
                     }
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 
514 514
         // PSR-4 fallback dirs
515 515
         foreach ($this->fallbackDirsPsr4 as $dir) {
516
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
516
+            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) {
517 517
                 return $file;
518 518
             }
519 519
         }
@@ -525,14 +525,14 @@  discard block
 block discarded – undo
525 525
                 . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
526 526
         } else {
527 527
             // PEAR-like class name
528
-            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
528
+            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext;
529 529
         }
530 530
 
531 531
         if (isset($this->prefixesPsr0[$first])) {
532 532
             foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
533 533
                 if (0 === strpos($class, $prefix)) {
534 534
                     foreach ($dirs as $dir) {
535
-                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
535
+                        if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
536 536
                             return $file;
537 537
                         }
538 538
                     }
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 
543 543
         // PSR-0 fallback dirs
544 544
         foreach ($this->fallbackDirsPsr0 as $dir) {
545
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
545
+            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
546 546
                 return $file;
547 547
             }
548 548
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@
 block discarded – undo
40 40
  * @see    https://www.php-fig.org/psr/psr-0/
41 41
  * @see    https://www.php-fig.org/psr/psr-4/
42 42
  */
43
-class ClassLoader
44
-{
43
+class ClassLoader {
45 44
     /** @var \Closure(string):void */
46 45
     private static $includeFile;
47 46
 
Please login to merge, or discard this patch.
vendor-bin/php-scoper/vendor/composer/installed.php 2 patches
Indentation   +237 added lines, -237 removed lines patch added patch discarded remove patch
@@ -1,239 +1,239 @@
 block discarded – undo
1 1
 <?php return array(
2
-    'root' => array(
3
-        'name' => '__root__',
4
-        'pretty_version' => 'dev-master',
5
-        'version' => 'dev-master',
6
-        'reference' => '444b7c7cc252175da52a7848914a40e1a5db9499',
7
-        'type' => 'library',
8
-        'install_path' => __DIR__ . '/../../',
9
-        'aliases' => array(),
10
-        'dev' => true,
11
-    ),
12
-    'versions' => array(
13
-        '__root__' => array(
14
-            'pretty_version' => 'dev-master',
15
-            'version' => 'dev-master',
16
-            'reference' => '444b7c7cc252175da52a7848914a40e1a5db9499',
17
-            'type' => 'library',
18
-            'install_path' => __DIR__ . '/../../',
19
-            'aliases' => array(),
20
-            'dev_requirement' => false,
21
-        ),
22
-        'composer/package-versions-deprecated' => array(
23
-            'pretty_version' => '1.11.99.5',
24
-            'version' => '1.11.99.5',
25
-            'reference' => 'b4f54f74ef3453349c24a845d22392cd31e65f1d',
26
-            'type' => 'composer-plugin',
27
-            'install_path' => __DIR__ . '/./package-versions-deprecated',
28
-            'aliases' => array(),
29
-            'dev_requirement' => false,
30
-        ),
31
-        'fidry/console' => array(
32
-            'pretty_version' => '0.2.0',
33
-            'version' => '0.2.0.0',
34
-            'reference' => '850f9a7f8d231d6d5d18a91e67152268ed1afa62',
35
-            'type' => 'library',
36
-            'install_path' => __DIR__ . '/../fidry/console',
37
-            'aliases' => array(),
38
-            'dev_requirement' => false,
39
-        ),
40
-        'humbug/php-scoper' => array(
41
-            'pretty_version' => '0.17.0',
42
-            'version' => '0.17.0.0',
43
-            'reference' => 'cb23986d9309a10eaa284242f2169723af4e4a7e',
44
-            'type' => 'library',
45
-            'install_path' => __DIR__ . '/../humbug/php-scoper',
46
-            'aliases' => array(),
47
-            'dev_requirement' => false,
48
-        ),
49
-        'jetbrains/phpstorm-stubs' => array(
50
-            'pretty_version' => 'v2021.3',
51
-            'version' => '2021.3.0.0',
52
-            'reference' => 'c790a8fa467ff5d3f11b0e7c1f3698abbe37b182',
53
-            'type' => 'library',
54
-            'install_path' => __DIR__ . '/../jetbrains/phpstorm-stubs',
55
-            'aliases' => array(),
56
-            'dev_requirement' => false,
57
-        ),
58
-        'nikic/php-parser' => array(
59
-            'pretty_version' => 'v4.19.1',
60
-            'version' => '4.19.1.0',
61
-            'reference' => '4e1b88d21c69391150ace211e9eaf05810858d0b',
62
-            'type' => 'library',
63
-            'install_path' => __DIR__ . '/../nikic/php-parser',
64
-            'aliases' => array(),
65
-            'dev_requirement' => false,
66
-        ),
67
-        'ocramius/package-versions' => array(
68
-            'dev_requirement' => false,
69
-            'replaced' => array(
70
-                0 => '1.11.99',
71
-            ),
72
-        ),
73
-        'psr/container' => array(
74
-            'pretty_version' => '1.1.2',
75
-            'version' => '1.1.2.0',
76
-            'reference' => '513e0666f7216c7459170d56df27dfcefe1689ea',
77
-            'type' => 'library',
78
-            'install_path' => __DIR__ . '/../psr/container',
79
-            'aliases' => array(),
80
-            'dev_requirement' => false,
81
-        ),
82
-        'psr/event-dispatcher' => array(
83
-            'pretty_version' => '1.0.0',
84
-            'version' => '1.0.0.0',
85
-            'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0',
86
-            'type' => 'library',
87
-            'install_path' => __DIR__ . '/../psr/event-dispatcher',
88
-            'aliases' => array(),
89
-            'dev_requirement' => false,
90
-        ),
91
-        'psr/log-implementation' => array(
92
-            'dev_requirement' => false,
93
-            'provided' => array(
94
-                0 => '1.0|2.0',
95
-            ),
96
-        ),
97
-        'symfony/console' => array(
98
-            'pretty_version' => 'v5.4.36',
99
-            'version' => '5.4.36.0',
100
-            'reference' => '39f75d9d73d0c11952fdcecf4877b4d0f62a8f6e',
101
-            'type' => 'library',
102
-            'install_path' => __DIR__ . '/../symfony/console',
103
-            'aliases' => array(),
104
-            'dev_requirement' => false,
105
-        ),
106
-        'symfony/deprecation-contracts' => array(
107
-            'pretty_version' => 'v3.4.0',
108
-            'version' => '3.4.0.0',
109
-            'reference' => '7c3aff79d10325257a001fcf92d991f24fc967cf',
110
-            'type' => 'library',
111
-            'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
112
-            'aliases' => array(),
113
-            'dev_requirement' => false,
114
-        ),
115
-        'symfony/event-dispatcher-contracts' => array(
116
-            'pretty_version' => 'v2.5.3',
117
-            'version' => '2.5.3.0',
118
-            'reference' => '540f4c73e87fd0c71ca44a6aa305d024ac68cb73',
119
-            'type' => 'library',
120
-            'install_path' => __DIR__ . '/../symfony/event-dispatcher-contracts',
121
-            'aliases' => array(),
122
-            'dev_requirement' => false,
123
-        ),
124
-        'symfony/filesystem' => array(
125
-            'pretty_version' => 'v5.4.38',
126
-            'version' => '5.4.38.0',
127
-            'reference' => '899330a01056077271e2f614c7b28b0379a671eb',
128
-            'type' => 'library',
129
-            'install_path' => __DIR__ . '/../symfony/filesystem',
130
-            'aliases' => array(),
131
-            'dev_requirement' => false,
132
-        ),
133
-        'symfony/finder' => array(
134
-            'pretty_version' => 'v5.4.35',
135
-            'version' => '5.4.35.0',
136
-            'reference' => 'abe6d6f77d9465fed3cd2d029b29d03b56b56435',
137
-            'type' => 'library',
138
-            'install_path' => __DIR__ . '/../symfony/finder',
139
-            'aliases' => array(),
140
-            'dev_requirement' => false,
141
-        ),
142
-        'symfony/polyfill-ctype' => array(
143
-            'pretty_version' => 'v1.29.0',
144
-            'version' => '1.29.0.0',
145
-            'reference' => 'ef4d7e442ca910c4764bce785146269b30cb5fc4',
146
-            'type' => 'library',
147
-            'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
148
-            'aliases' => array(),
149
-            'dev_requirement' => false,
150
-        ),
151
-        'symfony/polyfill-intl-grapheme' => array(
152
-            'pretty_version' => 'v1.29.0',
153
-            'version' => '1.29.0.0',
154
-            'reference' => '32a9da87d7b3245e09ac426c83d334ae9f06f80f',
155
-            'type' => 'library',
156
-            'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme',
157
-            'aliases' => array(),
158
-            'dev_requirement' => false,
159
-        ),
160
-        'symfony/polyfill-intl-normalizer' => array(
161
-            'pretty_version' => 'v1.29.0',
162
-            'version' => '1.29.0.0',
163
-            'reference' => 'bc45c394692b948b4d383a08d7753968bed9a83d',
164
-            'type' => 'library',
165
-            'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
166
-            'aliases' => array(),
167
-            'dev_requirement' => false,
168
-        ),
169
-        'symfony/polyfill-mbstring' => array(
170
-            'pretty_version' => 'v1.29.0',
171
-            'version' => '1.29.0.0',
172
-            'reference' => '9773676c8a1bb1f8d4340a62efe641cf76eda7ec',
173
-            'type' => 'library',
174
-            'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
175
-            'aliases' => array(),
176
-            'dev_requirement' => false,
177
-        ),
178
-        'symfony/polyfill-php73' => array(
179
-            'dev_requirement' => false,
180
-            'replaced' => array(
181
-                0 => '*',
182
-            ),
183
-        ),
184
-        'symfony/polyfill-php80' => array(
185
-            'pretty_version' => 'v1.29.0',
186
-            'version' => '1.29.0.0',
187
-            'reference' => '87b68208d5c1188808dd7839ee1e6c8ec3b02f1b',
188
-            'type' => 'library',
189
-            'install_path' => __DIR__ . '/../symfony/polyfill-php80',
190
-            'aliases' => array(),
191
-            'dev_requirement' => false,
192
-        ),
193
-        'symfony/polyfill-php81' => array(
194
-            'pretty_version' => 'v1.29.0',
195
-            'version' => '1.29.0.0',
196
-            'reference' => 'c565ad1e63f30e7477fc40738343c62b40bc672d',
197
-            'type' => 'library',
198
-            'install_path' => __DIR__ . '/../symfony/polyfill-php81',
199
-            'aliases' => array(),
200
-            'dev_requirement' => false,
201
-        ),
202
-        'symfony/service-contracts' => array(
203
-            'pretty_version' => 'v2.5.3',
204
-            'version' => '2.5.3.0',
205
-            'reference' => 'a2329596ddc8fd568900e3fc76cba42489ecc7f3',
206
-            'type' => 'library',
207
-            'install_path' => __DIR__ . '/../symfony/service-contracts',
208
-            'aliases' => array(),
209
-            'dev_requirement' => false,
210
-        ),
211
-        'symfony/string' => array(
212
-            'pretty_version' => 'v6.4.4',
213
-            'version' => '6.4.4.0',
214
-            'reference' => '4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9',
215
-            'type' => 'library',
216
-            'install_path' => __DIR__ . '/../symfony/string',
217
-            'aliases' => array(),
218
-            'dev_requirement' => false,
219
-        ),
220
-        'thecodingmachine/safe' => array(
221
-            'pretty_version' => 'v1.3.3',
222
-            'version' => '1.3.3.0',
223
-            'reference' => 'a8ab0876305a4cdaef31b2350fcb9811b5608dbc',
224
-            'type' => 'library',
225
-            'install_path' => __DIR__ . '/../thecodingmachine/safe',
226
-            'aliases' => array(),
227
-            'dev_requirement' => false,
228
-        ),
229
-        'webmozart/assert' => array(
230
-            'pretty_version' => '1.11.0',
231
-            'version' => '1.11.0.0',
232
-            'reference' => '11cb2199493b2f8a3b53e7f19068fc6aac760991',
233
-            'type' => 'library',
234
-            'install_path' => __DIR__ . '/../webmozart/assert',
235
-            'aliases' => array(),
236
-            'dev_requirement' => false,
237
-        ),
238
-    ),
2
+	'root' => array(
3
+		'name' => '__root__',
4
+		'pretty_version' => 'dev-master',
5
+		'version' => 'dev-master',
6
+		'reference' => '444b7c7cc252175da52a7848914a40e1a5db9499',
7
+		'type' => 'library',
8
+		'install_path' => __DIR__ . '/../../',
9
+		'aliases' => array(),
10
+		'dev' => true,
11
+	),
12
+	'versions' => array(
13
+		'__root__' => array(
14
+			'pretty_version' => 'dev-master',
15
+			'version' => 'dev-master',
16
+			'reference' => '444b7c7cc252175da52a7848914a40e1a5db9499',
17
+			'type' => 'library',
18
+			'install_path' => __DIR__ . '/../../',
19
+			'aliases' => array(),
20
+			'dev_requirement' => false,
21
+		),
22
+		'composer/package-versions-deprecated' => array(
23
+			'pretty_version' => '1.11.99.5',
24
+			'version' => '1.11.99.5',
25
+			'reference' => 'b4f54f74ef3453349c24a845d22392cd31e65f1d',
26
+			'type' => 'composer-plugin',
27
+			'install_path' => __DIR__ . '/./package-versions-deprecated',
28
+			'aliases' => array(),
29
+			'dev_requirement' => false,
30
+		),
31
+		'fidry/console' => array(
32
+			'pretty_version' => '0.2.0',
33
+			'version' => '0.2.0.0',
34
+			'reference' => '850f9a7f8d231d6d5d18a91e67152268ed1afa62',
35
+			'type' => 'library',
36
+			'install_path' => __DIR__ . '/../fidry/console',
37
+			'aliases' => array(),
38
+			'dev_requirement' => false,
39
+		),
40
+		'humbug/php-scoper' => array(
41
+			'pretty_version' => '0.17.0',
42
+			'version' => '0.17.0.0',
43
+			'reference' => 'cb23986d9309a10eaa284242f2169723af4e4a7e',
44
+			'type' => 'library',
45
+			'install_path' => __DIR__ . '/../humbug/php-scoper',
46
+			'aliases' => array(),
47
+			'dev_requirement' => false,
48
+		),
49
+		'jetbrains/phpstorm-stubs' => array(
50
+			'pretty_version' => 'v2021.3',
51
+			'version' => '2021.3.0.0',
52
+			'reference' => 'c790a8fa467ff5d3f11b0e7c1f3698abbe37b182',
53
+			'type' => 'library',
54
+			'install_path' => __DIR__ . '/../jetbrains/phpstorm-stubs',
55
+			'aliases' => array(),
56
+			'dev_requirement' => false,
57
+		),
58
+		'nikic/php-parser' => array(
59
+			'pretty_version' => 'v4.19.1',
60
+			'version' => '4.19.1.0',
61
+			'reference' => '4e1b88d21c69391150ace211e9eaf05810858d0b',
62
+			'type' => 'library',
63
+			'install_path' => __DIR__ . '/../nikic/php-parser',
64
+			'aliases' => array(),
65
+			'dev_requirement' => false,
66
+		),
67
+		'ocramius/package-versions' => array(
68
+			'dev_requirement' => false,
69
+			'replaced' => array(
70
+				0 => '1.11.99',
71
+			),
72
+		),
73
+		'psr/container' => array(
74
+			'pretty_version' => '1.1.2',
75
+			'version' => '1.1.2.0',
76
+			'reference' => '513e0666f7216c7459170d56df27dfcefe1689ea',
77
+			'type' => 'library',
78
+			'install_path' => __DIR__ . '/../psr/container',
79
+			'aliases' => array(),
80
+			'dev_requirement' => false,
81
+		),
82
+		'psr/event-dispatcher' => array(
83
+			'pretty_version' => '1.0.0',
84
+			'version' => '1.0.0.0',
85
+			'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0',
86
+			'type' => 'library',
87
+			'install_path' => __DIR__ . '/../psr/event-dispatcher',
88
+			'aliases' => array(),
89
+			'dev_requirement' => false,
90
+		),
91
+		'psr/log-implementation' => array(
92
+			'dev_requirement' => false,
93
+			'provided' => array(
94
+				0 => '1.0|2.0',
95
+			),
96
+		),
97
+		'symfony/console' => array(
98
+			'pretty_version' => 'v5.4.36',
99
+			'version' => '5.4.36.0',
100
+			'reference' => '39f75d9d73d0c11952fdcecf4877b4d0f62a8f6e',
101
+			'type' => 'library',
102
+			'install_path' => __DIR__ . '/../symfony/console',
103
+			'aliases' => array(),
104
+			'dev_requirement' => false,
105
+		),
106
+		'symfony/deprecation-contracts' => array(
107
+			'pretty_version' => 'v3.4.0',
108
+			'version' => '3.4.0.0',
109
+			'reference' => '7c3aff79d10325257a001fcf92d991f24fc967cf',
110
+			'type' => 'library',
111
+			'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
112
+			'aliases' => array(),
113
+			'dev_requirement' => false,
114
+		),
115
+		'symfony/event-dispatcher-contracts' => array(
116
+			'pretty_version' => 'v2.5.3',
117
+			'version' => '2.5.3.0',
118
+			'reference' => '540f4c73e87fd0c71ca44a6aa305d024ac68cb73',
119
+			'type' => 'library',
120
+			'install_path' => __DIR__ . '/../symfony/event-dispatcher-contracts',
121
+			'aliases' => array(),
122
+			'dev_requirement' => false,
123
+		),
124
+		'symfony/filesystem' => array(
125
+			'pretty_version' => 'v5.4.38',
126
+			'version' => '5.4.38.0',
127
+			'reference' => '899330a01056077271e2f614c7b28b0379a671eb',
128
+			'type' => 'library',
129
+			'install_path' => __DIR__ . '/../symfony/filesystem',
130
+			'aliases' => array(),
131
+			'dev_requirement' => false,
132
+		),
133
+		'symfony/finder' => array(
134
+			'pretty_version' => 'v5.4.35',
135
+			'version' => '5.4.35.0',
136
+			'reference' => 'abe6d6f77d9465fed3cd2d029b29d03b56b56435',
137
+			'type' => 'library',
138
+			'install_path' => __DIR__ . '/../symfony/finder',
139
+			'aliases' => array(),
140
+			'dev_requirement' => false,
141
+		),
142
+		'symfony/polyfill-ctype' => array(
143
+			'pretty_version' => 'v1.29.0',
144
+			'version' => '1.29.0.0',
145
+			'reference' => 'ef4d7e442ca910c4764bce785146269b30cb5fc4',
146
+			'type' => 'library',
147
+			'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
148
+			'aliases' => array(),
149
+			'dev_requirement' => false,
150
+		),
151
+		'symfony/polyfill-intl-grapheme' => array(
152
+			'pretty_version' => 'v1.29.0',
153
+			'version' => '1.29.0.0',
154
+			'reference' => '32a9da87d7b3245e09ac426c83d334ae9f06f80f',
155
+			'type' => 'library',
156
+			'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme',
157
+			'aliases' => array(),
158
+			'dev_requirement' => false,
159
+		),
160
+		'symfony/polyfill-intl-normalizer' => array(
161
+			'pretty_version' => 'v1.29.0',
162
+			'version' => '1.29.0.0',
163
+			'reference' => 'bc45c394692b948b4d383a08d7753968bed9a83d',
164
+			'type' => 'library',
165
+			'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
166
+			'aliases' => array(),
167
+			'dev_requirement' => false,
168
+		),
169
+		'symfony/polyfill-mbstring' => array(
170
+			'pretty_version' => 'v1.29.0',
171
+			'version' => '1.29.0.0',
172
+			'reference' => '9773676c8a1bb1f8d4340a62efe641cf76eda7ec',
173
+			'type' => 'library',
174
+			'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
175
+			'aliases' => array(),
176
+			'dev_requirement' => false,
177
+		),
178
+		'symfony/polyfill-php73' => array(
179
+			'dev_requirement' => false,
180
+			'replaced' => array(
181
+				0 => '*',
182
+			),
183
+		),
184
+		'symfony/polyfill-php80' => array(
185
+			'pretty_version' => 'v1.29.0',
186
+			'version' => '1.29.0.0',
187
+			'reference' => '87b68208d5c1188808dd7839ee1e6c8ec3b02f1b',
188
+			'type' => 'library',
189
+			'install_path' => __DIR__ . '/../symfony/polyfill-php80',
190
+			'aliases' => array(),
191
+			'dev_requirement' => false,
192
+		),
193
+		'symfony/polyfill-php81' => array(
194
+			'pretty_version' => 'v1.29.0',
195
+			'version' => '1.29.0.0',
196
+			'reference' => 'c565ad1e63f30e7477fc40738343c62b40bc672d',
197
+			'type' => 'library',
198
+			'install_path' => __DIR__ . '/../symfony/polyfill-php81',
199
+			'aliases' => array(),
200
+			'dev_requirement' => false,
201
+		),
202
+		'symfony/service-contracts' => array(
203
+			'pretty_version' => 'v2.5.3',
204
+			'version' => '2.5.3.0',
205
+			'reference' => 'a2329596ddc8fd568900e3fc76cba42489ecc7f3',
206
+			'type' => 'library',
207
+			'install_path' => __DIR__ . '/../symfony/service-contracts',
208
+			'aliases' => array(),
209
+			'dev_requirement' => false,
210
+		),
211
+		'symfony/string' => array(
212
+			'pretty_version' => 'v6.4.4',
213
+			'version' => '6.4.4.0',
214
+			'reference' => '4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9',
215
+			'type' => 'library',
216
+			'install_path' => __DIR__ . '/../symfony/string',
217
+			'aliases' => array(),
218
+			'dev_requirement' => false,
219
+		),
220
+		'thecodingmachine/safe' => array(
221
+			'pretty_version' => 'v1.3.3',
222
+			'version' => '1.3.3.0',
223
+			'reference' => 'a8ab0876305a4cdaef31b2350fcb9811b5608dbc',
224
+			'type' => 'library',
225
+			'install_path' => __DIR__ . '/../thecodingmachine/safe',
226
+			'aliases' => array(),
227
+			'dev_requirement' => false,
228
+		),
229
+		'webmozart/assert' => array(
230
+			'pretty_version' => '1.11.0',
231
+			'version' => '1.11.0.0',
232
+			'reference' => '11cb2199493b2f8a3b53e7f19068fc6aac760991',
233
+			'type' => 'library',
234
+			'install_path' => __DIR__ . '/../webmozart/assert',
235
+			'aliases' => array(),
236
+			'dev_requirement' => false,
237
+		),
238
+	),
239 239
 );
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
         'version' => 'dev-master',
6 6
         'reference' => '444b7c7cc252175da52a7848914a40e1a5db9499',
7 7
         'type' => 'library',
8
-        'install_path' => __DIR__ . '/../../',
8
+        'install_path' => __DIR__.'/../../',
9 9
         'aliases' => array(),
10 10
         'dev' => true,
11 11
     ),
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
             'version' => 'dev-master',
16 16
             'reference' => '444b7c7cc252175da52a7848914a40e1a5db9499',
17 17
             'type' => 'library',
18
-            'install_path' => __DIR__ . '/../../',
18
+            'install_path' => __DIR__.'/../../',
19 19
             'aliases' => array(),
20 20
             'dev_requirement' => false,
21 21
         ),
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
             'version' => '1.11.99.5',
25 25
             'reference' => 'b4f54f74ef3453349c24a845d22392cd31e65f1d',
26 26
             'type' => 'composer-plugin',
27
-            'install_path' => __DIR__ . '/./package-versions-deprecated',
27
+            'install_path' => __DIR__.'/./package-versions-deprecated',
28 28
             'aliases' => array(),
29 29
             'dev_requirement' => false,
30 30
         ),
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             'version' => '0.2.0.0',
34 34
             'reference' => '850f9a7f8d231d6d5d18a91e67152268ed1afa62',
35 35
             'type' => 'library',
36
-            'install_path' => __DIR__ . '/../fidry/console',
36
+            'install_path' => __DIR__.'/../fidry/console',
37 37
             'aliases' => array(),
38 38
             'dev_requirement' => false,
39 39
         ),
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
             'version' => '0.17.0.0',
43 43
             'reference' => 'cb23986d9309a10eaa284242f2169723af4e4a7e',
44 44
             'type' => 'library',
45
-            'install_path' => __DIR__ . '/../humbug/php-scoper',
45
+            'install_path' => __DIR__.'/../humbug/php-scoper',
46 46
             'aliases' => array(),
47 47
             'dev_requirement' => false,
48 48
         ),
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             'version' => '2021.3.0.0',
52 52
             'reference' => 'c790a8fa467ff5d3f11b0e7c1f3698abbe37b182',
53 53
             'type' => 'library',
54
-            'install_path' => __DIR__ . '/../jetbrains/phpstorm-stubs',
54
+            'install_path' => __DIR__.'/../jetbrains/phpstorm-stubs',
55 55
             'aliases' => array(),
56 56
             'dev_requirement' => false,
57 57
         ),
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             'version' => '4.19.1.0',
61 61
             'reference' => '4e1b88d21c69391150ace211e9eaf05810858d0b',
62 62
             'type' => 'library',
63
-            'install_path' => __DIR__ . '/../nikic/php-parser',
63
+            'install_path' => __DIR__.'/../nikic/php-parser',
64 64
             'aliases' => array(),
65 65
             'dev_requirement' => false,
66 66
         ),
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             'version' => '1.1.2.0',
76 76
             'reference' => '513e0666f7216c7459170d56df27dfcefe1689ea',
77 77
             'type' => 'library',
78
-            'install_path' => __DIR__ . '/../psr/container',
78
+            'install_path' => __DIR__.'/../psr/container',
79 79
             'aliases' => array(),
80 80
             'dev_requirement' => false,
81 81
         ),
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             'version' => '1.0.0.0',
85 85
             'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0',
86 86
             'type' => 'library',
87
-            'install_path' => __DIR__ . '/../psr/event-dispatcher',
87
+            'install_path' => __DIR__.'/../psr/event-dispatcher',
88 88
             'aliases' => array(),
89 89
             'dev_requirement' => false,
90 90
         ),
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             'version' => '5.4.36.0',
100 100
             'reference' => '39f75d9d73d0c11952fdcecf4877b4d0f62a8f6e',
101 101
             'type' => 'library',
102
-            'install_path' => __DIR__ . '/../symfony/console',
102
+            'install_path' => __DIR__.'/../symfony/console',
103 103
             'aliases' => array(),
104 104
             'dev_requirement' => false,
105 105
         ),
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             'version' => '3.4.0.0',
109 109
             'reference' => '7c3aff79d10325257a001fcf92d991f24fc967cf',
110 110
             'type' => 'library',
111
-            'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
111
+            'install_path' => __DIR__.'/../symfony/deprecation-contracts',
112 112
             'aliases' => array(),
113 113
             'dev_requirement' => false,
114 114
         ),
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             'version' => '2.5.3.0',
118 118
             'reference' => '540f4c73e87fd0c71ca44a6aa305d024ac68cb73',
119 119
             'type' => 'library',
120
-            'install_path' => __DIR__ . '/../symfony/event-dispatcher-contracts',
120
+            'install_path' => __DIR__.'/../symfony/event-dispatcher-contracts',
121 121
             'aliases' => array(),
122 122
             'dev_requirement' => false,
123 123
         ),
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
             'version' => '5.4.38.0',
127 127
             'reference' => '899330a01056077271e2f614c7b28b0379a671eb',
128 128
             'type' => 'library',
129
-            'install_path' => __DIR__ . '/../symfony/filesystem',
129
+            'install_path' => __DIR__.'/../symfony/filesystem',
130 130
             'aliases' => array(),
131 131
             'dev_requirement' => false,
132 132
         ),
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             'version' => '5.4.35.0',
136 136
             'reference' => 'abe6d6f77d9465fed3cd2d029b29d03b56b56435',
137 137
             'type' => 'library',
138
-            'install_path' => __DIR__ . '/../symfony/finder',
138
+            'install_path' => __DIR__.'/../symfony/finder',
139 139
             'aliases' => array(),
140 140
             'dev_requirement' => false,
141 141
         ),
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             'version' => '1.29.0.0',
145 145
             'reference' => 'ef4d7e442ca910c4764bce785146269b30cb5fc4',
146 146
             'type' => 'library',
147
-            'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
147
+            'install_path' => __DIR__.'/../symfony/polyfill-ctype',
148 148
             'aliases' => array(),
149 149
             'dev_requirement' => false,
150 150
         ),
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             'version' => '1.29.0.0',
154 154
             'reference' => '32a9da87d7b3245e09ac426c83d334ae9f06f80f',
155 155
             'type' => 'library',
156
-            'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme',
156
+            'install_path' => __DIR__.'/../symfony/polyfill-intl-grapheme',
157 157
             'aliases' => array(),
158 158
             'dev_requirement' => false,
159 159
         ),
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             'version' => '1.29.0.0',
163 163
             'reference' => 'bc45c394692b948b4d383a08d7753968bed9a83d',
164 164
             'type' => 'library',
165
-            'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
165
+            'install_path' => __DIR__.'/../symfony/polyfill-intl-normalizer',
166 166
             'aliases' => array(),
167 167
             'dev_requirement' => false,
168 168
         ),
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
             'version' => '1.29.0.0',
172 172
             'reference' => '9773676c8a1bb1f8d4340a62efe641cf76eda7ec',
173 173
             'type' => 'library',
174
-            'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
174
+            'install_path' => __DIR__.'/../symfony/polyfill-mbstring',
175 175
             'aliases' => array(),
176 176
             'dev_requirement' => false,
177 177
         ),
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
             'version' => '1.29.0.0',
187 187
             'reference' => '87b68208d5c1188808dd7839ee1e6c8ec3b02f1b',
188 188
             'type' => 'library',
189
-            'install_path' => __DIR__ . '/../symfony/polyfill-php80',
189
+            'install_path' => __DIR__.'/../symfony/polyfill-php80',
190 190
             'aliases' => array(),
191 191
             'dev_requirement' => false,
192 192
         ),
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             'version' => '1.29.0.0',
196 196
             'reference' => 'c565ad1e63f30e7477fc40738343c62b40bc672d',
197 197
             'type' => 'library',
198
-            'install_path' => __DIR__ . '/../symfony/polyfill-php81',
198
+            'install_path' => __DIR__.'/../symfony/polyfill-php81',
199 199
             'aliases' => array(),
200 200
             'dev_requirement' => false,
201 201
         ),
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
             'version' => '2.5.3.0',
205 205
             'reference' => 'a2329596ddc8fd568900e3fc76cba42489ecc7f3',
206 206
             'type' => 'library',
207
-            'install_path' => __DIR__ . '/../symfony/service-contracts',
207
+            'install_path' => __DIR__.'/../symfony/service-contracts',
208 208
             'aliases' => array(),
209 209
             'dev_requirement' => false,
210 210
         ),
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             'version' => '6.4.4.0',
214 214
             'reference' => '4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9',
215 215
             'type' => 'library',
216
-            'install_path' => __DIR__ . '/../symfony/string',
216
+            'install_path' => __DIR__.'/../symfony/string',
217 217
             'aliases' => array(),
218 218
             'dev_requirement' => false,
219 219
         ),
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
             'version' => '1.3.3.0',
223 223
             'reference' => 'a8ab0876305a4cdaef31b2350fcb9811b5608dbc',
224 224
             'type' => 'library',
225
-            'install_path' => __DIR__ . '/../thecodingmachine/safe',
225
+            'install_path' => __DIR__.'/../thecodingmachine/safe',
226 226
             'aliases' => array(),
227 227
             'dev_requirement' => false,
228 228
         ),
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
             'version' => '1.11.0.0',
232 232
             'reference' => '11cb2199493b2f8a3b53e7f19068fc6aac760991',
233 233
             'type' => 'library',
234
-            'install_path' => __DIR__ . '/../webmozart/assert',
234
+            'install_path' => __DIR__.'/../webmozart/assert',
235 235
             'aliases' => array(),
236 236
             'dev_requirement' => false,
237 237
         ),
Please login to merge, or discard this patch.
vendor-bin/php-scoper/vendor/composer/InstalledVersions.php 3 patches
Indentation   +330 added lines, -330 removed lines patch added patch discarded remove patch
@@ -26,334 +26,334 @@
 block discarded – undo
26 26
  */
27 27
 class InstalledVersions
28 28
 {
29
-    /**
30
-     * @var mixed[]|null
31
-     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
32
-     */
33
-    private static $installed;
34
-
35
-    /**
36
-     * @var bool|null
37
-     */
38
-    private static $canGetVendors;
39
-
40
-    /**
41
-     * @var array[]
42
-     * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
43
-     */
44
-    private static $installedByVendor = array();
45
-
46
-    /**
47
-     * Returns a list of all package names which are present, either by being installed, replaced or provided
48
-     *
49
-     * @return string[]
50
-     * @psalm-return list<string>
51
-     */
52
-    public static function getInstalledPackages()
53
-    {
54
-        $packages = array();
55
-        foreach (self::getInstalled() as $installed) {
56
-            $packages[] = array_keys($installed['versions']);
57
-        }
58
-
59
-        if (1 === \count($packages)) {
60
-            return $packages[0];
61
-        }
62
-
63
-        return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
64
-    }
65
-
66
-    /**
67
-     * Returns a list of all package names with a specific type e.g. 'library'
68
-     *
69
-     * @param  string   $type
70
-     * @return string[]
71
-     * @psalm-return list<string>
72
-     */
73
-    public static function getInstalledPackagesByType($type)
74
-    {
75
-        $packagesByType = array();
76
-
77
-        foreach (self::getInstalled() as $installed) {
78
-            foreach ($installed['versions'] as $name => $package) {
79
-                if (isset($package['type']) && $package['type'] === $type) {
80
-                    $packagesByType[] = $name;
81
-                }
82
-            }
83
-        }
84
-
85
-        return $packagesByType;
86
-    }
87
-
88
-    /**
89
-     * Checks whether the given package is installed
90
-     *
91
-     * This also returns true if the package name is provided or replaced by another package
92
-     *
93
-     * @param  string $packageName
94
-     * @param  bool   $includeDevRequirements
95
-     * @return bool
96
-     */
97
-    public static function isInstalled($packageName, $includeDevRequirements = true)
98
-    {
99
-        foreach (self::getInstalled() as $installed) {
100
-            if (isset($installed['versions'][$packageName])) {
101
-                return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
102
-            }
103
-        }
104
-
105
-        return false;
106
-    }
107
-
108
-    /**
109
-     * Checks whether the given package satisfies a version constraint
110
-     *
111
-     * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
112
-     *
113
-     *   Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
114
-     *
115
-     * @param  VersionParser $parser      Install composer/semver to have access to this class and functionality
116
-     * @param  string        $packageName
117
-     * @param  string|null   $constraint  A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
118
-     * @return bool
119
-     */
120
-    public static function satisfies(VersionParser $parser, $packageName, $constraint)
121
-    {
122
-        $constraint = $parser->parseConstraints((string) $constraint);
123
-        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
124
-
125
-        return $provided->matches($constraint);
126
-    }
127
-
128
-    /**
129
-     * Returns a version constraint representing all the range(s) which are installed for a given package
130
-     *
131
-     * It is easier to use this via isInstalled() with the $constraint argument if you need to check
132
-     * whether a given version of a package is installed, and not just whether it exists
133
-     *
134
-     * @param  string $packageName
135
-     * @return string Version constraint usable with composer/semver
136
-     */
137
-    public static function getVersionRanges($packageName)
138
-    {
139
-        foreach (self::getInstalled() as $installed) {
140
-            if (!isset($installed['versions'][$packageName])) {
141
-                continue;
142
-            }
143
-
144
-            $ranges = array();
145
-            if (isset($installed['versions'][$packageName]['pretty_version'])) {
146
-                $ranges[] = $installed['versions'][$packageName]['pretty_version'];
147
-            }
148
-            if (array_key_exists('aliases', $installed['versions'][$packageName])) {
149
-                $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
150
-            }
151
-            if (array_key_exists('replaced', $installed['versions'][$packageName])) {
152
-                $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
153
-            }
154
-            if (array_key_exists('provided', $installed['versions'][$packageName])) {
155
-                $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
156
-            }
157
-
158
-            return implode(' || ', $ranges);
159
-        }
160
-
161
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
162
-    }
163
-
164
-    /**
165
-     * @param  string      $packageName
166
-     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
167
-     */
168
-    public static function getVersion($packageName)
169
-    {
170
-        foreach (self::getInstalled() as $installed) {
171
-            if (!isset($installed['versions'][$packageName])) {
172
-                continue;
173
-            }
174
-
175
-            if (!isset($installed['versions'][$packageName]['version'])) {
176
-                return null;
177
-            }
178
-
179
-            return $installed['versions'][$packageName]['version'];
180
-        }
181
-
182
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
183
-    }
184
-
185
-    /**
186
-     * @param  string      $packageName
187
-     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
188
-     */
189
-    public static function getPrettyVersion($packageName)
190
-    {
191
-        foreach (self::getInstalled() as $installed) {
192
-            if (!isset($installed['versions'][$packageName])) {
193
-                continue;
194
-            }
195
-
196
-            if (!isset($installed['versions'][$packageName]['pretty_version'])) {
197
-                return null;
198
-            }
199
-
200
-            return $installed['versions'][$packageName]['pretty_version'];
201
-        }
202
-
203
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
204
-    }
205
-
206
-    /**
207
-     * @param  string      $packageName
208
-     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
209
-     */
210
-    public static function getReference($packageName)
211
-    {
212
-        foreach (self::getInstalled() as $installed) {
213
-            if (!isset($installed['versions'][$packageName])) {
214
-                continue;
215
-            }
216
-
217
-            if (!isset($installed['versions'][$packageName]['reference'])) {
218
-                return null;
219
-            }
220
-
221
-            return $installed['versions'][$packageName]['reference'];
222
-        }
223
-
224
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
225
-    }
226
-
227
-    /**
228
-     * @param  string      $packageName
229
-     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
230
-     */
231
-    public static function getInstallPath($packageName)
232
-    {
233
-        foreach (self::getInstalled() as $installed) {
234
-            if (!isset($installed['versions'][$packageName])) {
235
-                continue;
236
-            }
237
-
238
-            return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
239
-        }
240
-
241
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
242
-    }
243
-
244
-    /**
245
-     * @return array
246
-     * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
247
-     */
248
-    public static function getRootPackage()
249
-    {
250
-        $installed = self::getInstalled();
251
-
252
-        return $installed[0]['root'];
253
-    }
254
-
255
-    /**
256
-     * Returns the raw installed.php data for custom implementations
257
-     *
258
-     * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
259
-     * @return array[]
260
-     * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
261
-     */
262
-    public static function getRawData()
263
-    {
264
-        @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
265
-
266
-        if (null === self::$installed) {
267
-            // only require the installed.php file if this file is loaded from its dumped location,
268
-            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
269
-            if (substr(__DIR__, -8, 1) !== 'C') {
270
-                self::$installed = include __DIR__ . '/installed.php';
271
-            } else {
272
-                self::$installed = array();
273
-            }
274
-        }
275
-
276
-        return self::$installed;
277
-    }
278
-
279
-    /**
280
-     * Returns the raw data of all installed.php which are currently loaded for custom implementations
281
-     *
282
-     * @return array[]
283
-     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
284
-     */
285
-    public static function getAllRawData()
286
-    {
287
-        return self::getInstalled();
288
-    }
289
-
290
-    /**
291
-     * Lets you reload the static array from another file
292
-     *
293
-     * This is only useful for complex integrations in which a project needs to use
294
-     * this class but then also needs to execute another project's autoloader in process,
295
-     * and wants to ensure both projects have access to their version of installed.php.
296
-     *
297
-     * A typical case would be PHPUnit, where it would need to make sure it reads all
298
-     * the data it needs from this class, then call reload() with
299
-     * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
300
-     * the project in which it runs can then also use this class safely, without
301
-     * interference between PHPUnit's dependencies and the project's dependencies.
302
-     *
303
-     * @param  array[] $data A vendor/composer/installed.php data set
304
-     * @return void
305
-     *
306
-     * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
307
-     */
308
-    public static function reload($data)
309
-    {
310
-        self::$installed = $data;
311
-        self::$installedByVendor = array();
312
-    }
313
-
314
-    /**
315
-     * @return array[]
316
-     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
317
-     */
318
-    private static function getInstalled()
319
-    {
320
-        if (null === self::$canGetVendors) {
321
-            self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
322
-        }
323
-
324
-        $installed = array();
325
-
326
-        if (self::$canGetVendors) {
327
-            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
328
-                if (isset(self::$installedByVendor[$vendorDir])) {
329
-                    $installed[] = self::$installedByVendor[$vendorDir];
330
-                } elseif (is_file($vendorDir.'/composer/installed.php')) {
331
-                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
332
-                    $required = require $vendorDir.'/composer/installed.php';
333
-                    $installed[] = self::$installedByVendor[$vendorDir] = $required;
334
-                    if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
335
-                        self::$installed = $installed[count($installed) - 1];
336
-                    }
337
-                }
338
-            }
339
-        }
340
-
341
-        if (null === self::$installed) {
342
-            // only require the installed.php file if this file is loaded from its dumped location,
343
-            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
344
-            if (substr(__DIR__, -8, 1) !== 'C') {
345
-                /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
346
-                $required = require __DIR__ . '/installed.php';
347
-                self::$installed = $required;
348
-            } else {
349
-                self::$installed = array();
350
-            }
351
-        }
352
-
353
-        if (self::$installed !== array()) {
354
-            $installed[] = self::$installed;
355
-        }
356
-
357
-        return $installed;
358
-    }
29
+	/**
30
+	 * @var mixed[]|null
31
+	 * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
32
+	 */
33
+	private static $installed;
34
+
35
+	/**
36
+	 * @var bool|null
37
+	 */
38
+	private static $canGetVendors;
39
+
40
+	/**
41
+	 * @var array[]
42
+	 * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
43
+	 */
44
+	private static $installedByVendor = array();
45
+
46
+	/**
47
+	 * Returns a list of all package names which are present, either by being installed, replaced or provided
48
+	 *
49
+	 * @return string[]
50
+	 * @psalm-return list<string>
51
+	 */
52
+	public static function getInstalledPackages()
53
+	{
54
+		$packages = array();
55
+		foreach (self::getInstalled() as $installed) {
56
+			$packages[] = array_keys($installed['versions']);
57
+		}
58
+
59
+		if (1 === \count($packages)) {
60
+			return $packages[0];
61
+		}
62
+
63
+		return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
64
+	}
65
+
66
+	/**
67
+	 * Returns a list of all package names with a specific type e.g. 'library'
68
+	 *
69
+	 * @param  string   $type
70
+	 * @return string[]
71
+	 * @psalm-return list<string>
72
+	 */
73
+	public static function getInstalledPackagesByType($type)
74
+	{
75
+		$packagesByType = array();
76
+
77
+		foreach (self::getInstalled() as $installed) {
78
+			foreach ($installed['versions'] as $name => $package) {
79
+				if (isset($package['type']) && $package['type'] === $type) {
80
+					$packagesByType[] = $name;
81
+				}
82
+			}
83
+		}
84
+
85
+		return $packagesByType;
86
+	}
87
+
88
+	/**
89
+	 * Checks whether the given package is installed
90
+	 *
91
+	 * This also returns true if the package name is provided or replaced by another package
92
+	 *
93
+	 * @param  string $packageName
94
+	 * @param  bool   $includeDevRequirements
95
+	 * @return bool
96
+	 */
97
+	public static function isInstalled($packageName, $includeDevRequirements = true)
98
+	{
99
+		foreach (self::getInstalled() as $installed) {
100
+			if (isset($installed['versions'][$packageName])) {
101
+				return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
102
+			}
103
+		}
104
+
105
+		return false;
106
+	}
107
+
108
+	/**
109
+	 * Checks whether the given package satisfies a version constraint
110
+	 *
111
+	 * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
112
+	 *
113
+	 *   Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
114
+	 *
115
+	 * @param  VersionParser $parser      Install composer/semver to have access to this class and functionality
116
+	 * @param  string        $packageName
117
+	 * @param  string|null   $constraint  A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
118
+	 * @return bool
119
+	 */
120
+	public static function satisfies(VersionParser $parser, $packageName, $constraint)
121
+	{
122
+		$constraint = $parser->parseConstraints((string) $constraint);
123
+		$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
124
+
125
+		return $provided->matches($constraint);
126
+	}
127
+
128
+	/**
129
+	 * Returns a version constraint representing all the range(s) which are installed for a given package
130
+	 *
131
+	 * It is easier to use this via isInstalled() with the $constraint argument if you need to check
132
+	 * whether a given version of a package is installed, and not just whether it exists
133
+	 *
134
+	 * @param  string $packageName
135
+	 * @return string Version constraint usable with composer/semver
136
+	 */
137
+	public static function getVersionRanges($packageName)
138
+	{
139
+		foreach (self::getInstalled() as $installed) {
140
+			if (!isset($installed['versions'][$packageName])) {
141
+				continue;
142
+			}
143
+
144
+			$ranges = array();
145
+			if (isset($installed['versions'][$packageName]['pretty_version'])) {
146
+				$ranges[] = $installed['versions'][$packageName]['pretty_version'];
147
+			}
148
+			if (array_key_exists('aliases', $installed['versions'][$packageName])) {
149
+				$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
150
+			}
151
+			if (array_key_exists('replaced', $installed['versions'][$packageName])) {
152
+				$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
153
+			}
154
+			if (array_key_exists('provided', $installed['versions'][$packageName])) {
155
+				$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
156
+			}
157
+
158
+			return implode(' || ', $ranges);
159
+		}
160
+
161
+		throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
162
+	}
163
+
164
+	/**
165
+	 * @param  string      $packageName
166
+	 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
167
+	 */
168
+	public static function getVersion($packageName)
169
+	{
170
+		foreach (self::getInstalled() as $installed) {
171
+			if (!isset($installed['versions'][$packageName])) {
172
+				continue;
173
+			}
174
+
175
+			if (!isset($installed['versions'][$packageName]['version'])) {
176
+				return null;
177
+			}
178
+
179
+			return $installed['versions'][$packageName]['version'];
180
+		}
181
+
182
+		throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
183
+	}
184
+
185
+	/**
186
+	 * @param  string      $packageName
187
+	 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
188
+	 */
189
+	public static function getPrettyVersion($packageName)
190
+	{
191
+		foreach (self::getInstalled() as $installed) {
192
+			if (!isset($installed['versions'][$packageName])) {
193
+				continue;
194
+			}
195
+
196
+			if (!isset($installed['versions'][$packageName]['pretty_version'])) {
197
+				return null;
198
+			}
199
+
200
+			return $installed['versions'][$packageName]['pretty_version'];
201
+		}
202
+
203
+		throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
204
+	}
205
+
206
+	/**
207
+	 * @param  string      $packageName
208
+	 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
209
+	 */
210
+	public static function getReference($packageName)
211
+	{
212
+		foreach (self::getInstalled() as $installed) {
213
+			if (!isset($installed['versions'][$packageName])) {
214
+				continue;
215
+			}
216
+
217
+			if (!isset($installed['versions'][$packageName]['reference'])) {
218
+				return null;
219
+			}
220
+
221
+			return $installed['versions'][$packageName]['reference'];
222
+		}
223
+
224
+		throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
225
+	}
226
+
227
+	/**
228
+	 * @param  string      $packageName
229
+	 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
230
+	 */
231
+	public static function getInstallPath($packageName)
232
+	{
233
+		foreach (self::getInstalled() as $installed) {
234
+			if (!isset($installed['versions'][$packageName])) {
235
+				continue;
236
+			}
237
+
238
+			return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
239
+		}
240
+
241
+		throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
242
+	}
243
+
244
+	/**
245
+	 * @return array
246
+	 * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
247
+	 */
248
+	public static function getRootPackage()
249
+	{
250
+		$installed = self::getInstalled();
251
+
252
+		return $installed[0]['root'];
253
+	}
254
+
255
+	/**
256
+	 * Returns the raw installed.php data for custom implementations
257
+	 *
258
+	 * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
259
+	 * @return array[]
260
+	 * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
261
+	 */
262
+	public static function getRawData()
263
+	{
264
+		@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
265
+
266
+		if (null === self::$installed) {
267
+			// only require the installed.php file if this file is loaded from its dumped location,
268
+			// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
269
+			if (substr(__DIR__, -8, 1) !== 'C') {
270
+				self::$installed = include __DIR__ . '/installed.php';
271
+			} else {
272
+				self::$installed = array();
273
+			}
274
+		}
275
+
276
+		return self::$installed;
277
+	}
278
+
279
+	/**
280
+	 * Returns the raw data of all installed.php which are currently loaded for custom implementations
281
+	 *
282
+	 * @return array[]
283
+	 * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
284
+	 */
285
+	public static function getAllRawData()
286
+	{
287
+		return self::getInstalled();
288
+	}
289
+
290
+	/**
291
+	 * Lets you reload the static array from another file
292
+	 *
293
+	 * This is only useful for complex integrations in which a project needs to use
294
+	 * this class but then also needs to execute another project's autoloader in process,
295
+	 * and wants to ensure both projects have access to their version of installed.php.
296
+	 *
297
+	 * A typical case would be PHPUnit, where it would need to make sure it reads all
298
+	 * the data it needs from this class, then call reload() with
299
+	 * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
300
+	 * the project in which it runs can then also use this class safely, without
301
+	 * interference between PHPUnit's dependencies and the project's dependencies.
302
+	 *
303
+	 * @param  array[] $data A vendor/composer/installed.php data set
304
+	 * @return void
305
+	 *
306
+	 * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
307
+	 */
308
+	public static function reload($data)
309
+	{
310
+		self::$installed = $data;
311
+		self::$installedByVendor = array();
312
+	}
313
+
314
+	/**
315
+	 * @return array[]
316
+	 * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
317
+	 */
318
+	private static function getInstalled()
319
+	{
320
+		if (null === self::$canGetVendors) {
321
+			self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
322
+		}
323
+
324
+		$installed = array();
325
+
326
+		if (self::$canGetVendors) {
327
+			foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
328
+				if (isset(self::$installedByVendor[$vendorDir])) {
329
+					$installed[] = self::$installedByVendor[$vendorDir];
330
+				} elseif (is_file($vendorDir.'/composer/installed.php')) {
331
+					/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
332
+					$required = require $vendorDir.'/composer/installed.php';
333
+					$installed[] = self::$installedByVendor[$vendorDir] = $required;
334
+					if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
335
+						self::$installed = $installed[count($installed) - 1];
336
+					}
337
+				}
338
+			}
339
+		}
340
+
341
+		if (null === self::$installed) {
342
+			// only require the installed.php file if this file is loaded from its dumped location,
343
+			// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
344
+			if (substr(__DIR__, -8, 1) !== 'C') {
345
+				/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
346
+				$required = require __DIR__ . '/installed.php';
347
+				self::$installed = $required;
348
+			} else {
349
+				self::$installed = array();
350
+			}
351
+		}
352
+
353
+		if (self::$installed !== array()) {
354
+			$installed[] = self::$installed;
355
+		}
356
+
357
+		return $installed;
358
+	}
359 359
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public static function satisfies(VersionParser $parser, $packageName, $constraint)
121 121
     {
122
-        $constraint = $parser->parseConstraints((string) $constraint);
122
+        $constraint = $parser->parseConstraints((string)$constraint);
123 123
         $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
124 124
 
125 125
         return $provided->matches($constraint);
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             return implode(' || ', $ranges);
159 159
         }
160 160
 
161
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
161
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
162 162
     }
163 163
 
164 164
     /**
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             return $installed['versions'][$packageName]['version'];
180 180
         }
181 181
 
182
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
182
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
183 183
     }
184 184
 
185 185
     /**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
             return $installed['versions'][$packageName]['pretty_version'];
201 201
         }
202 202
 
203
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
203
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
204 204
     }
205 205
 
206 206
     /**
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             return $installed['versions'][$packageName]['reference'];
222 222
         }
223 223
 
224
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
224
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
225 225
     }
226 226
 
227 227
     /**
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
             return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
239 239
         }
240 240
 
241
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
241
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
242 242
     }
243 243
 
244 244
     /**
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
             // only require the installed.php file if this file is loaded from its dumped location,
268 268
             // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
269 269
             if (substr(__DIR__, -8, 1) !== 'C') {
270
-                self::$installed = include __DIR__ . '/installed.php';
270
+                self::$installed = include __DIR__.'/installed.php';
271 271
             } else {
272 272
                 self::$installed = array();
273 273
             }
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
             // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
344 344
             if (substr(__DIR__, -8, 1) !== 'C') {
345 345
                 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
346
-                $required = require __DIR__ . '/installed.php';
346
+                $required = require __DIR__.'/installed.php';
347 347
                 self::$installed = $required;
348 348
             } else {
349 349
                 self::$installed = array();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@
 block discarded – undo
24 24
  *
25 25
  * @final
26 26
  */
27
-class InstalledVersions
28
-{
27
+class InstalledVersions {
29 28
     /**
30 29
      * @var mixed[]|null
31 30
      * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
Please login to merge, or discard this patch.
vendor-bin/php-scoper/vendor/composer/autoload_real.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -4,45 +4,45 @@
 block discarded – undo
4 4
 
5 5
 class ComposerAutoloaderInit3b0b43e9d0007ccfca51074c11dd0560
6 6
 {
7
-    private static $loader;
8
-
9
-    public static function loadClassLoader($class)
10
-    {
11
-        if ('Composer\Autoload\ClassLoader' === $class) {
12
-            require __DIR__ . '/ClassLoader.php';
13
-        }
14
-    }
15
-
16
-    /**
17
-     * @return \Composer\Autoload\ClassLoader
18
-     */
19
-    public static function getLoader()
20
-    {
21
-        if (null !== self::$loader) {
22
-            return self::$loader;
23
-        }
24
-
25
-        spl_autoload_register(array('ComposerAutoloaderInit3b0b43e9d0007ccfca51074c11dd0560', 'loadClassLoader'), true, true);
26
-        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
-        spl_autoload_unregister(array('ComposerAutoloaderInit3b0b43e9d0007ccfca51074c11dd0560', 'loadClassLoader'));
28
-
29
-        require __DIR__ . '/autoload_static.php';
30
-        call_user_func(\Composer\Autoload\ComposerStaticInit3b0b43e9d0007ccfca51074c11dd0560::getInitializer($loader));
31
-
32
-        $loader->register(true);
33
-
34
-        $filesToLoad = \Composer\Autoload\ComposerStaticInit3b0b43e9d0007ccfca51074c11dd0560::$files;
35
-        $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
36
-            if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
37
-                $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
38
-
39
-                require $file;
40
-            }
41
-        }, null, null);
42
-        foreach ($filesToLoad as $fileIdentifier => $file) {
43
-            $requireFile($fileIdentifier, $file);
44
-        }
45
-
46
-        return $loader;
47
-    }
7
+	private static $loader;
8
+
9
+	public static function loadClassLoader($class)
10
+	{
11
+		if ('Composer\Autoload\ClassLoader' === $class) {
12
+			require __DIR__ . '/ClassLoader.php';
13
+		}
14
+	}
15
+
16
+	/**
17
+	 * @return \Composer\Autoload\ClassLoader
18
+	 */
19
+	public static function getLoader()
20
+	{
21
+		if (null !== self::$loader) {
22
+			return self::$loader;
23
+		}
24
+
25
+		spl_autoload_register(array('ComposerAutoloaderInit3b0b43e9d0007ccfca51074c11dd0560', 'loadClassLoader'), true, true);
26
+		self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
+		spl_autoload_unregister(array('ComposerAutoloaderInit3b0b43e9d0007ccfca51074c11dd0560', 'loadClassLoader'));
28
+
29
+		require __DIR__ . '/autoload_static.php';
30
+		call_user_func(\Composer\Autoload\ComposerStaticInit3b0b43e9d0007ccfca51074c11dd0560::getInitializer($loader));
31
+
32
+		$loader->register(true);
33
+
34
+		$filesToLoad = \Composer\Autoload\ComposerStaticInit3b0b43e9d0007ccfca51074c11dd0560::$files;
35
+		$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
36
+			if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
37
+				$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
38
+
39
+				require $file;
40
+			}
41
+		}, null, null);
42
+		foreach ($filesToLoad as $fileIdentifier => $file) {
43
+			$requireFile($fileIdentifier, $file);
44
+		}
45
+
46
+		return $loader;
47
+	}
48 48
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     public static function loadClassLoader($class)
10 10
     {
11 11
         if ('Composer\Autoload\ClassLoader' === $class) {
12
-            require __DIR__ . '/ClassLoader.php';
12
+            require __DIR__.'/ClassLoader.php';
13 13
         }
14 14
     }
15 15
 
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
         self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27 27
         spl_autoload_unregister(array('ComposerAutoloaderInit3b0b43e9d0007ccfca51074c11dd0560', 'loadClassLoader'));
28 28
 
29
-        require __DIR__ . '/autoload_static.php';
29
+        require __DIR__.'/autoload_static.php';
30 30
         call_user_func(\Composer\Autoload\ComposerStaticInit3b0b43e9d0007ccfca51074c11dd0560::getInitializer($loader));
31 31
 
32 32
         $loader->register(true);
33 33
 
34 34
         $filesToLoad = \Composer\Autoload\ComposerStaticInit3b0b43e9d0007ccfca51074c11dd0560::$files;
35
-        $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
35
+        $requireFile = \Closure::bind(static function($fileIdentifier, $file) {
36 36
             if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
37 37
                 $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
38 38
 
Please login to merge, or discard this patch.
vendor-bin/php-scoper/vendor/autoload.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,21 +3,21 @@
 block discarded – undo
3 3
 // autoload.php @generated by Composer
4 4
 
5 5
 if (PHP_VERSION_ID < 50600) {
6
-    if (!headers_sent()) {
7
-        header('HTTP/1.1 500 Internal Server Error');
8
-    }
9
-    $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
10
-    if (!ini_get('display_errors')) {
11
-        if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
12
-            fwrite(STDERR, $err);
13
-        } elseif (!headers_sent()) {
14
-            echo $err;
15
-        }
16
-    }
17
-    trigger_error(
18
-        $err,
19
-        E_USER_ERROR
20
-    );
6
+	if (!headers_sent()) {
7
+		header('HTTP/1.1 500 Internal Server Error');
8
+	}
9
+	$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
10
+	if (!ini_get('display_errors')) {
11
+		if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
12
+			fwrite(STDERR, $err);
13
+		} elseif (!headers_sent()) {
14
+			echo $err;
15
+		}
16
+	}
17
+	trigger_error(
18
+		$err,
19
+		E_USER_ERROR
20
+	);
21 21
 }
22 22
 
23 23
 require_once __DIR__ . '/composer/autoload_real.php';
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,6 +20,6 @@
 block discarded – undo
20 20
     );
21 21
 }
22 22
 
23
-require_once __DIR__ . '/composer/autoload_real.php';
23
+require_once __DIR__.'/composer/autoload_real.php';
24 24
 
25 25
 return ComposerAutoloaderInit3b0b43e9d0007ccfca51074c11dd0560::getLoader();
Please login to merge, or discard this patch.