1: <?php
2:
3: declare(strict_types=1);
4:
5: /**
6: * Copyright OpenSearch Contributors
7: * SPDX-License-Identifier: Apache-2.0
8: *
9: * OpenSearch PHP client
10: *
11: * @link https://github.com/opensearch-project/opensearch-php/
12: * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
13: * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
14: * @license https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1
15: *
16: * Licensed to Elasticsearch B.V under one or more agreements.
17: * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or
18: * the GNU Lesser General Public License, Version 2.1, at your option.
19: * See the LICENSE file in the project root for more information.
20: */
21:
22: namespace OpenSearch\Endpoints;
23:
24: use OpenSearch\Exception\RuntimeException;
25:
26: /**
27: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
28: */
29: class UpdateByQuery extends AbstractEndpoint
30: {
31: public function getURI(): string
32: {
33: if (!isset($this->index) || $this->index === '') {
34: throw new RuntimeException('index is required for update_by_query');
35: }
36: $index = $this->index;
37:
38: return "/$index/_update_by_query";
39: }
40:
41: public function getParamWhitelist(): array
42: {
43: return [
44: '_source',
45: '_source_excludes',
46: '_source_includes',
47: 'allow_no_indices',
48: 'analyze_wildcard',
49: 'analyzer',
50: 'conflicts',
51: 'default_operator',
52: 'df',
53: 'expand_wildcards',
54: 'from',
55: 'ignore_unavailable',
56: 'lenient',
57: 'max_docs',
58: 'pipeline',
59: 'preference',
60: 'q',
61: 'refresh',
62: 'request_cache',
63: 'requests_per_second',
64: 'routing',
65: 'scroll',
66: 'scroll_size',
67: 'search_timeout',
68: 'search_type',
69: 'size',
70: 'slices',
71: 'sort',
72: 'stats',
73: 'terminate_after',
74: 'timeout',
75: 'version',
76: 'wait_for_active_shards',
77: 'wait_for_completion',
78: 'pretty',
79: 'human',
80: 'error_trace',
81: 'source',
82: 'filter_path'
83: ];
84: }
85:
86: public function getMethod(): string
87: {
88: return 'POST';
89: }
90:
91: public function setBody($body): static
92: {
93: if (is_null($body)) {
94: return $this;
95: }
96: $this->body = $body;
97:
98: return $this;
99: }
100: }
101: