1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | /** |
6: | * Copyright OpenSearch Contributors |
7: | * SPDX-License-Identifier: Apache-2.0 |
8: | * |
9: | * OpenSearch PHP client |
10: | * |
11: | * @link https://github.com/opensearch-project/opensearch-php/ |
12: | * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co) |
13: | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 |
14: | * @license https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1 |
15: | * |
16: | * Licensed to Elasticsearch B.V under one or more agreements. |
17: | * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or |
18: | * the GNU Lesser General Public License, Version 2.1, at your option. |
19: | * See the LICENSE file in the project root for more information. |
20: | */ |
21: | |
22: | namespace OpenSearch\Namespaces; |
23: | |
24: | use OpenSearch\Endpoints\Cluster\AllocationExplain; |
25: | use OpenSearch\Endpoints\Cluster\DeleteComponentTemplate; |
26: | use OpenSearch\Endpoints\Cluster\DeleteDecommissionAwareness; |
27: | use OpenSearch\Endpoints\Cluster\DeleteVotingConfigExclusions; |
28: | use OpenSearch\Endpoints\Cluster\DeleteWeightedRouting; |
29: | use OpenSearch\Endpoints\Cluster\ExistsComponentTemplate; |
30: | use OpenSearch\Endpoints\Cluster\GetComponentTemplate; |
31: | use OpenSearch\Endpoints\Cluster\GetDecommissionAwareness; |
32: | use OpenSearch\Endpoints\Cluster\GetSettings; |
33: | use OpenSearch\Endpoints\Cluster\GetWeightedRouting; |
34: | use OpenSearch\Endpoints\Cluster\Health; |
35: | use OpenSearch\Endpoints\Cluster\PendingTasks; |
36: | use OpenSearch\Endpoints\Cluster\PostVotingConfigExclusions; |
37: | use OpenSearch\Endpoints\Cluster\PutComponentTemplate; |
38: | use OpenSearch\Endpoints\Cluster\PutDecommissionAwareness; |
39: | use OpenSearch\Endpoints\Cluster\PutSettings; |
40: | use OpenSearch\Endpoints\Cluster\PutWeightedRouting; |
41: | use OpenSearch\Endpoints\Cluster\RemoteInfo; |
42: | use OpenSearch\Endpoints\Cluster\Reroute; |
43: | use OpenSearch\Endpoints\Cluster\State; |
44: | use OpenSearch\Endpoints\Cluster\Stats; |
45: | |
46: | /** |
47: | * Class ClusterNamespace |
48: | * |
49: | * NOTE: This file is autogenerated using util/GenerateEndpoints.php |
50: | */ |
51: | class ClusterNamespace extends AbstractNamespace |
52: | { |
53: | /** |
54: | * Explains how shards are allocated in the current cluster and provides an explanation for why unassigned shards can't be allocated to a node. |
55: | * |
56: | * $params['include_disk_info'] = (boolean) When `true`, returns information about disk usage and shard sizes. (Default = false) |
57: | * $params['include_yes_decisions'] = (boolean) When `true`, returns any `YES` decisions in the allocation explanation. `YES` decisions indicate when a particular shard allocation attempt was successful for the given node. (Default = false) |
58: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
59: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
60: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
61: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
62: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
63: | * $params['body'] = (array) The index, shard, and primary flag for which to generate an explanation. Leave this empty to generate an explanation for the first unassigned shard. |
64: | * |
65: | * @param array $params Associative array of parameters |
66: | * @return array |
67: | */ |
68: | public function allocationExplain(array $params = []) |
69: | { |
70: | $body = $this->extractArgument($params, 'body'); |
71: | |
72: | $endpoint = $this->endpointFactory->getEndpoint(AllocationExplain::class); |
73: | $endpoint->setParams($params); |
74: | $endpoint->setBody($body); |
75: | |
76: | return $this->performRequest($endpoint); |
77: | } |
78: | |
79: | /** |
80: | * Deletes a component template. |
81: | * |
82: | * $params['name'] = (string) The name of the component template to delete. Supports wildcard (*) expressions. |
83: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
84: | * $params['master_timeout'] = (string) |
85: | * $params['timeout'] = (string) |
86: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
87: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
88: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
89: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
90: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
91: | * |
92: | * @param array $params Associative array of parameters |
93: | * @return array |
94: | */ |
95: | public function deleteComponentTemplate(array $params = []) |
96: | { |
97: | $name = $this->extractArgument($params, 'name'); |
98: | |
99: | $endpoint = $this->endpointFactory->getEndpoint(DeleteComponentTemplate::class); |
100: | $endpoint->setParams($params); |
101: | $endpoint->setName($name); |
102: | |
103: | return $this->performRequest($endpoint); |
104: | } |
105: | |
106: | /** |
107: | * Recommissions a decommissioned zone. |
108: | * |
109: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
110: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
111: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
112: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
113: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
114: | * |
115: | * @param array $params Associative array of parameters |
116: | * @return array |
117: | */ |
118: | public function deleteDecommissionAwareness(array $params = []) |
119: | { |
120: | $endpoint = $this->endpointFactory->getEndpoint(DeleteDecommissionAwareness::class); |
121: | $endpoint->setParams($params); |
122: | |
123: | return $this->performRequest($endpoint); |
124: | } |
125: | |
126: | /** |
127: | * Clears any cluster voting configuration exclusions. |
128: | * |
129: | * $params['wait_for_removal'] = (boolean) Specifies whether to wait for all excluded nodes to be removed from thecluster before clearing the voting configuration exclusions list.When `true`, all excluded nodes are removed fromthe cluster before this API takes any action. When `false`, thevoting configuration exclusions list is cleared even if some excludednodes are still in the cluster. (Default = true) |
130: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
131: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
132: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
133: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
134: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
135: | * |
136: | * @param array $params Associative array of parameters |
137: | * @return array |
138: | */ |
139: | public function deleteVotingConfigExclusions(array $params = []) |
140: | { |
141: | $endpoint = $this->endpointFactory->getEndpoint(DeleteVotingConfigExclusions::class); |
142: | $endpoint->setParams($params); |
143: | |
144: | return $this->performRequest($endpoint); |
145: | } |
146: | |
147: | /** |
148: | * Delete weighted shard routing weights. |
149: | * |
150: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
151: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
152: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
153: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
154: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
155: | * |
156: | * @param array $params Associative array of parameters |
157: | * @return array |
158: | */ |
159: | public function deleteWeightedRouting(array $params = []) |
160: | { |
161: | $body = $this->extractArgument($params, 'body'); |
162: | |
163: | $endpoint = $this->endpointFactory->getEndpoint(DeleteWeightedRouting::class); |
164: | $endpoint->setParams($params); |
165: | $endpoint->setBody($body); |
166: | |
167: | return $this->performRequest($endpoint); |
168: | } |
169: | |
170: | /** |
171: | * Returns information about whether a particular component template exist. |
172: | * |
173: | * $params['name'] = (string) The name of the component template. Wildcard (*) expressions are supported. |
174: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
175: | * $params['local'] = (boolean) When `true`, the request retrieves information from the local node only.When `false, information is retrieved from the cluster manager node. (Default = false) |
176: | * $params['master_timeout'] = (string) |
177: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
178: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
179: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
180: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
181: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
182: | * |
183: | * @param array $params Associative array of parameters |
184: | * @return bool |
185: | */ |
186: | public function existsComponentTemplate(array $params = []): bool |
187: | { |
188: | $name = $this->extractArgument($params, 'name'); |
189: | |
190: | // Legacy option to manually make this verbose so we can check status code. |
191: | // @todo remove in 3.0.0 |
192: | $params['client']['verbose'] = true; |
193: | |
194: | $endpoint = $this->endpointFactory->getEndpoint(ExistsComponentTemplate::class); |
195: | $endpoint->setParams($params); |
196: | $endpoint->setName($name); |
197: | |
198: | return BooleanRequestWrapper::sendRequest($endpoint, $this->httpTransport); |
199: | } |
200: | |
201: | /** |
202: | * Returns one or more component templates. |
203: | * |
204: | * $params['name'] = (array) The name of the component template to retrieve. Wildcard (`*`) expressions are supported. |
205: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
206: | * $params['flat_settings'] = (boolean) Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings.For example, the flat form of `"cluster": { "max_shards_per_node": 500 }` is `"cluster.max_shards_per_node": "500"`. (Default = false) |
207: | * $params['local'] = (boolean) When `true`, the request retrieves information from the local node only.When `false`, information is retrieved from the cluster manager node. (Default = false) |
208: | * $params['master_timeout'] = (string) |
209: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
210: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
211: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
212: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
213: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
214: | * |
215: | * @param array $params Associative array of parameters |
216: | * @return array |
217: | */ |
218: | public function getComponentTemplate(array $params = []) |
219: | { |
220: | $name = $this->extractArgument($params, 'name'); |
221: | |
222: | $endpoint = $this->endpointFactory->getEndpoint(GetComponentTemplate::class); |
223: | $endpoint->setParams($params); |
224: | $endpoint->setName($name); |
225: | |
226: | return $this->performRequest($endpoint); |
227: | } |
228: | |
229: | /** |
230: | * Retrieves the decommission status for all zones. |
231: | * |
232: | * $params['awareness_attribute_name'] = (string) The name of the awareness attribute. |
233: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
234: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
235: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
236: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
237: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
238: | * |
239: | * @param array $params Associative array of parameters |
240: | * @return array |
241: | */ |
242: | public function getDecommissionAwareness(array $params = []) |
243: | { |
244: | $awareness_attribute_name = $this->extractArgument($params, 'awareness_attribute_name'); |
245: | |
246: | $endpoint = $this->endpointFactory->getEndpoint(GetDecommissionAwareness::class); |
247: | $endpoint->setParams($params); |
248: | $endpoint->setAwarenessAttributeName($awareness_attribute_name); |
249: | |
250: | return $this->performRequest($endpoint); |
251: | } |
252: | |
253: | /** |
254: | * Returns cluster settings. |
255: | * |
256: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
257: | * $params['flat_settings'] = (boolean) Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings.For example, the flat form of `"cluster": { "max_shards_per_node": 500 }` is `"cluster.max_shards_per_node": "500"`. (Default = false) |
258: | * $params['include_defaults'] = (boolean) When `true`, returns default cluster settings from the local node. (Default = false) |
259: | * $params['master_timeout'] = (string) |
260: | * $params['timeout'] = (string) |
261: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
262: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
263: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
264: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
265: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
266: | * |
267: | * @param array $params Associative array of parameters |
268: | * @return array |
269: | */ |
270: | public function getSettings(array $params = []) |
271: | { |
272: | $endpoint = $this->endpointFactory->getEndpoint(GetSettings::class); |
273: | $endpoint->setParams($params); |
274: | |
275: | return $this->performRequest($endpoint); |
276: | } |
277: | |
278: | /** |
279: | * Fetches weighted shard routing weights. |
280: | * |
281: | * $params['attribute'] = (string) The name of the awareness attribute. |
282: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
283: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
284: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
285: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
286: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
287: | * |
288: | * @param array $params Associative array of parameters |
289: | * @return array |
290: | */ |
291: | public function getWeightedRouting(array $params = []) |
292: | { |
293: | $attribute = $this->extractArgument($params, 'attribute'); |
294: | |
295: | $endpoint = $this->endpointFactory->getEndpoint(GetWeightedRouting::class); |
296: | $endpoint->setParams($params); |
297: | $endpoint->setAttribute($attribute); |
298: | |
299: | return $this->performRequest($endpoint); |
300: | } |
301: | |
302: | /** |
303: | * Returns basic information about the health of the cluster. |
304: | * |
305: | * $params['index'] = (array) |
306: | * $params['awareness_attribute'] = (string) The name of the awareness attribute for which to return the cluster health status (for example, `zone`). Applicable only if `level` is set to `awareness_attributes`. |
307: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
308: | * $params['expand_wildcards'] = (any) |
309: | * $params['level'] = (enum) (Options = awareness_attributes,cluster,indices,shards) |
310: | * $params['local'] = (boolean) Whether to return information from the local node only instead of from the cluster manager node. (Default = false) |
311: | * $params['master_timeout'] = (string) |
312: | * $params['timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
313: | * $params['wait_for_active_shards'] = (any) |
314: | * $params['wait_for_events'] = (any) |
315: | * $params['wait_for_no_initializing_shards'] = (boolean) Whether to wait until there are no initializing shards in the cluster. (Default = false) |
316: | * $params['wait_for_no_relocating_shards'] = (boolean) Whether to wait until there are no relocating shards in the cluster. (Default = false) |
317: | * $params['wait_for_nodes'] = (any) Waits until the specified number of nodes (`N`) is available. Accepts `>=N`, `<=N`, `>N`, and `<N`. You can also use `ge(N)`, `le(N)`, `gt(N)`, and `lt(N)` notation. |
318: | * $params['wait_for_status'] = (any) Waits until the cluster health reaches the specified status or better. |
319: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
320: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
321: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
322: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
323: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
324: | * |
325: | * @param array $params Associative array of parameters |
326: | * @return array |
327: | */ |
328: | public function health(array $params = []) |
329: | { |
330: | $index = $this->extractArgument($params, 'index'); |
331: | |
332: | $endpoint = $this->endpointFactory->getEndpoint(Health::class); |
333: | $endpoint->setParams($params); |
334: | $endpoint->setIndex($index); |
335: | |
336: | return $this->performRequest($endpoint); |
337: | } |
338: | |
339: | /** |
340: | * Returns a list of pending cluster-level tasks, such as index creation, mapping updates,or new allocations. |
341: | * |
342: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
343: | * $params['local'] = (boolean) When `true`, the request retrieves information from the local node only.When `false`, information is retrieved from the cluster manager node. (Default = false) |
344: | * $params['master_timeout'] = (string) |
345: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
346: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
347: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
348: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
349: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
350: | * |
351: | * @param array $params Associative array of parameters |
352: | * @return array |
353: | */ |
354: | public function pendingTasks(array $params = []) |
355: | { |
356: | $endpoint = $this->endpointFactory->getEndpoint(PendingTasks::class); |
357: | $endpoint->setParams($params); |
358: | |
359: | return $this->performRequest($endpoint); |
360: | } |
361: | |
362: | /** |
363: | * Updates the cluster voting configuration by excluding certain node IDs or names. |
364: | * |
365: | * $params['node_ids'] = (any) A comma-separated list of node IDs to excludefrom the voting configuration. When using this setting, you cannot also specify `node_names`. Either `node_ids` or `node_names` are required to receive a valid response. |
366: | * $params['node_names'] = (any) A comma-separated list of node names to exclude from thevoting configuration. When using this setting, you cannot also specify `node_ids`. Either `node_ids` or `node_names` are required to receive a valid response. |
367: | * $params['timeout'] = (string) When adding a voting configuration exclusion, the API waits for thespecified nodes to be excluded from the voting configuration beforereturning a response. If the timeout expires before the appropriate conditionis satisfied, the request fails and returns an error. |
368: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
369: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
370: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
371: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
372: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
373: | * |
374: | * @param array $params Associative array of parameters |
375: | * @return array |
376: | */ |
377: | public function postVotingConfigExclusions(array $params = []) |
378: | { |
379: | $endpoint = $this->endpointFactory->getEndpoint(PostVotingConfigExclusions::class); |
380: | $endpoint->setParams($params); |
381: | |
382: | return $this->performRequest($endpoint); |
383: | } |
384: | |
385: | /** |
386: | * Creates or updates a component template. |
387: | * |
388: | * $params['name'] = (string) The name of the component template to create. OpenSearch includes the following built-in component templates: `logs-mappings`, `logs-settings`, `metrics-mappings`, `metrics-settings`, `synthetics-mapping`, and `synthetics-settings`. OpenSearch uses these templates to configure backing indexes for its data streams. If you want to overwrite one of these templates, set the replacement template `version` to a higher value than the current version. If you want to disable all built-in component and index templates, set `stack.templates.enabled` to `false` using the [Cluster Update Settings API](https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-settings/). |
389: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
390: | * $params['create'] = (boolean) When `true`, this request cannot replace or update existing component templates. (Default = false) |
391: | * $params['master_timeout'] = (string) |
392: | * $params['timeout'] = (string) |
393: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
394: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
395: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
396: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
397: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
398: | * $params['body'] = (array) The template definition. (Required) |
399: | * |
400: | * @param array $params Associative array of parameters |
401: | * @return array |
402: | */ |
403: | public function putComponentTemplate(array $params = []) |
404: | { |
405: | $name = $this->extractArgument($params, 'name'); |
406: | $body = $this->extractArgument($params, 'body'); |
407: | |
408: | $endpoint = $this->endpointFactory->getEndpoint(PutComponentTemplate::class); |
409: | $endpoint->setParams($params); |
410: | $endpoint->setName($name); |
411: | $endpoint->setBody($body); |
412: | |
413: | return $this->performRequest($endpoint); |
414: | } |
415: | |
416: | /** |
417: | * Decommissions a cluster zone based on awareness. This can greatly benefit multi-zone deployments, where awareness attributes can aid in applying new upgrades to a cluster in a controlled fashion. |
418: | * |
419: | * $params['awareness_attribute_name'] = (string) The name of the awareness attribute. |
420: | * $params['awareness_attribute_value'] = (string) The value of the awareness attribute. For example, if you have shards allocated in two different zones, you can give each zone a value of `zone-a` or `zoneb`. The cluster decommission operation decommissions the zone listed in the method. |
421: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
422: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
423: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
424: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
425: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
426: | * |
427: | * @param array $params Associative array of parameters |
428: | * @return array |
429: | */ |
430: | public function putDecommissionAwareness(array $params = []) |
431: | { |
432: | $awareness_attribute_name = $this->extractArgument($params, 'awareness_attribute_name'); |
433: | $awareness_attribute_value = $this->extractArgument($params, 'awareness_attribute_value'); |
434: | |
435: | $endpoint = $this->endpointFactory->getEndpoint(PutDecommissionAwareness::class); |
436: | $endpoint->setParams($params); |
437: | $endpoint->setAwarenessAttributeName($awareness_attribute_name); |
438: | $endpoint->setAwarenessAttributeValue($awareness_attribute_value); |
439: | |
440: | return $this->performRequest($endpoint); |
441: | } |
442: | |
443: | /** |
444: | * Updates the cluster settings. |
445: | * |
446: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
447: | * $params['flat_settings'] = (boolean) Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings.For example, the flat form of `"cluster": { "max_shards_per_node": 500 }` is `"cluster.max_shards_per_node": "500"`. (Default = false) |
448: | * $params['master_timeout'] = (string) |
449: | * $params['timeout'] = (string) |
450: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
451: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
452: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
453: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
454: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
455: | * $params['body'] = (array) The cluster settings to update. (Required) |
456: | * |
457: | * @param array $params Associative array of parameters |
458: | * @return array |
459: | */ |
460: | public function putSettings(array $params = []) |
461: | { |
462: | $body = $this->extractArgument($params, 'body'); |
463: | |
464: | $endpoint = $this->endpointFactory->getEndpoint(PutSettings::class); |
465: | $endpoint->setParams($params); |
466: | $endpoint->setBody($body); |
467: | |
468: | return $this->performRequest($endpoint); |
469: | } |
470: | |
471: | /** |
472: | * Updates weighted shard routing weights. |
473: | * |
474: | * $params['attribute'] = (string) The name of awareness attribute, usually `zone`. |
475: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
476: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
477: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
478: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
479: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
480: | * |
481: | * @param array $params Associative array of parameters |
482: | * @return array |
483: | */ |
484: | public function putWeightedRouting(array $params = []) |
485: | { |
486: | $attribute = $this->extractArgument($params, 'attribute'); |
487: | $body = $this->extractArgument($params, 'body'); |
488: | |
489: | $endpoint = $this->endpointFactory->getEndpoint(PutWeightedRouting::class); |
490: | $endpoint->setParams($params); |
491: | $endpoint->setAttribute($attribute); |
492: | $endpoint->setBody($body); |
493: | |
494: | return $this->performRequest($endpoint); |
495: | } |
496: | |
497: | /** |
498: | * Returns the information about configured remote clusters. |
499: | * |
500: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
501: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
502: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
503: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
504: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
505: | * |
506: | * @param array $params Associative array of parameters |
507: | * @return array |
508: | */ |
509: | public function remoteInfo(array $params = []) |
510: | { |
511: | $endpoint = $this->endpointFactory->getEndpoint(RemoteInfo::class); |
512: | $endpoint->setParams($params); |
513: | |
514: | return $this->performRequest($endpoint); |
515: | } |
516: | |
517: | /** |
518: | * Allows to manually change the allocation of individual shards in the cluster. |
519: | * |
520: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
521: | * $params['dry_run'] = (boolean) When `true`, the request simulates the operation and returns the resulting state. |
522: | * $params['explain'] = (boolean) When `true`, the response contains an explanation of why reroute certain commands can or cannot be executed. |
523: | * $params['master_timeout'] = (string) |
524: | * $params['metric'] = (any) Limits the information returned to the specified metrics. |
525: | * $params['retry_failed'] = (boolean) When `true`, retries shard allocation if it was blocked because of too many subsequent failures. |
526: | * $params['timeout'] = (string) |
527: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
528: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
529: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
530: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
531: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
532: | * $params['body'] = (array) The definition of `commands` to perform (`move`, `cancel`, `allocate`) |
533: | * |
534: | * @param array $params Associative array of parameters |
535: | * @return array |
536: | */ |
537: | public function reroute(array $params = []) |
538: | { |
539: | $body = $this->extractArgument($params, 'body'); |
540: | |
541: | $endpoint = $this->endpointFactory->getEndpoint(Reroute::class); |
542: | $endpoint->setParams($params); |
543: | $endpoint->setBody($body); |
544: | |
545: | return $this->performRequest($endpoint); |
546: | } |
547: | |
548: | /** |
549: | * Returns comprehensive information about the state of the cluster. |
550: | * |
551: | * $params['metric'] = (array) Limits the information returned to only the [specified metric groups](https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-stats/#metric-groups). |
552: | * $params['index'] = (array) |
553: | * $params['allow_no_indices'] = (boolean) Whether to ignore a wildcard index expression that resolves into no concrete indexes. This includes the `_all` string or when no indexes have been specified. |
554: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
555: | * $params['expand_wildcards'] = (any) |
556: | * $params['flat_settings'] = (boolean) Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings.For example, the flat form of `"cluster": { "max_shards_per_node": 500 }` is `"cluster.max_shards_per_node": "500"`. (Default = false) |
557: | * $params['ignore_unavailable'] = (boolean) Whether the specified concrete indexes should be ignored when unavailable (missing or closed). |
558: | * $params['local'] = (boolean) Whether to return information from the local node only instead of from the cluster manager node. (Default = false) |
559: | * $params['master_timeout'] = (string) |
560: | * $params['wait_for_metadata_version'] = (integer) Wait for the metadata version to be equal or greater than the specified metadata version. |
561: | * $params['wait_for_timeout'] = (string) The maximum time to wait for `wait_for_metadata_version` before timing out. |
562: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
563: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
564: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
565: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
566: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
567: | * |
568: | * @param array $params Associative array of parameters |
569: | * @return array |
570: | */ |
571: | public function state(array $params = []) |
572: | { |
573: | $metric = $this->extractArgument($params, 'metric'); |
574: | $index = $this->extractArgument($params, 'index'); |
575: | |
576: | $endpoint = $this->endpointFactory->getEndpoint(State::class); |
577: | $endpoint->setParams($params); |
578: | $endpoint->setMetric($metric); |
579: | $endpoint->setIndex($index); |
580: | |
581: | return $this->performRequest($endpoint); |
582: | } |
583: | |
584: | /** |
585: | * Returns a high-level overview of cluster statistics. |
586: | * |
587: | * $params['index_metric'] = (array) A comma-separated list of [index metric groups](https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-stats/#index-metric-groups), for example, `docs,store`. |
588: | * $params['metric'] = (array) Limit the information returned to the specified metrics. |
589: | * $params['node_id'] = (array) |
590: | * $params['flat_settings'] = (boolean) Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings.For example, the flat form of `"cluster": { "max_shards_per_node": 500 }` is `"cluster.max_shards_per_node": "500"`. (Default = false) |
591: | * $params['timeout'] = (string) The amount of time to wait for each node to respond.If a node does not respond before its timeout expires, the response does not include its stats.However, timed out nodes are included in the response's `_nodes.failed` property. Defaults to no timeout. |
592: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
593: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
594: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
595: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
596: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
597: | * |
598: | * @param array $params Associative array of parameters |
599: | * @return array |
600: | */ |
601: | public function stats(array $params = []) |
602: | { |
603: | $index_metric = $this->extractArgument($params, 'index_metric'); |
604: | $metric = $this->extractArgument($params, 'metric'); |
605: | $node_id = $this->extractArgument($params, 'node_id'); |
606: | |
607: | $endpoint = $this->endpointFactory->getEndpoint(Stats::class); |
608: | $endpoint->setParams($params); |
609: | $endpoint->setIndexMetric($index_metric); |
610: | $endpoint->setMetric($metric); |
611: | $endpoint->setNodeId($node_id); |
612: | |
613: | return $this->performRequest($endpoint); |
614: | } |
615: | |
616: | } |
617: |