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 RollupNamespace
23 *
24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php
25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee)
26 */
27class RollupNamespace extends AbstractNamespace
28{
29
30    /**
31     * Deletes an existing rollup job.
32     *
33     * $params['id'] = (string) The ID of the job to delete
34     *
35     * @param array $params Associative array of parameters
36     * @return array
37     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-delete-job.html
38     *
39     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
40     *
41     */
42    public function deleteJob(array $params = [])
43    {
44        $id = $this->extractArgument($params, 'id');
45
46        $endpointBuilder = $this->endpoints;
47        $endpoint = $endpointBuilder('Rollup\DeleteJob');
48        $endpoint->setParams($params);
49        $endpoint->setId($id);
50
51        return $this->performRequest($endpoint);
52    }
53    /**
54     * Retrieves the configuration, stats, and status of rollup jobs.
55     *
56     * $params['id'] = (string) The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs
57     *
58     * @param array $params Associative array of parameters
59     * @return array
60     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-job.html
61     *
62     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
63     *
64     */
65    public function getJobs(array $params = [])
66    {
67        $id = $this->extractArgument($params, 'id');
68
69        $endpointBuilder = $this->endpoints;
70        $endpoint = $endpointBuilder('Rollup\GetJobs');
71        $endpoint->setParams($params);
72        $endpoint->setId($id);
73
74        return $this->performRequest($endpoint);
75    }
76    /**
77     * Returns the capabilities of any rollup jobs that have been configured for a specific index or index pattern.
78     *
79     * $params['id'] = (string) The ID of the index to check rollup capabilities on, or left blank for all jobs
80     *
81     * @param array $params Associative array of parameters
82     * @return array
83     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-rollup-caps.html
84     *
85     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
86     *
87     */
88    public function getRollupCaps(array $params = [])
89    {
90        $id = $this->extractArgument($params, 'id');
91
92        $endpointBuilder = $this->endpoints;
93        $endpoint = $endpointBuilder('Rollup\GetRollupCaps');
94        $endpoint->setParams($params);
95        $endpoint->setId($id);
96
97        return $this->performRequest($endpoint);
98    }
99    /**
100     * Returns the rollup capabilities of all jobs inside of a rollup index (e.g. the index where rollup data is stored).
101     *
102     * $params['index'] = (string) The rollup index or index pattern to obtain rollup capabilities from.
103     *
104     * @param array $params Associative array of parameters
105     * @return array
106     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-rollup-index-caps.html
107     *
108     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
109     *
110     */
111    public function getRollupIndexCaps(array $params = [])
112    {
113        $index = $this->extractArgument($params, 'index');
114
115        $endpointBuilder = $this->endpoints;
116        $endpoint = $endpointBuilder('Rollup\GetRollupIndexCaps');
117        $endpoint->setParams($params);
118        $endpoint->setIndex($index);
119
120        return $this->performRequest($endpoint);
121    }
122    /**
123     * Creates a rollup job.
124     *
125     * $params['id']   = (string) The ID of the job to create
126     * $params['body'] = (array) The job configuration (Required)
127     *
128     * @param array $params Associative array of parameters
129     * @return array
130     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-put-job.html
131     *
132     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
133     *
134     */
135    public function putJob(array $params = [])
136    {
137        $id = $this->extractArgument($params, 'id');
138        $body = $this->extractArgument($params, 'body');
139
140        $endpointBuilder = $this->endpoints;
141        $endpoint = $endpointBuilder('Rollup\PutJob');
142        $endpoint->setParams($params);
143        $endpoint->setId($id);
144        $endpoint->setBody($body);
145
146        return $this->performRequest($endpoint);
147    }
148    /**
149     * Rollup an index
150     *
151     * $params['index']        = (string) The index to roll up
152     * $params['rollup_index'] = (string) The name of the rollup index to create
153     * $params['body']         = (array) The rollup configuration (Required)
154     *
155     * @param array $params Associative array of parameters
156     * @return array
157     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-rollup.html
158     *
159     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
160     *
161     */
162    public function rollup(array $params = [])
163    {
164        $index = $this->extractArgument($params, 'index');
165        $rollup_index = $this->extractArgument($params, 'rollup_index');
166        $body = $this->extractArgument($params, 'body');
167
168        $endpointBuilder = $this->endpoints;
169        $endpoint = $endpointBuilder('Rollup\Rollup');
170        $endpoint->setParams($params);
171        $endpoint->setIndex($index);
172        $endpoint->setRollupIndex($rollup_index);
173        $endpoint->setBody($body);
174
175        return $this->performRequest($endpoint);
176    }
177    /**
178     * Enables searching rolled-up data using the standard query DSL.
179     *
180     * $params['index']                  = (list) The indices or index-pattern(s) (containing rollup or regular data) that should be searched (Required)
181     * $params['type']                   = DEPRECATED (string) The doc type inside the index
182     * $params['typed_keys']             = (boolean) Specify whether aggregation and suggester names should be prefixed by their respective types in the response
183     * $params['rest_total_hits_as_int'] = (boolean) Indicates whether hits.total should be rendered as an integer or an object in the rest search response (Default = false)
184     * $params['body']                   = (array) The search request body (Required)
185     *
186     * @param array $params Associative array of parameters
187     * @return array
188     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-search.html
189     *
190     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
191     *
192     */
193    public function rollupSearch(array $params = [])
194    {
195        $index = $this->extractArgument($params, 'index');
196        $type = $this->extractArgument($params, 'type');
197        $body = $this->extractArgument($params, 'body');
198
199        $endpointBuilder = $this->endpoints;
200        $endpoint = $endpointBuilder('Rollup\RollupSearch');
201        $endpoint->setParams($params);
202        $endpoint->setIndex($index);
203        $endpoint->setType($type);
204        $endpoint->setBody($body);
205
206        return $this->performRequest($endpoint);
207    }
208    /**
209     * Starts an existing, stopped rollup job.
210     *
211     * $params['id'] = (string) The ID of the job to start
212     *
213     * @param array $params Associative array of parameters
214     * @return array
215     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-start-job.html
216     *
217     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
218     *
219     */
220    public function startJob(array $params = [])
221    {
222        $id = $this->extractArgument($params, 'id');
223
224        $endpointBuilder = $this->endpoints;
225        $endpoint = $endpointBuilder('Rollup\StartJob');
226        $endpoint->setParams($params);
227        $endpoint->setId($id);
228
229        return $this->performRequest($endpoint);
230    }
231    /**
232     * Stops an existing, started rollup job.
233     *
234     * $params['id']                  = (string) The ID of the job to stop
235     * $params['wait_for_completion'] = (boolean) True if the API should block until the job has fully stopped, false if should be executed async. Defaults to false.
236     * $params['timeout']             = (time) Block for (at maximum) the specified duration while waiting for the job to stop.  Defaults to 30s.
237     *
238     * @param array $params Associative array of parameters
239     * @return array
240     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-stop-job.html
241     *
242     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
243     *
244     */
245    public function stopJob(array $params = [])
246    {
247        $id = $this->extractArgument($params, 'id');
248
249        $endpointBuilder = $this->endpoints;
250        $endpoint = $endpointBuilder('Rollup\StopJob');
251        $endpoint->setParams($params);
252        $endpoint->setId($id);
253
254        return $this->performRequest($endpoint);
255    }
256}
257