1<?php
2/**
3 * Elasticsearch PHP client
4 *
5 * @link      https://github.com/elastic/elasticsearch-php/
6 * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
7 * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
8 * @license   https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1
9 *
10 * Licensed to Elasticsearch B.V under one or more agreements.
11 * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or
12 * the GNU Lesser General Public License, Version 2.1, at your option.
13 * See the LICENSE file in the project root for more information.
14 */
15declare(strict_types = 1);
16
17namespace Elasticsearch\Namespaces;
18
19use Elasticsearch\Namespaces\AbstractNamespace;
20
21/**
22 * Class SearchableSnapshotsNamespace
23 *
24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php
25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee)
26 */
27class SearchableSnapshotsNamespace extends AbstractNamespace
28{
29
30    /**
31     * Retrieve node-level cache statistics about searchable snapshots.
32     *
33     * $params['node_id'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
34     *
35     * @param array $params Associative array of parameters
36     * @return array
37     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-apis.html
38     *
39     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
40     *
41     */
42    public function cacheStats(array $params = [])
43    {
44        $node_id = $this->extractArgument($params, 'node_id');
45
46        $endpointBuilder = $this->endpoints;
47        $endpoint = $endpointBuilder('SearchableSnapshots\CacheStats');
48        $endpoint->setParams($params);
49        $endpoint->setNodeId($node_id);
50
51        return $this->performRequest($endpoint);
52    }
53    /**
54     * Clear the cache of searchable snapshots.
55     *
56     * $params['index']              = (list) A comma-separated list of index names
57     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
58     * $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)
59     * $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)
60     *
61     * @param array $params Associative array of parameters
62     * @return array
63     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-apis.html
64     *
65     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
66     *
67     */
68    public function clearCache(array $params = [])
69    {
70        $index = $this->extractArgument($params, 'index');
71
72        $endpointBuilder = $this->endpoints;
73        $endpoint = $endpointBuilder('SearchableSnapshots\ClearCache');
74        $endpoint->setParams($params);
75        $endpoint->setIndex($index);
76
77        return $this->performRequest($endpoint);
78    }
79    /**
80     * Mount a snapshot as a searchable index.
81     *
82     * $params['repository']          = (string) The name of the repository containing the snapshot of the index to mount
83     * $params['snapshot']            = (string) The name of the snapshot of the index to mount
84     * $params['master_timeout']      = (time) Explicit operation timeout for connection to master node
85     * $params['wait_for_completion'] = (boolean) Should this request wait until the operation has completed before returning (Default = false)
86     * $params['storage']             = (string) Selects the kind of local storage used to accelerate searches. Experimental, and defaults to `full_copy` (Default = )
87     * $params['body']                = (array) The restore configuration for mounting the snapshot as searchable (Required)
88     *
89     * @param array $params Associative array of parameters
90     * @return array
91     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-api-mount-snapshot.html
92     *
93     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
94     *
95     */
96    public function mount(array $params = [])
97    {
98        $repository = $this->extractArgument($params, 'repository');
99        $snapshot = $this->extractArgument($params, 'snapshot');
100        $body = $this->extractArgument($params, 'body');
101
102        $endpointBuilder = $this->endpoints;
103        $endpoint = $endpointBuilder('SearchableSnapshots\Mount');
104        $endpoint->setParams($params);
105        $endpoint->setRepository($repository);
106        $endpoint->setSnapshot($snapshot);
107        $endpoint->setBody($body);
108
109        return $this->performRequest($endpoint);
110    }
111    /**
112     * DEPRECATED: This API is replaced by the Repositories Metering API.
113     *
114     * $params['repository'] = (string) The repository for which to get the stats for
115     *
116     * @param array $params Associative array of parameters
117     * @return array
118     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-apis.html
119     *
120     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
121     *
122     */
123    public function repositoryStats(array $params = [])
124    {
125        $repository = $this->extractArgument($params, 'repository');
126
127        $endpointBuilder = $this->endpoints;
128        $endpoint = $endpointBuilder('SearchableSnapshots\RepositoryStats');
129        $endpoint->setParams($params);
130        $endpoint->setRepository($repository);
131
132        return $this->performRequest($endpoint);
133    }
134    /**
135     * Retrieve shard-level statistics about searchable snapshots.
136     *
137     * $params['index'] = (list) A comma-separated list of index names
138     * $params['level'] = (enum) Return stats aggregated at cluster, index or shard level (Options = cluster,indices,shards) (Default = indices)
139     *
140     * @param array $params Associative array of parameters
141     * @return array
142     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-apis.html
143     *
144     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
145     *
146     */
147    public function stats(array $params = [])
148    {
149        $index = $this->extractArgument($params, 'index');
150
151        $endpointBuilder = $this->endpoints;
152        $endpoint = $endpointBuilder('SearchableSnapshots\Stats');
153        $endpoint->setParams($params);
154        $endpoint->setIndex($index);
155
156        return $this->performRequest($endpoint);
157    }
158}
159