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