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\Namespaces;
23:
24: use OpenSearch\Endpoints\Ingest\DeletePipeline;
25: use OpenSearch\Endpoints\Ingest\GetPipeline;
26: use OpenSearch\Endpoints\Ingest\ProcessorGrok;
27: use OpenSearch\Endpoints\Ingest\PutPipeline;
28: use OpenSearch\Endpoints\Ingest\Simulate;
29:
30: /**
31: * Class IngestNamespace
32: *
33: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
34: */
35: class IngestNamespace extends AbstractNamespace
36: {
37: /**
38: * Deletes an ingest pipeline.
39: *
40: * $params['id'] = (string) The pipeline ID or wildcard expression of pipeline IDs used to limit the request. To delete all ingest pipelines in a cluster, use a value of `*`.
41: * $params['cluster_manager_timeout'] = (string) The amount of time allowed to establish a connection to the cluster manager node.
42: * $params['master_timeout'] = (string) Period to wait for a connection to the cluster-manager node.If no response is received before the timeout expires, the request fails and returns an error.
43: * $params['timeout'] = (string) The amount of time to wait for a response.
44: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
45: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
46: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
47: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
48: * $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 "-".
49: *
50: * @param array $params Associative array of parameters
51: * @return array
52: */
53: public function deletePipeline(array $params = [])
54: {
55: $id = $this->extractArgument($params, 'id');
56:
57: $endpoint = $this->endpointFactory->getEndpoint(DeletePipeline::class);
58: $endpoint->setParams($params);
59: $endpoint->setId($id);
60:
61: return $this->performRequest($endpoint);
62: }
63:
64: /**
65: * Returns an ingest pipeline.
66: *
67: * $params['id'] = (string) A comma-separated list of pipeline IDs to retrieve. Wildcard (`*`) expressions are supported. To get all ingest pipelines, omit this parameter or use `*`.
68: * $params['cluster_manager_timeout'] = (string) The amount of time allowed to establish a connection to the cluster manager node.
69: * $params['master_timeout'] = (string) Period to wait for a connection to the cluster-manager node.If no response is received before the timeout expires, the request fails and returns an error.
70: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
71: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
72: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
73: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
74: * $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 "-".
75: *
76: * @param array $params Associative array of parameters
77: * @return array
78: */
79: public function getPipeline(array $params = [])
80: {
81: $id = $this->extractArgument($params, 'id');
82:
83: $endpoint = $this->endpointFactory->getEndpoint(GetPipeline::class);
84: $endpoint->setParams($params);
85: $endpoint->setId($id);
86:
87: return $this->performRequest($endpoint);
88: }
89:
90: /**
91: * Returns a list of built-in grok patterns.
92: *
93: * $params['s'] = (boolean) Determines how to sort returned grok patterns by key name. (Default = false)
94: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
95: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
96: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
97: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
98: * $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 "-".
99: *
100: * @param array $params Associative array of parameters
101: * @return array
102: */
103: public function processorGrok(array $params = [])
104: {
105: $endpoint = $this->endpointFactory->getEndpoint(ProcessorGrok::class);
106: $endpoint->setParams($params);
107:
108: return $this->performRequest($endpoint);
109: }
110:
111: /**
112: * Creates or updates an ingest pipeline.
113: *
114: * $params['id'] = (string) The ID of the ingest pipeline.
115: * $params['cluster_manager_timeout'] = (string) The amount of time allowed to establish a connection to the cluster manager node.
116: * $params['master_timeout'] = (string) Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error.
117: * $params['timeout'] = (string) The amount of time to wait for a response.
118: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
119: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
120: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
121: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
122: * $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 "-".
123: * $params['body'] = (array) The ingest definition. (Required)
124: *
125: * @param array $params Associative array of parameters
126: * @return array
127: */
128: public function putPipeline(array $params = [])
129: {
130: $id = $this->extractArgument($params, 'id');
131: $body = $this->extractArgument($params, 'body');
132:
133: $endpoint = $this->endpointFactory->getEndpoint(PutPipeline::class);
134: $endpoint->setParams($params);
135: $endpoint->setId($id);
136: $endpoint->setBody($body);
137:
138: return $this->performRequest($endpoint);
139: }
140:
141: /**
142: * Simulates an ingest pipeline with example documents.
143: *
144: * $params['id'] = (string) The pipeline to test. If you don't specify a `pipeline` in the request body, this parameter is required.
145: * $params['verbose'] = (boolean) When `true`, the response includes output data for each processor in the pipeline (Default = false)
146: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
147: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
148: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
149: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
150: * $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 "-".
151: * $params['body'] = (array) The simulate definition (Required)
152: *
153: * @param array $params Associative array of parameters
154: * @return array
155: */
156: public function simulate(array $params = [])
157: {
158: $id = $this->extractArgument($params, 'id');
159: $body = $this->extractArgument($params, 'body');
160:
161: $endpoint = $this->endpointFactory->getEndpoint(Simulate::class);
162: $endpoint->setParams($params);
163: $endpoint->setId($id);
164: $endpoint->setBody($body);
165:
166: return $this->performRequest($endpoint);
167: }
168:
169: }
170: