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\Namespaces\AbstractNamespace;
25:
26: /**
27: * Class SearchableSnapshotsNamespace
28: *
29: */
30: class SearchableSnapshotsNamespace extends AbstractNamespace
31: {
32: /**
33: * $params['index'] = (list) A comma-separated list of index names
34: * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
35: * $params['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)
36: * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open)
37: *
38: * @param array $params Associative array of parameters
39: * @return array
40:
41: *
42: * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
43: *
44: */
45: public function clearCache(array $params = [])
46: {
47: $index = $this->extractArgument($params, 'index');
48:
49: $endpointBuilder = $this->endpoints;
50: $endpoint = $endpointBuilder('SearchableSnapshots\ClearCache');
51: $endpoint->setParams($params);
52: $endpoint->setIndex($index);
53:
54: return $this->performRequest($endpoint);
55: }
56: /**
57: * $params['repository'] = (string) The name of the repository containing the snapshot of the index to mount
58: * $params['snapshot'] = (string) The name of the snapshot of the index to mount
59: * $params['cluster_manager_timeout'] = (time) Explicit operation timeout for connection to cluster_manager node
60: * $params['wait_for_completion'] = (boolean) Should this request wait until the operation has completed before returning (Default = false)
61: * $params['body'] = (array) The restore configuration for mounting the snapshot as searchable (Required)
62: *
63: * @param array $params Associative array of parameters
64: * @return array
65:
66: *
67: * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
68: *
69: */
70: public function mount(array $params = [])
71: {
72: $repository = $this->extractArgument($params, 'repository');
73: $snapshot = $this->extractArgument($params, 'snapshot');
74: $body = $this->extractArgument($params, 'body');
75:
76: $endpointBuilder = $this->endpoints;
77: $endpoint = $endpointBuilder('SearchableSnapshots\Mount');
78: $endpoint->setParams($params);
79: $endpoint->setRepository($repository);
80: $endpoint->setSnapshot($snapshot);
81: $endpoint->setBody($body);
82:
83: return $this->performRequest($endpoint);
84: }
85: /**
86: * $params['repository'] = (string) The repository for which to get the stats for
87: *
88: * @param array $params Associative array of parameters
89: * @return array
90:
91: *
92: * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
93: *
94: */
95: public function repositoryStats(array $params = [])
96: {
97: $repository = $this->extractArgument($params, 'repository');
98:
99: $endpointBuilder = $this->endpoints;
100: $endpoint = $endpointBuilder('SearchableSnapshots\RepositoryStats');
101: $endpoint->setParams($params);
102: $endpoint->setRepository($repository);
103:
104: return $this->performRequest($endpoint);
105: }
106: /**
107: * $params['index'] = (list) A comma-separated list of index names
108: *
109: * @param array $params Associative array of parameters
110: * @return array
111:
112: *
113: * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
114: *
115: */
116: public function stats(array $params = [])
117: {
118: $index = $this->extractArgument($params, 'index');
119:
120: $endpointBuilder = $this->endpoints;
121: $endpoint = $endpointBuilder('SearchableSnapshots\Stats');
122: $endpoint->setParams($params);
123: $endpoint->setIndex($index);
124:
125: return $this->performRequest($endpoint);
126: }
127: }
128: