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 IndicesNamespace
23 *
24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php
25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee)
26 */
27class IndicesNamespace extends AbstractNamespace
28{
29
30    /**
31     * Adds a block to an index.
32     *
33     * $params['index']              = (list) A comma separated list of indices to add a block to
34     * $params['block']              = (string) The block to add (one of read, write, read_only or metadata)
35     * $params['timeout']            = (time) Explicit operation timeout
36     * $params['master_timeout']     = (time) Specify timeout for connection to master
37     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
38     * $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)
39     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
40     *
41     * @param array $params Associative array of parameters
42     * @return array
43     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-blocks.html
44     */
45    public function addBlock(array $params = [])
46    {
47        $index = $this->extractArgument($params, 'index');
48        $block = $this->extractArgument($params, 'block');
49
50        $endpointBuilder = $this->endpoints;
51        $endpoint = $endpointBuilder('Indices\AddBlock');
52        $endpoint->setParams($params);
53        $endpoint->setIndex($index);
54        $endpoint->setBlock($block);
55
56        return $this->performRequest($endpoint);
57    }
58    /**
59     * Performs the analysis process on a text and return the tokens breakdown of the text.
60     *
61     * $params['index'] = (string) The name of the index to scope the operation
62     * $params['body']  = (array) Define analyzer/tokenizer parameters and the text on which the analysis should be performed
63     *
64     * @param array $params Associative array of parameters
65     * @return array
66     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html
67     */
68    public function analyze(array $params = [])
69    {
70        $index = $this->extractArgument($params, 'index');
71        $body = $this->extractArgument($params, 'body');
72
73        $endpointBuilder = $this->endpoints;
74        $endpoint = $endpointBuilder('Indices\Analyze');
75        $endpoint->setParams($params);
76        $endpoint->setIndex($index);
77        $endpoint->setBody($body);
78
79        return $this->performRequest($endpoint);
80    }
81    /**
82     * Clears all or specific caches for one or more indices.
83     *
84     * $params['index']              = (list) A comma-separated list of index name to limit the operation
85     * $params['fielddata']          = (boolean) Clear field data
86     * $params['fields']             = (list) A comma-separated list of fields to clear when using the `fielddata` parameter (default: all)
87     * $params['query']              = (boolean) Clear query caches
88     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
89     * $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)
90     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
91     * $params['request']            = (boolean) Clear request cache
92     *
93     * @param array $params Associative array of parameters
94     * @return array
95     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html
96     */
97    public function clearCache(array $params = [])
98    {
99        $index = $this->extractArgument($params, 'index');
100
101        $endpointBuilder = $this->endpoints;
102        $endpoint = $endpointBuilder('Indices\ClearCache');
103        $endpoint->setParams($params);
104        $endpoint->setIndex($index);
105
106        return $this->performRequest($endpoint);
107    }
108    /**
109     * Clones an index
110     *
111     * $params['index']                  = (string) The name of the source index to clone
112     * $params['target']                 = (string) The name of the target index to clone into
113     * $params['timeout']                = (time) Explicit operation timeout
114     * $params['master_timeout']         = (time) Specify timeout for connection to master
115     * $params['wait_for_active_shards'] = (string) Set the number of active shards to wait for on the cloned index before the operation returns.
116     * $params['body']                   = (array) The configuration for the target index (`settings` and `aliases`)
117     *
118     * @param array $params Associative array of parameters
119     * @return array
120     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clone-index.html
121     */
122    public function clone(array $params = [])
123    {
124        $index = $this->extractArgument($params, 'index');
125        $target = $this->extractArgument($params, 'target');
126        $body = $this->extractArgument($params, 'body');
127
128        $endpointBuilder = $this->endpoints;
129        $endpoint = $endpointBuilder('Indices\CloneIndices');
130        $endpoint->setParams($params);
131        $endpoint->setIndex($index);
132        $endpoint->setTarget($target);
133        $endpoint->setBody($body);
134
135        return $this->performRequest($endpoint);
136    }
137    /**
138     * Closes an index.
139     *
140     * $params['index']                  = (list) A comma separated list of indices to close
141     * $params['timeout']                = (time) Explicit operation timeout
142     * $params['master_timeout']         = (time) Specify timeout for connection to master
143     * $params['ignore_unavailable']     = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
144     * $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)
145     * $params['expand_wildcards']       = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
146     * $params['wait_for_active_shards'] = (string) Sets the number of active shards to wait for before the operation returns. Set to `index-setting` to wait according to the index setting `index.write.wait_for_active_shards`, or `all` to wait for all shards, or an integer. Defaults to `0`.
147     *
148     * @param array $params Associative array of parameters
149     * @return array
150     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html
151     */
152    public function close(array $params = [])
153    {
154        $index = $this->extractArgument($params, 'index');
155
156        $endpointBuilder = $this->endpoints;
157        $endpoint = $endpointBuilder('Indices\Close');
158        $endpoint->setParams($params);
159        $endpoint->setIndex($index);
160
161        return $this->performRequest($endpoint);
162    }
163    /**
164     * Creates an index with optional settings and mappings.
165     *
166     * $params['index']                  = (string) The name of the index
167     * $params['include_type_name']      = (boolean) Whether a type should be expected in the body of the mappings.
168     * $params['wait_for_active_shards'] = (string) Set the number of active shards to wait for before the operation returns.
169     * $params['timeout']                = (time) Explicit operation timeout
170     * $params['master_timeout']         = (time) Specify timeout for connection to master
171     * $params['body']                   = (array) The configuration for the index (`settings` and `mappings`)
172     *
173     * @param array $params Associative array of parameters
174     * @return array
175     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html
176     */
177    public function create(array $params = [])
178    {
179        $index = $this->extractArgument($params, 'index');
180        $body = $this->extractArgument($params, 'body');
181
182        $endpointBuilder = $this->endpoints;
183        $endpoint = $endpointBuilder('Indices\Create');
184        $endpoint->setParams($params);
185        $endpoint->setIndex($index);
186        $endpoint->setBody($body);
187
188        return $this->performRequest($endpoint);
189    }
190    /**
191     * Creates a data stream
192     *
193     * $params['name'] = (string) The name of the data stream
194     *
195     * @param array $params Associative array of parameters
196     * @return array
197     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html
198     */
199    public function createDataStream(array $params = [])
200    {
201        $name = $this->extractArgument($params, 'name');
202
203        $endpointBuilder = $this->endpoints;
204        $endpoint = $endpointBuilder('Indices\CreateDataStream');
205        $endpoint->setParams($params);
206        $endpoint->setName($name);
207
208        return $this->performRequest($endpoint);
209    }
210    /**
211     * Provides statistics on operations happening in a data stream.
212     *
213     * $params['name'] = (list) A comma-separated list of data stream names; use `_all` or empty string to perform the operation on all data streams
214     *
215     * @param array $params Associative array of parameters
216     * @return array
217     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html
218     */
219    public function dataStreamsStats(array $params = [])
220    {
221        $name = $this->extractArgument($params, 'name');
222
223        $endpointBuilder = $this->endpoints;
224        $endpoint = $endpointBuilder('Indices\DataStreamsStats');
225        $endpoint->setParams($params);
226        $endpoint->setName($name);
227
228        return $this->performRequest($endpoint);
229    }
230    /**
231     * Deletes an index.
232     *
233     * $params['index']              = (list) A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices
234     * $params['timeout']            = (time) Explicit operation timeout
235     * $params['master_timeout']     = (time) Specify timeout for connection to master
236     * $params['ignore_unavailable'] = (boolean) Ignore unavailable indexes (default: false)
237     * $params['allow_no_indices']   = (boolean) Ignore if a wildcard expression resolves to no concrete indices (default: false)
238     * $params['expand_wildcards']   = (enum) Whether wildcard expressions should get expanded to open, closed, or hidden indices (Options = open,closed,hidden,none,all) (Default = open,closed)
239     *
240     * @param array $params Associative array of parameters
241     * @return array
242     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html
243     */
244    public function delete(array $params = [])
245    {
246        $index = $this->extractArgument($params, 'index');
247
248        $endpointBuilder = $this->endpoints;
249        $endpoint = $endpointBuilder('Indices\Delete');
250        $endpoint->setParams($params);
251        $endpoint->setIndex($index);
252
253        return $this->performRequest($endpoint);
254    }
255    /**
256     * Deletes an alias.
257     *
258     * $params['index']          = (list) A comma-separated list of index names (supports wildcards); use `_all` for all indices (Required)
259     * $params['name']           = (list) A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices. (Required)
260     * $params['timeout']        = (time) Explicit timestamp for the document
261     * $params['master_timeout'] = (time) Specify timeout for connection to master
262     *
263     * @param array $params Associative array of parameters
264     * @return array
265     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html
266     */
267    public function deleteAlias(array $params = [])
268    {
269        $index = $this->extractArgument($params, 'index');
270        $name = $this->extractArgument($params, 'name');
271
272        $endpointBuilder = $this->endpoints;
273        $endpoint = $endpointBuilder('Indices\DeleteAlias');
274        $endpoint->setParams($params);
275        $endpoint->setIndex($index);
276        $endpoint->setName($name);
277
278        return $this->performRequest($endpoint);
279    }
280    /**
281     * Deletes a data stream.
282     *
283     * $params['name']             = (list) A comma-separated list of data streams to delete; use `*` to delete all data streams
284     * $params['expand_wildcards'] = (enum) Whether wildcard expressions should get expanded to open or closed indices (default: open) (Options = open,closed,hidden,none,all) (Default = open)
285     *
286     * @param array $params Associative array of parameters
287     * @return array
288     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html
289     */
290    public function deleteDataStream(array $params = [])
291    {
292        $name = $this->extractArgument($params, 'name');
293
294        $endpointBuilder = $this->endpoints;
295        $endpoint = $endpointBuilder('Indices\DeleteDataStream');
296        $endpoint->setParams($params);
297        $endpoint->setName($name);
298
299        return $this->performRequest($endpoint);
300    }
301    /**
302     * Deletes an index template.
303     *
304     * $params['name']           = (string) The name of the template
305     * $params['timeout']        = (time) Explicit operation timeout
306     * $params['master_timeout'] = (time) Specify timeout for connection to master
307     *
308     * @param array $params Associative array of parameters
309     * @return array
310     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
311     */
312    public function deleteIndexTemplate(array $params = [])
313    {
314        $name = $this->extractArgument($params, 'name');
315
316        $endpointBuilder = $this->endpoints;
317        $endpoint = $endpointBuilder('Indices\DeleteIndexTemplate');
318        $endpoint->setParams($params);
319        $endpoint->setName($name);
320
321        return $this->performRequest($endpoint);
322    }
323    /**
324     * Deletes an index template.
325     *
326     * $params['name']           = (string) The name of the template
327     * $params['timeout']        = (time) Explicit operation timeout
328     * $params['master_timeout'] = (time) Specify timeout for connection to master
329     *
330     * @param array $params Associative array of parameters
331     * @return array
332     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
333     */
334    public function deleteTemplate(array $params = [])
335    {
336        $name = $this->extractArgument($params, 'name');
337
338        $endpointBuilder = $this->endpoints;
339        $endpoint = $endpointBuilder('Indices\DeleteTemplate');
340        $endpoint->setParams($params);
341        $endpoint->setName($name);
342
343        return $this->performRequest($endpoint);
344    }
345    /**
346     * Analyzes the disk usage of each field of an index or data stream
347     *
348     * $params['index']               = (string) Comma-separated list of indices or data streams to analyze the disk usage
349     * $params['run_expensive_tasks'] = (boolean) Must be set to [true] in order for the task to be performed. Defaults to false.
350     * $params['flush']               = (boolean) Whether flush or not before analyzing the index disk usage. Defaults to true
351     * $params['ignore_unavailable']  = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
352     * $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)
353     * $params['expand_wildcards']    = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
354     *
355     * @param array $params Associative array of parameters
356     * @return array
357     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-disk-usage.html
358     *
359     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
360     *
361     */
362    public function diskUsage(array $params = [])
363    {
364        $index = $this->extractArgument($params, 'index');
365
366        $endpointBuilder = $this->endpoints;
367        $endpoint = $endpointBuilder('Indices\DiskUsage');
368        $endpoint->setParams($params);
369        $endpoint->setIndex($index);
370
371        return $this->performRequest($endpoint);
372    }
373    /**
374     * Returns information about whether a particular index exists.
375     *
376     * $params['index']              = (list) A comma-separated list of index names
377     * $params['local']              = (boolean) Return local information, do not retrieve the state from master node (default: false)
378     * $params['ignore_unavailable'] = (boolean) Ignore unavailable indexes (default: false)
379     * $params['allow_no_indices']   = (boolean) Ignore if a wildcard expression resolves to no concrete indices (default: false)
380     * $params['expand_wildcards']   = (enum) Whether wildcard expressions should get expanded to open or closed indices (default: open) (Options = open,closed,hidden,none,all) (Default = open)
381     * $params['flat_settings']      = (boolean) Return settings in flat format (default: false)
382     * $params['include_defaults']   = (boolean) Whether to return all default setting for each of the indices. (Default = false)
383     *
384     * @param array $params Associative array of parameters
385     * @return bool
386     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html
387     */
388    public function exists(array $params = []): bool
389    {
390        $index = $this->extractArgument($params, 'index');
391
392        // manually make this verbose so we can check status code
393        $params['client']['verbose'] = true;
394
395        $endpointBuilder = $this->endpoints;
396        $endpoint = $endpointBuilder('Indices\Exists');
397        $endpoint->setParams($params);
398        $endpoint->setIndex($index);
399
400        return BooleanRequestWrapper::performRequest($endpoint, $this->transport);
401    }
402    /**
403     * Returns information about whether a particular alias exists.
404     *
405     * $params['name']               = (list) A comma-separated list of alias names to return (Required)
406     * $params['index']              = (list) A comma-separated list of index names to filter aliases
407     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
408     * $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)
409     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = all)
410     * $params['local']              = (boolean) Return local information, do not retrieve the state from master node (default: false)
411     *
412     * @param array $params Associative array of parameters
413     * @return bool
414     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html
415     */
416    public function existsAlias(array $params = []): bool
417    {
418        $name = $this->extractArgument($params, 'name');
419        $index = $this->extractArgument($params, 'index');
420
421        // manually make this verbose so we can check status code
422        $params['client']['verbose'] = true;
423
424        $endpointBuilder = $this->endpoints;
425        $endpoint = $endpointBuilder('Indices\ExistsAlias');
426        $endpoint->setParams($params);
427        $endpoint->setName($name);
428        $endpoint->setIndex($index);
429
430        return BooleanRequestWrapper::performRequest($endpoint, $this->transport);
431    }
432    /**
433     * Returns information about whether a particular index template exists.
434     *
435     * $params['name']           = (string) The name of the template
436     * $params['flat_settings']  = (boolean) Return settings in flat format (default: false)
437     * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
438     * $params['local']          = (boolean) Return local information, do not retrieve the state from master node (default: false)
439     *
440     * @param array $params Associative array of parameters
441     * @return bool
442     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
443     */
444    public function existsIndexTemplate(array $params = []): bool
445    {
446        $name = $this->extractArgument($params, 'name');
447
448        // manually make this verbose so we can check status code
449        $params['client']['verbose'] = true;
450
451        $endpointBuilder = $this->endpoints;
452        $endpoint = $endpointBuilder('Indices\ExistsIndexTemplate');
453        $endpoint->setParams($params);
454        $endpoint->setName($name);
455
456        return BooleanRequestWrapper::performRequest($endpoint, $this->transport);
457    }
458    /**
459     * Returns information about whether a particular index template exists.
460     *
461     * $params['name']           = (list) The comma separated names of the index templates
462     * $params['flat_settings']  = (boolean) Return settings in flat format (default: false)
463     * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
464     * $params['local']          = (boolean) Return local information, do not retrieve the state from master node (default: false)
465     *
466     * @param array $params Associative array of parameters
467     * @return bool
468     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
469     */
470    public function existsTemplate(array $params = []): bool
471    {
472        $name = $this->extractArgument($params, 'name');
473
474        // manually make this verbose so we can check status code
475        $params['client']['verbose'] = true;
476
477        $endpointBuilder = $this->endpoints;
478        $endpoint = $endpointBuilder('Indices\ExistsTemplate');
479        $endpoint->setParams($params);
480        $endpoint->setName($name);
481
482        return BooleanRequestWrapper::performRequest($endpoint, $this->transport);
483    }
484    /**
485     * Returns information about whether a particular document type exists. (DEPRECATED)
486     *
487     * $params['index']              = (list) A comma-separated list of index names; use `_all` to check the types across all indices
488     * $params['type']               = DEPRECATED (list) A comma-separated list of document types to check
489     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
490     * $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)
491     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
492     * $params['local']              = (boolean) Return local information, do not retrieve the state from master node (default: false)
493     *
494     * @param array $params Associative array of parameters
495     * @return bool
496     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-types-exists.html
497     */
498    public function existsType(array $params = []): bool
499    {
500        $index = $this->extractArgument($params, 'index');
501        $type = $this->extractArgument($params, 'type');
502
503        // manually make this verbose so we can check status code
504        $params['client']['verbose'] = true;
505
506        $endpointBuilder = $this->endpoints;
507        $endpoint = $endpointBuilder('Indices\ExistsType');
508        $endpoint->setParams($params);
509        $endpoint->setIndex($index);
510        $endpoint->setType($type);
511
512        return BooleanRequestWrapper::performRequest($endpoint, $this->transport);
513    }
514    /**
515     * Returns the field usage stats for each field of an index
516     *
517     * $params['index']              = (string) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
518     * $params['fields']             = (list) A comma-separated list of fields to include in the stats if only a subset of fields should be returned (supports wildcards)
519     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
520     * $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)
521     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
522     *
523     * @param array $params Associative array of parameters
524     * @return array
525     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/field-usage-stats.html
526     *
527     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
528     *
529     */
530    public function fieldUsageStats(array $params = [])
531    {
532        $index = $this->extractArgument($params, 'index');
533
534        $endpointBuilder = $this->endpoints;
535        $endpoint = $endpointBuilder('Indices\FieldUsageStats');
536        $endpoint->setParams($params);
537        $endpoint->setIndex($index);
538
539        return $this->performRequest($endpoint);
540    }
541    /**
542     * Performs the flush operation on one or more indices.
543     *
544     * $params['index']              = (list) A comma-separated list of index names; use `_all` or empty string for all indices
545     * $params['force']              = (boolean) Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal)
546     * $params['wait_if_ongoing']    = (boolean) If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. The default is true. If set to false the flush will be skipped iff if another flush operation is already running.
547     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
548     * $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)
549     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
550     *
551     * @param array $params Associative array of parameters
552     * @return array
553     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html
554     */
555    public function flush(array $params = [])
556    {
557        $index = $this->extractArgument($params, 'index');
558
559        $endpointBuilder = $this->endpoints;
560        $endpoint = $endpointBuilder('Indices\Flush');
561        $endpoint->setParams($params);
562        $endpoint->setIndex($index);
563
564        return $this->performRequest($endpoint);
565    }
566    /**
567     * Performs a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead
568     *
569     * $params['index']              = (list) A comma-separated list of index names; use `_all` or empty string for all indices
570     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
571     * $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)
572     * $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)
573     *
574     * @param array $params Associative array of parameters
575     * @return array
576     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush-api.html
577     */
578    public function flushSynced(array $params = [])
579    {
580        $index = $this->extractArgument($params, 'index');
581
582        $endpointBuilder = $this->endpoints;
583        $endpoint = $endpointBuilder('Indices\FlushSynced');
584        $endpoint->setParams($params);
585        $endpoint->setIndex($index);
586
587        return $this->performRequest($endpoint);
588    }
589    /**
590     * Performs the force merge operation on one or more indices.
591     *
592     * $params['index']                = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
593     * $params['flush']                = (boolean) Specify whether the index should be flushed after performing the operation (default: true)
594     * $params['ignore_unavailable']   = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
595     * $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)
596     * $params['expand_wildcards']     = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
597     * $params['max_num_segments']     = (number) The number of segments the index should be merged into (default: dynamic)
598     * $params['only_expunge_deletes'] = (boolean) Specify whether the operation should only expunge deleted documents
599     *
600     * @param array $params Associative array of parameters
601     * @return array
602     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html
603     */
604    public function forcemerge(array $params = [])
605    {
606        $index = $this->extractArgument($params, 'index');
607
608        $endpointBuilder = $this->endpoints;
609        $endpoint = $endpointBuilder('Indices\ForceMerge');
610        $endpoint->setParams($params);
611        $endpoint->setIndex($index);
612
613        return $this->performRequest($endpoint);
614    }
615    /**
616     * Freezes an index. A frozen index has almost no overhead on the cluster (except for maintaining its metadata in memory) and is read-only.
617     *
618     * $params['index']                  = (string) The name of the index to freeze
619     * $params['timeout']                = (time) Explicit operation timeout
620     * $params['master_timeout']         = (time) Specify timeout for connection to master
621     * $params['ignore_unavailable']     = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
622     * $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)
623     * $params['expand_wildcards']       = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = closed)
624     * $params['wait_for_active_shards'] = (string) Sets the number of active shards to wait for before the operation returns.
625     *
626     * @param array $params Associative array of parameters
627     * @return array
628     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/freeze-index-api.html
629     */
630    public function freeze(array $params = [])
631    {
632        $index = $this->extractArgument($params, 'index');
633
634        $endpointBuilder = $this->endpoints;
635        $endpoint = $endpointBuilder('Indices\Freeze');
636        $endpoint->setParams($params);
637        $endpoint->setIndex($index);
638
639        return $this->performRequest($endpoint);
640    }
641    /**
642     * Returns information about one or more indices.
643     *
644     * $params['index']              = (list) A comma-separated list of index names
645     * $params['include_type_name']  = (boolean) Whether to add the type name to the response (default: false)
646     * $params['local']              = (boolean) Return local information, do not retrieve the state from master node (default: false)
647     * $params['ignore_unavailable'] = (boolean) Ignore unavailable indexes (default: false)
648     * $params['allow_no_indices']   = (boolean) Ignore if a wildcard expression resolves to no concrete indices (default: false)
649     * $params['expand_wildcards']   = (enum) Whether wildcard expressions should get expanded to open or closed indices (default: open) (Options = open,closed,hidden,none,all) (Default = open)
650     * $params['flat_settings']      = (boolean) Return settings in flat format (default: false)
651     * $params['include_defaults']   = (boolean) Whether to return all default setting for each of the indices. (Default = false)
652     * $params['master_timeout']     = (time) Specify timeout for connection to master
653     *
654     * @param array $params Associative array of parameters
655     * @return array
656     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html
657     */
658    public function get(array $params = [])
659    {
660        $index = $this->extractArgument($params, 'index');
661
662        $endpointBuilder = $this->endpoints;
663        $endpoint = $endpointBuilder('Indices\Get');
664        $endpoint->setParams($params);
665        $endpoint->setIndex($index);
666
667        return $this->performRequest($endpoint);
668    }
669    /**
670     * Returns an alias.
671     *
672     * $params['name']               = (list) A comma-separated list of alias names to return
673     * $params['index']              = (list) A comma-separated list of index names to filter aliases
674     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
675     * $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)
676     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = all)
677     * $params['local']              = (boolean) Return local information, do not retrieve the state from master node (default: false)
678     *
679     * @param array $params Associative array of parameters
680     * @return array
681     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html
682     */
683    public function getAlias(array $params = [])
684    {
685        $name = $this->extractArgument($params, 'name');
686        $index = $this->extractArgument($params, 'index');
687
688        $endpointBuilder = $this->endpoints;
689        $endpoint = $endpointBuilder('Indices\GetAlias');
690        $endpoint->setParams($params);
691        $endpoint->setName($name);
692        $endpoint->setIndex($index);
693
694        return $this->performRequest($endpoint);
695    }
696    /**
697     * Returns data streams.
698     *
699     * $params['name']             = (list) A comma-separated list of data streams to get; use `*` to get all data streams
700     * $params['expand_wildcards'] = (enum) Whether wildcard expressions should get expanded to open or closed indices (default: open) (Options = open,closed,hidden,none,all) (Default = open)
701     *
702     * @param array $params Associative array of parameters
703     * @return array
704     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html
705     */
706    public function getDataStream(array $params = [])
707    {
708        $name = $this->extractArgument($params, 'name');
709
710        $endpointBuilder = $this->endpoints;
711        $endpoint = $endpointBuilder('Indices\GetDataStream');
712        $endpoint->setParams($params);
713        $endpoint->setName($name);
714
715        return $this->performRequest($endpoint);
716    }
717    /**
718     * Returns mapping for one or more fields.
719     *
720     * $params['fields']             = (list) A comma-separated list of fields (Required)
721     * $params['index']              = (list) A comma-separated list of index names
722     * $params['type']               = DEPRECATED (list) A comma-separated list of document types
723     * $params['include_type_name']  = (boolean) Whether a type should be returned in the body of the mappings.
724     * $params['include_defaults']   = (boolean) Whether the default mapping values should be returned as well
725     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
726     * $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)
727     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
728     * $params['local']              = (boolean) Return local information, do not retrieve the state from master node (default: false)
729     *
730     * @param array $params Associative array of parameters
731     * @return array
732     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html
733     */
734    public function getFieldMapping(array $params = [])
735    {
736        $fields = $this->extractArgument($params, 'fields');
737        $index = $this->extractArgument($params, 'index');
738        $type = $this->extractArgument($params, 'type');
739
740        $endpointBuilder = $this->endpoints;
741        $endpoint = $endpointBuilder('Indices\GetFieldMapping');
742        $endpoint->setParams($params);
743        $endpoint->setFields($fields);
744        $endpoint->setIndex($index);
745        $endpoint->setType($type);
746
747        return $this->performRequest($endpoint);
748    }
749    /**
750     * Returns an index template.
751     *
752     * $params['name']           = (list) The comma separated names of the index templates
753     * $params['flat_settings']  = (boolean) Return settings in flat format (default: false)
754     * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
755     * $params['local']          = (boolean) Return local information, do not retrieve the state from master node (default: false)
756     *
757     * @param array $params Associative array of parameters
758     * @return array
759     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
760     */
761    public function getIndexTemplate(array $params = [])
762    {
763        $name = $this->extractArgument($params, 'name');
764
765        $endpointBuilder = $this->endpoints;
766        $endpoint = $endpointBuilder('Indices\GetIndexTemplate');
767        $endpoint->setParams($params);
768        $endpoint->setName($name);
769
770        return $this->performRequest($endpoint);
771    }
772    /**
773     * Returns mappings for one or more indices.
774     *
775     * $params['index']              = (list) A comma-separated list of index names
776     * $params['type']               = DEPRECATED (list) A comma-separated list of document types
777     * $params['include_type_name']  = (boolean) Whether to add the type name to the response (default: false)
778     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
779     * $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)
780     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
781     * $params['master_timeout']     = (time) Specify timeout for connection to master
782     * $params['local']              = (boolean) Return local information, do not retrieve the state from master node (default: false)
783     *
784     * @param array $params Associative array of parameters
785     * @return array
786     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html
787     */
788    public function getMapping(array $params = [])
789    {
790        $index = $this->extractArgument($params, 'index');
791        $type = $this->extractArgument($params, 'type');
792
793        $endpointBuilder = $this->endpoints;
794        $endpoint = $endpointBuilder('Indices\GetMapping');
795        $endpoint->setParams($params);
796        $endpoint->setIndex($index);
797        $endpoint->setType($type);
798
799        return $this->performRequest($endpoint);
800    }
801    /**
802     * Returns settings for one or more indices.
803     *
804     * $params['index']              = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
805     * $params['name']               = (list) The name of the settings that should be included
806     * $params['master_timeout']     = (time) Specify timeout for connection to master
807     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
808     * $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)
809     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = all)
810     * $params['flat_settings']      = (boolean) Return settings in flat format (default: false)
811     * $params['local']              = (boolean) Return local information, do not retrieve the state from master node (default: false)
812     * $params['include_defaults']   = (boolean) Whether to return all default setting for each of the indices. (Default = false)
813     *
814     * @param array $params Associative array of parameters
815     * @return array
816     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html
817     */
818    public function getSettings(array $params = [])
819    {
820        $index = $this->extractArgument($params, 'index');
821        $name = $this->extractArgument($params, 'name');
822
823        $endpointBuilder = $this->endpoints;
824        $endpoint = $endpointBuilder('Indices\GetSettings');
825        $endpoint->setParams($params);
826        $endpoint->setIndex($index);
827        $endpoint->setName($name);
828
829        return $this->performRequest($endpoint);
830    }
831    /**
832     * Returns an index template.
833     *
834     * $params['name']              = (list) The comma separated names of the index templates
835     * $params['include_type_name'] = (boolean) Whether a type should be returned in the body of the mappings.
836     * $params['flat_settings']     = (boolean) Return settings in flat format (default: false)
837     * $params['master_timeout']    = (time) Explicit operation timeout for connection to master node
838     * $params['local']             = (boolean) Return local information, do not retrieve the state from master node (default: false)
839     *
840     * @param array $params Associative array of parameters
841     * @return array
842     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
843     */
844    public function getTemplate(array $params = [])
845    {
846        $name = $this->extractArgument($params, 'name');
847
848        $endpointBuilder = $this->endpoints;
849        $endpoint = $endpointBuilder('Indices\GetTemplate');
850        $endpoint->setParams($params);
851        $endpoint->setName($name);
852
853        return $this->performRequest($endpoint);
854    }
855    /**
856     * DEPRECATED Returns a progress status of current upgrade.
857     *
858     * $params['index']              = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
859     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
860     * $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)
861     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
862     *
863     * @param array $params Associative array of parameters
864     * @return array
865     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html
866     */
867    public function getUpgrade(array $params = [])
868    {
869        $index = $this->extractArgument($params, 'index');
870
871        $endpointBuilder = $this->endpoints;
872        $endpoint = $endpointBuilder('Indices\GetUpgrade');
873        $endpoint->setParams($params);
874        $endpoint->setIndex($index);
875
876        return $this->performRequest($endpoint);
877    }
878    /**
879     * Migrates an alias to a data stream
880     *
881     * $params['name'] = (string) The name of the alias to migrate
882     *
883     * @param array $params Associative array of parameters
884     * @return array
885     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html
886     */
887    public function migrateToDataStream(array $params = [])
888    {
889        $name = $this->extractArgument($params, 'name');
890
891        $endpointBuilder = $this->endpoints;
892        $endpoint = $endpointBuilder('Indices\MigrateToDataStream');
893        $endpoint->setParams($params);
894        $endpoint->setName($name);
895
896        return $this->performRequest($endpoint);
897    }
898    /**
899     * Opens an index.
900     *
901     * $params['index']                  = (list) A comma separated list of indices to open
902     * $params['timeout']                = (time) Explicit operation timeout
903     * $params['master_timeout']         = (time) Specify timeout for connection to master
904     * $params['ignore_unavailable']     = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
905     * $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)
906     * $params['expand_wildcards']       = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = closed)
907     * $params['wait_for_active_shards'] = (string) Sets the number of active shards to wait for before the operation returns.
908     *
909     * @param array $params Associative array of parameters
910     * @return array
911     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html
912     */
913    public function open(array $params = [])
914    {
915        $index = $this->extractArgument($params, 'index');
916
917        $endpointBuilder = $this->endpoints;
918        $endpoint = $endpointBuilder('Indices\Open');
919        $endpoint->setParams($params);
920        $endpoint->setIndex($index);
921
922        return $this->performRequest($endpoint);
923    }
924    /**
925     * Promotes a data stream from a replicated data stream managed by CCR to a regular data stream
926     *
927     * $params['name'] = (string) The name of the data stream
928     *
929     * @param array $params Associative array of parameters
930     * @return array
931     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html
932     */
933    public function promoteDataStream(array $params = [])
934    {
935        $name = $this->extractArgument($params, 'name');
936
937        $endpointBuilder = $this->endpoints;
938        $endpoint = $endpointBuilder('Indices\PromoteDataStream');
939        $endpoint->setParams($params);
940        $endpoint->setName($name);
941
942        return $this->performRequest($endpoint);
943    }
944    /**
945     * Creates or updates an alias.
946     *
947     * $params['index']          = (list) A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices. (Required)
948     * $params['name']           = (string) The name of the alias to be created or updated (Required)
949     * $params['timeout']        = (time) Explicit timestamp for the document
950     * $params['master_timeout'] = (time) Specify timeout for connection to master
951     * $params['body']           = (array) The settings for the alias, such as `routing` or `filter`
952     *
953     * @param array $params Associative array of parameters
954     * @return array
955     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html
956     */
957    public function putAlias(array $params = [])
958    {
959        $index = $this->extractArgument($params, 'index');
960        $name = $this->extractArgument($params, 'name');
961        $body = $this->extractArgument($params, 'body');
962
963        $endpointBuilder = $this->endpoints;
964        $endpoint = $endpointBuilder('Indices\PutAlias');
965        $endpoint->setParams($params);
966        $endpoint->setIndex($index);
967        $endpoint->setName($name);
968        $endpoint->setBody($body);
969
970        return $this->performRequest($endpoint);
971    }
972    /**
973     * Creates or updates an index template.
974     *
975     * $params['name']           = (string) The name of the template
976     * $params['create']         = (boolean) Whether the index template should only be added if new or can also replace an existing one (Default = false)
977     * $params['cause']          = (string) User defined reason for creating/updating the index template (Default = )
978     * $params['master_timeout'] = (time) Specify timeout for connection to master
979     * $params['body']           = (array) The template definition (Required)
980     *
981     * @param array $params Associative array of parameters
982     * @return array
983     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
984     */
985    public function putIndexTemplate(array $params = [])
986    {
987        $name = $this->extractArgument($params, 'name');
988        $body = $this->extractArgument($params, 'body');
989
990        $endpointBuilder = $this->endpoints;
991        $endpoint = $endpointBuilder('Indices\PutIndexTemplate');
992        $endpoint->setParams($params);
993        $endpoint->setName($name);
994        $endpoint->setBody($body);
995
996        return $this->performRequest($endpoint);
997    }
998    /**
999     * Updates the index mappings.
1000     *
1001     * $params['index']              = (list) A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices.
1002     * $params['type']               = DEPRECATED (string) The name of the document type
1003     * $params['include_type_name']  = (boolean) Whether a type should be expected in the body of the mappings.
1004     * $params['timeout']            = (time) Explicit operation timeout
1005     * $params['master_timeout']     = (time) Specify timeout for connection to master
1006     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
1007     * $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)
1008     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
1009     * $params['write_index_only']   = (boolean) When true, applies mappings only to the write index of an alias or data stream (Default = false)
1010     * $params['body']               = (array) The mapping definition (Required)
1011     *
1012     * @param array $params Associative array of parameters
1013     * @return array
1014     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html
1015     */
1016    public function putMapping(array $params = [])
1017    {
1018        $index = $this->extractArgument($params, 'index');
1019        $type = $this->extractArgument($params, 'type');
1020        $body = $this->extractArgument($params, 'body');
1021
1022        $endpointBuilder = $this->endpoints;
1023        $endpoint = $endpointBuilder('Indices\PutMapping');
1024        $endpoint->setParams($params);
1025        $endpoint->setIndex($index);
1026        $endpoint->setType($type);
1027        $endpoint->setBody($body);
1028
1029        return $this->performRequest($endpoint);
1030    }
1031    /**
1032     * Updates the index settings.
1033     *
1034     * $params['index']              = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
1035     * $params['master_timeout']     = (time) Specify timeout for connection to master
1036     * $params['timeout']            = (time) Explicit operation timeout
1037     * $params['preserve_existing']  = (boolean) Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false`
1038     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
1039     * $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)
1040     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
1041     * $params['flat_settings']      = (boolean) Return settings in flat format (default: false)
1042     * $params['body']               = (array) The index settings to be updated (Required)
1043     *
1044     * @param array $params Associative array of parameters
1045     * @return array
1046     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html
1047     */
1048    public function putSettings(array $params = [])
1049    {
1050        $index = $this->extractArgument($params, 'index');
1051        $body = $this->extractArgument($params, 'body');
1052
1053        $endpointBuilder = $this->endpoints;
1054        $endpoint = $endpointBuilder('Indices\PutSettings');
1055        $endpoint->setParams($params);
1056        $endpoint->setIndex($index);
1057        $endpoint->setBody($body);
1058
1059        return $this->performRequest($endpoint);
1060    }
1061    /**
1062     * Creates or updates an index template.
1063     *
1064     * $params['name']              = (string) The name of the template
1065     * $params['include_type_name'] = (boolean) Whether a type should be returned in the body of the mappings.
1066     * $params['order']             = (number) The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)
1067     * $params['create']            = (boolean) Whether the index template should only be added if new or can also replace an existing one (Default = false)
1068     * $params['master_timeout']    = (time) Specify timeout for connection to master
1069     * $params['body']              = (array) The template definition (Required)
1070     *
1071     * @param array $params Associative array of parameters
1072     * @return array
1073     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
1074     */
1075    public function putTemplate(array $params = [])
1076    {
1077        $name = $this->extractArgument($params, 'name');
1078        $body = $this->extractArgument($params, 'body');
1079
1080        $endpointBuilder = $this->endpoints;
1081        $endpoint = $endpointBuilder('Indices\PutTemplate');
1082        $endpoint->setParams($params);
1083        $endpoint->setName($name);
1084        $endpoint->setBody($body);
1085
1086        return $this->performRequest($endpoint);
1087    }
1088    /**
1089     * Returns information about ongoing index shard recoveries.
1090     *
1091     * $params['index']       = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
1092     * $params['detailed']    = (boolean) Whether to display detailed information about shard recovery (Default = false)
1093     * $params['active_only'] = (boolean) Display only those recoveries that are currently on-going (Default = false)
1094     *
1095     * @param array $params Associative array of parameters
1096     * @return array
1097     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html
1098     */
1099    public function recovery(array $params = [])
1100    {
1101        $index = $this->extractArgument($params, 'index');
1102
1103        $endpointBuilder = $this->endpoints;
1104        $endpoint = $endpointBuilder('Indices\Recovery');
1105        $endpoint->setParams($params);
1106        $endpoint->setIndex($index);
1107
1108        return $this->performRequest($endpoint);
1109    }
1110    /**
1111     * Performs the refresh operation in one or more indices.
1112     *
1113     * $params['index']              = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
1114     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
1115     * $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)
1116     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
1117     *
1118     * @param array $params Associative array of parameters
1119     * @return array
1120     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html
1121     */
1122    public function refresh(array $params = [])
1123    {
1124        $index = $this->extractArgument($params, 'index');
1125
1126        $endpointBuilder = $this->endpoints;
1127        $endpoint = $endpointBuilder('Indices\Refresh');
1128        $endpoint->setParams($params);
1129        $endpoint->setIndex($index);
1130
1131        return $this->performRequest($endpoint);
1132    }
1133    /**
1134     * Reloads an index's search analyzers and their resources.
1135     *
1136     * $params['index']              = (list) A comma-separated list of index names to reload analyzers for
1137     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
1138     * $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)
1139     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
1140     *
1141     * @param array $params Associative array of parameters
1142     * @return array
1143     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-reload-analyzers.html
1144     */
1145    public function reloadSearchAnalyzers(array $params = [])
1146    {
1147        $index = $this->extractArgument($params, 'index');
1148
1149        $endpointBuilder = $this->endpoints;
1150        $endpoint = $endpointBuilder('Indices\ReloadSearchAnalyzers');
1151        $endpoint->setParams($params);
1152        $endpoint->setIndex($index);
1153
1154        return $this->performRequest($endpoint);
1155    }
1156    /**
1157     * Returns information about any matching indices, aliases, and data streams
1158     *
1159     * $params['name']             = (list) A comma-separated list of names or wildcard expressions
1160     * $params['expand_wildcards'] = (enum) Whether wildcard expressions should get expanded to open or closed indices (default: open) (Options = open,closed,hidden,none,all) (Default = open)
1161     *
1162     * @param array $params Associative array of parameters
1163     * @return array
1164     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-index-api.html
1165     *
1166     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
1167     *
1168     */
1169    public function resolveIndex(array $params = [])
1170    {
1171        $name = $this->extractArgument($params, 'name');
1172
1173        $endpointBuilder = $this->endpoints;
1174        $endpoint = $endpointBuilder('Indices\ResolveIndex');
1175        $endpoint->setParams($params);
1176        $endpoint->setName($name);
1177
1178        return $this->performRequest($endpoint);
1179    }
1180    /**
1181     * Updates an alias to point to a new index when the existing indexis considered to be too large or too old.
1182     *
1183     * $params['alias']                  = (string) The name of the alias to rollover (Required)
1184     * $params['new_index']              = (string) The name of the rollover index
1185     * $params['include_type_name']      = (boolean) Whether a type should be included in the body of the mappings.
1186     * $params['timeout']                = (time) Explicit operation timeout
1187     * $params['dry_run']                = (boolean) If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false
1188     * $params['master_timeout']         = (time) Specify timeout for connection to master
1189     * $params['wait_for_active_shards'] = (string) Set the number of active shards to wait for on the newly created rollover index before the operation returns.
1190     * $params['body']                   = (array) The conditions that needs to be met for executing rollover
1191     *
1192     * @param array $params Associative array of parameters
1193     * @return array
1194     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html
1195     */
1196    public function rollover(array $params = [])
1197    {
1198        $alias = $this->extractArgument($params, 'alias');
1199        $new_index = $this->extractArgument($params, 'new_index');
1200        $body = $this->extractArgument($params, 'body');
1201
1202        $endpointBuilder = $this->endpoints;
1203        $endpoint = $endpointBuilder('Indices\Rollover');
1204        $endpoint->setParams($params);
1205        $endpoint->setAlias($alias);
1206        $endpoint->setNewIndex($new_index);
1207        $endpoint->setBody($body);
1208
1209        return $this->performRequest($endpoint);
1210    }
1211    /**
1212     * Provides low-level information about segments in a Lucene index.
1213     *
1214     * $params['index']              = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
1215     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
1216     * $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)
1217     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
1218     * $params['verbose']            = (boolean) Includes detailed memory usage by Lucene. (Default = false)
1219     *
1220     * @param array $params Associative array of parameters
1221     * @return array
1222     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html
1223     */
1224    public function segments(array $params = [])
1225    {
1226        $index = $this->extractArgument($params, 'index');
1227
1228        $endpointBuilder = $this->endpoints;
1229        $endpoint = $endpointBuilder('Indices\Segments');
1230        $endpoint->setParams($params);
1231        $endpoint->setIndex($index);
1232
1233        return $this->performRequest($endpoint);
1234    }
1235    /**
1236     * Provides store information for shard copies of indices.
1237     *
1238     * $params['index']              = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
1239     * $params['status']             = (list) A comma-separated list of statuses used to filter on shards to get store information for (Options = green,yellow,red,all)
1240     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
1241     * $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)
1242     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
1243     *
1244     * @param array $params Associative array of parameters
1245     * @return array
1246     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.html
1247     */
1248    public function shardStores(array $params = [])
1249    {
1250        $index = $this->extractArgument($params, 'index');
1251
1252        $endpointBuilder = $this->endpoints;
1253        $endpoint = $endpointBuilder('Indices\ShardStores');
1254        $endpoint->setParams($params);
1255        $endpoint->setIndex($index);
1256
1257        return $this->performRequest($endpoint);
1258    }
1259    /**
1260     * Allow to shrink an existing index into a new index with fewer primary shards.
1261     *
1262     * $params['index']                  = (string) The name of the source index to shrink
1263     * $params['target']                 = (string) The name of the target index to shrink into
1264     * $params['copy_settings']          = (boolean) whether or not to copy settings from the source index (defaults to false)
1265     * $params['timeout']                = (time) Explicit operation timeout
1266     * $params['master_timeout']         = (time) Specify timeout for connection to master
1267     * $params['wait_for_active_shards'] = (string) Set the number of active shards to wait for on the shrunken index before the operation returns.
1268     * $params['body']                   = (array) The configuration for the target index (`settings` and `aliases`)
1269     *
1270     * @param array $params Associative array of parameters
1271     * @return array
1272     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html
1273     */
1274    public function shrink(array $params = [])
1275    {
1276        $index = $this->extractArgument($params, 'index');
1277        $target = $this->extractArgument($params, 'target');
1278        $body = $this->extractArgument($params, 'body');
1279
1280        $endpointBuilder = $this->endpoints;
1281        $endpoint = $endpointBuilder('Indices\Shrink');
1282        $endpoint->setParams($params);
1283        $endpoint->setIndex($index);
1284        $endpoint->setTarget($target);
1285        $endpoint->setBody($body);
1286
1287        return $this->performRequest($endpoint);
1288    }
1289    /**
1290     * Simulate matching the given index name against the index templates in the system
1291     *
1292     * $params['name']           = (string) The name of the index (it must be a concrete index name)
1293     * $params['create']         = (boolean) Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one (Default = false)
1294     * $params['cause']          = (string) User defined reason for dry-run creating the new template for simulation purposes (Default = )
1295     * $params['master_timeout'] = (time) Specify timeout for connection to master
1296     * $params['body']           = (array) New index template definition, which will be included in the simulation, as if it already exists in the system
1297     *
1298     * @param array $params Associative array of parameters
1299     * @return array
1300     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
1301     */
1302    public function simulateIndexTemplate(array $params = [])
1303    {
1304        $name = $this->extractArgument($params, 'name');
1305        $body = $this->extractArgument($params, 'body');
1306
1307        $endpointBuilder = $this->endpoints;
1308        $endpoint = $endpointBuilder('Indices\SimulateIndexTemplate');
1309        $endpoint->setParams($params);
1310        $endpoint->setName($name);
1311        $endpoint->setBody($body);
1312
1313        return $this->performRequest($endpoint);
1314    }
1315    /**
1316     * Simulate resolving the given template name or body
1317     *
1318     * $params['name']           = (string) The name of the index template
1319     * $params['create']         = (boolean) Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one (Default = false)
1320     * $params['cause']          = (string) User defined reason for dry-run creating the new template for simulation purposes (Default = )
1321     * $params['master_timeout'] = (time) Specify timeout for connection to master
1322     * $params['body']           = (array) New index template definition to be simulated, if no index template name is specified
1323     *
1324     * @param array $params Associative array of parameters
1325     * @return array
1326     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
1327     */
1328    public function simulateTemplate(array $params = [])
1329    {
1330        $name = $this->extractArgument($params, 'name');
1331        $body = $this->extractArgument($params, 'body');
1332
1333        $endpointBuilder = $this->endpoints;
1334        $endpoint = $endpointBuilder('Indices\SimulateTemplate');
1335        $endpoint->setParams($params);
1336        $endpoint->setName($name);
1337        $endpoint->setBody($body);
1338
1339        return $this->performRequest($endpoint);
1340    }
1341    /**
1342     * Allows you to split an existing index into a new index with more primary shards.
1343     *
1344     * $params['index']                  = (string) The name of the source index to split
1345     * $params['target']                 = (string) The name of the target index to split into
1346     * $params['copy_settings']          = (boolean) whether or not to copy settings from the source index (defaults to false)
1347     * $params['timeout']                = (time) Explicit operation timeout
1348     * $params['master_timeout']         = (time) Specify timeout for connection to master
1349     * $params['wait_for_active_shards'] = (string) Set the number of active shards to wait for on the shrunken index before the operation returns.
1350     * $params['body']                   = (array) The configuration for the target index (`settings` and `aliases`)
1351     *
1352     * @param array $params Associative array of parameters
1353     * @return array
1354     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-index.html
1355     */
1356    public function split(array $params = [])
1357    {
1358        $index = $this->extractArgument($params, 'index');
1359        $target = $this->extractArgument($params, 'target');
1360        $body = $this->extractArgument($params, 'body');
1361
1362        $endpointBuilder = $this->endpoints;
1363        $endpoint = $endpointBuilder('Indices\Split');
1364        $endpoint->setParams($params);
1365        $endpoint->setIndex($index);
1366        $endpoint->setTarget($target);
1367        $endpoint->setBody($body);
1368
1369        return $this->performRequest($endpoint);
1370    }
1371    /**
1372     * Provides statistics on operations happening in an index.
1373     *
1374     * $params['metric']                     = (list) Limit the information returned the specific metrics.
1375     * $params['index']                      = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
1376     * $params['completion_fields']          = (list) A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards)
1377     * $params['fielddata_fields']           = (list) A comma-separated list of fields for `fielddata` index metric (supports wildcards)
1378     * $params['fields']                     = (list) A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards)
1379     * $params['groups']                     = (list) A comma-separated list of search groups for `search` index metric
1380     * $params['level']                      = (enum) Return stats aggregated at cluster, index or shard level (Options = cluster,indices,shards) (Default = indices)
1381     * $params['types']                      = (list) A comma-separated list of document types for the `indexing` index metric
1382     * $params['include_segment_file_sizes'] = (boolean) Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) (Default = false)
1383     * $params['include_unloaded_segments']  = (boolean) If set to true segment stats will include stats for segments that are not currently loaded into memory (Default = false)
1384     * $params['expand_wildcards']           = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
1385     * $params['forbid_closed_indices']      = (boolean) If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices (Default = true)
1386     *
1387     * @param array $params Associative array of parameters
1388     * @return array
1389     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html
1390     */
1391    public function stats(array $params = [])
1392    {
1393        $metric = $this->extractArgument($params, 'metric');
1394        $index = $this->extractArgument($params, 'index');
1395
1396        $endpointBuilder = $this->endpoints;
1397        $endpoint = $endpointBuilder('Indices\Stats');
1398        $endpoint->setParams($params);
1399        $endpoint->setMetric($metric);
1400        $endpoint->setIndex($index);
1401
1402        return $this->performRequest($endpoint);
1403    }
1404    /**
1405     * Unfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again.
1406     *
1407     * $params['index']                  = (string) The name of the index to unfreeze
1408     * $params['timeout']                = (time) Explicit operation timeout
1409     * $params['master_timeout']         = (time) Specify timeout for connection to master
1410     * $params['ignore_unavailable']     = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
1411     * $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)
1412     * $params['expand_wildcards']       = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = closed)
1413     * $params['wait_for_active_shards'] = (string) Sets the number of active shards to wait for before the operation returns.
1414     *
1415     * @param array $params Associative array of parameters
1416     * @return array
1417     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/unfreeze-index-api.html
1418     */
1419    public function unfreeze(array $params = [])
1420    {
1421        $index = $this->extractArgument($params, 'index');
1422
1423        $endpointBuilder = $this->endpoints;
1424        $endpoint = $endpointBuilder('Indices\Unfreeze');
1425        $endpoint->setParams($params);
1426        $endpoint->setIndex($index);
1427
1428        return $this->performRequest($endpoint);
1429    }
1430    /**
1431     * Updates index aliases.
1432     *
1433     * $params['timeout']        = (time) Request timeout
1434     * $params['master_timeout'] = (time) Specify timeout for connection to master
1435     * $params['body']           = (array) The definition of `actions` to perform (Required)
1436     *
1437     * @param array $params Associative array of parameters
1438     * @return array
1439     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html
1440     */
1441    public function updateAliases(array $params = [])
1442    {
1443        $body = $this->extractArgument($params, 'body');
1444
1445        $endpointBuilder = $this->endpoints;
1446        $endpoint = $endpointBuilder('Indices\UpdateAliases');
1447        $endpoint->setParams($params);
1448        $endpoint->setBody($body);
1449
1450        return $this->performRequest($endpoint);
1451    }
1452    /**
1453     * DEPRECATED Upgrades to the current version of Lucene.
1454     *
1455     * $params['index']                 = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
1456     * $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)
1457     * $params['expand_wildcards']      = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
1458     * $params['ignore_unavailable']    = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
1459     * $params['wait_for_completion']   = (boolean) Specify whether the request should block until the all segments are upgraded (default: false)
1460     * $params['only_ancient_segments'] = (boolean) If true, only ancient (an older Lucene major release) segments will be upgraded
1461     *
1462     * @param array $params Associative array of parameters
1463     * @return array
1464     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html
1465     */
1466    public function upgrade(array $params = [])
1467    {
1468        $index = $this->extractArgument($params, 'index');
1469
1470        $endpointBuilder = $this->endpoints;
1471        $endpoint = $endpointBuilder('Indices\Upgrade');
1472        $endpoint->setParams($params);
1473        $endpoint->setIndex($index);
1474
1475        return $this->performRequest($endpoint);
1476    }
1477    /**
1478     * Allows a user to validate a potentially expensive query without executing it.
1479     *
1480     * $params['index']              = (list) A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices
1481     * $params['type']               = DEPRECATED (list) A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types
1482     * $params['explain']            = (boolean) Return detailed information about the error
1483     * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed)
1484     * $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)
1485     * $params['expand_wildcards']   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,hidden,none,all) (Default = open)
1486     * $params['q']                  = (string) Query in the Lucene query string syntax
1487     * $params['analyzer']           = (string) The analyzer to use for the query string
1488     * $params['analyze_wildcard']   = (boolean) Specify whether wildcard and prefix queries should be analyzed (default: false)
1489     * $params['default_operator']   = (enum) The default operator for query string query (AND or OR) (Options = AND,OR) (Default = OR)
1490     * $params['df']                 = (string) The field to use as default where no field prefix is given in the query string
1491     * $params['lenient']            = (boolean) Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
1492     * $params['rewrite']            = (boolean) Provide a more detailed explanation showing the actual Lucene query that will be executed.
1493     * $params['all_shards']         = (boolean) Execute validation on all shards instead of one random shard per index
1494     * $params['body']               = (array) The query definition specified with the Query DSL
1495     *
1496     * @param array $params Associative array of parameters
1497     * @return array
1498     * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.html
1499     */
1500    public function validateQuery(array $params = [])
1501    {
1502        $index = $this->extractArgument($params, 'index');
1503        $type = $this->extractArgument($params, 'type');
1504        $body = $this->extractArgument($params, 'body');
1505
1506        $endpointBuilder = $this->endpoints;
1507        $endpoint = $endpointBuilder('Indices\ValidateQuery');
1508        $endpoint->setParams($params);
1509        $endpoint->setIndex($index);
1510        $endpoint->setType($type);
1511        $endpoint->setBody($body);
1512
1513        return $this->performRequest($endpoint);
1514    }
1515    /**
1516     * Alias function to getAlias()
1517     *
1518     * @deprecated added to prevent BC break introduced in 7.2.0
1519     * @see https://github.com/elastic/elasticsearch-php/issues/940
1520     */
1521    public function getAliases(array $params = [])
1522    {
1523        return $this->getAlias($params);
1524    }
1525}
1526