1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | /** |
6: | * SPDX-License-Identifier: Apache-2.0 |
7: | * |
8: | * The OpenSearch Contributors require contributions made to |
9: | * this file be licensed under the Apache-2.0 license or a |
10: | * compatible open source license. |
11: | * |
12: | * Modifications Copyright OpenSearch Contributors. See |
13: | * GitHub history for details. |
14: | */ |
15: | |
16: | namespace OpenSearch\Namespaces; |
17: | |
18: | use OpenSearch\Endpoints\Transforms\Delete; |
19: | use OpenSearch\Endpoints\Transforms\Explain; |
20: | use OpenSearch\Endpoints\Transforms\Get; |
21: | use OpenSearch\Endpoints\Transforms\Preview; |
22: | use OpenSearch\Endpoints\Transforms\Put; |
23: | use OpenSearch\Endpoints\Transforms\Search; |
24: | use OpenSearch\Endpoints\Transforms\Start; |
25: | use OpenSearch\Endpoints\Transforms\Stop; |
26: | |
27: | /** |
28: | * Class TransformsNamespace |
29: | * |
30: | * NOTE: This file is autogenerated using util/GenerateEndpoints.php |
31: | */ |
32: | class TransformsNamespace extends AbstractNamespace |
33: | { |
34: | /** |
35: | * Delete an index transform. |
36: | * |
37: | * $params['id'] = (string) Transform to delete |
38: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
39: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
40: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
41: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
42: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
43: | * |
44: | * @param array $params Associative array of parameters |
45: | * @return array |
46: | */ |
47: | public function delete(array $params = []) |
48: | { |
49: | $id = $this->extractArgument($params, 'id'); |
50: | |
51: | $endpoint = $this->endpointFactory->getEndpoint(Delete::class); |
52: | $endpoint->setParams($params); |
53: | $endpoint->setId($id); |
54: | |
55: | return $this->performRequest($endpoint); |
56: | } |
57: | |
58: | /** |
59: | * Returns the status and metadata of a transform job. |
60: | * |
61: | * $params['id'] = (string) Transform to explain |
62: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
63: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
64: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
65: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
66: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
67: | * |
68: | * @param array $params Associative array of parameters |
69: | * @return array |
70: | */ |
71: | public function explain(array $params = []) |
72: | { |
73: | $id = $this->extractArgument($params, 'id'); |
74: | |
75: | $endpoint = $this->endpointFactory->getEndpoint(Explain::class); |
76: | $endpoint->setParams($params); |
77: | $endpoint->setId($id); |
78: | |
79: | return $this->performRequest($endpoint); |
80: | } |
81: | |
82: | /** |
83: | * Returns the status and metadata of a transform job. |
84: | * |
85: | * $params['id'] = (string) Transform to access |
86: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
87: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
88: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
89: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
90: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
91: | * |
92: | * @param array $params Associative array of parameters |
93: | * @return array |
94: | */ |
95: | public function get(array $params = []) |
96: | { |
97: | $id = $this->extractArgument($params, 'id'); |
98: | |
99: | $endpoint = $this->endpointFactory->getEndpoint(Get::class); |
100: | $endpoint->setParams($params); |
101: | $endpoint->setId($id); |
102: | |
103: | return $this->performRequest($endpoint); |
104: | } |
105: | |
106: | /** |
107: | * Returns a preview of what a transformed index would look like. |
108: | * |
109: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
110: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
111: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
112: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
113: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
114: | * |
115: | * @param array $params Associative array of parameters |
116: | * @return array |
117: | */ |
118: | public function preview(array $params = []) |
119: | { |
120: | $body = $this->extractArgument($params, 'body'); |
121: | |
122: | $endpoint = $this->endpointFactory->getEndpoint(Preview::class); |
123: | $endpoint->setParams($params); |
124: | $endpoint->setBody($body); |
125: | |
126: | return $this->performRequest($endpoint); |
127: | } |
128: | |
129: | /** |
130: | * Create an index transform, or update a transform if `if_seq_no` and `if_primary_term` are provided. |
131: | * |
132: | * $params['id'] = (string) Transform to create/update |
133: | * $params['if_primary_term'] = (number) Only perform the operation if the document has this primary term. |
134: | * $params['if_seq_no'] = (integer) Only perform the operation if the document has this sequence number. |
135: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
136: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
137: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
138: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
139: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
140: | * |
141: | * @param array $params Associative array of parameters |
142: | * @return array |
143: | */ |
144: | public function put(array $params = []) |
145: | { |
146: | $id = $this->extractArgument($params, 'id'); |
147: | $body = $this->extractArgument($params, 'body'); |
148: | |
149: | $endpoint = $this->endpointFactory->getEndpoint(Put::class); |
150: | $endpoint->setParams($params); |
151: | $endpoint->setId($id); |
152: | $endpoint->setBody($body); |
153: | |
154: | return $this->performRequest($endpoint); |
155: | } |
156: | |
157: | /** |
158: | * Returns the details of all transform jobs. |
159: | * |
160: | * $params['from'] = (number) The starting transform to return. Default is `0`. |
161: | * $params['search'] = (string) The search term to use to filter results. |
162: | * $params['size'] = (number) Specifies the number of transforms to return. Default is `10`. |
163: | * $params['sortDirection'] = (string) Specifies the direction to sort results in. Can be `ASC` or `DESC`. Default is `ASC`. |
164: | * $params['sortField'] = (string) The field to sort results with. |
165: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
166: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
167: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
168: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
169: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
170: | * |
171: | * @param array $params Associative array of parameters |
172: | * @return array |
173: | */ |
174: | public function search(array $params = []) |
175: | { |
176: | $endpoint = $this->endpointFactory->getEndpoint(Search::class); |
177: | $endpoint->setParams($params); |
178: | |
179: | return $this->performRequest($endpoint); |
180: | } |
181: | |
182: | /** |
183: | * Start transform. |
184: | * |
185: | * $params['id'] = (string) Transform to start |
186: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
187: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
188: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
189: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
190: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
191: | * |
192: | * @param array $params Associative array of parameters |
193: | * @return array |
194: | */ |
195: | public function start(array $params = []) |
196: | { |
197: | $id = $this->extractArgument($params, 'id'); |
198: | |
199: | $endpoint = $this->endpointFactory->getEndpoint(Start::class); |
200: | $endpoint->setParams($params); |
201: | $endpoint->setId($id); |
202: | |
203: | return $this->performRequest($endpoint); |
204: | } |
205: | |
206: | /** |
207: | * Stop transform. |
208: | * |
209: | * $params['id'] = (string) Transform to stop |
210: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
211: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
212: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
213: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
214: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
215: | * |
216: | * @param array $params Associative array of parameters |
217: | * @return array |
218: | */ |
219: | public function stop(array $params = []) |
220: | { |
221: | $id = $this->extractArgument($params, 'id'); |
222: | |
223: | $endpoint = $this->endpointFactory->getEndpoint(Stop::class); |
224: | $endpoint->setParams($params); |
225: | $endpoint->setId($id); |
226: | |
227: | return $this->performRequest($endpoint); |
228: | } |
229: | |
230: | } |
231: |