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\Namespaces\AbstractNamespace;
19:
20: /**
21: * Class PplNamespace
22: *
23: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
24: */
25: class PplNamespace extends AbstractNamespace
26: {
27: /**
28: * Shows how a query is executed against OpenSearch.
29: *
30: * $params['format'] = (string) A short version of the Accept header, e.g. json, yaml.
31: * $params['sanitize'] = (boolean) Specifies whether to escape special characters in the results. (Default = true)
32: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
33: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
34: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
35: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
36: * $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 "-".
37: *
38: * @param array $params Associative array of parameters
39: * @return array
40: */
41: public function explain(array $params = [])
42: {
43: $body = $this->extractArgument($params, 'body');
44:
45: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ppl\Explain::class);
46: $endpoint->setParams($params);
47: $endpoint->setBody($body);
48:
49: return $this->performRequest($endpoint);
50: }
51:
52: /**
53: * Collect metrics for the plugin within the interval.
54: *
55: * $params['format'] = (string) A short version of the Accept header, e.g. json, yaml.
56: * $params['sanitize'] = (boolean) Specifies whether to escape special characters in the results. (Default = true)
57: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
58: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
59: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
60: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
61: * $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 "-".
62: *
63: * @param array $params Associative array of parameters
64: * @return array
65: */
66: public function getStats(array $params = [])
67: {
68: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ppl\GetStats::class);
69: $endpoint->setParams($params);
70:
71: return $this->performRequest($endpoint);
72: }
73:
74: /**
75: * By a stats endpoint, you are able to collect metrics for the plugin within the interval.
76: *
77: * $params['format'] = (string) A short version of the Accept header, e.g. json, yaml.
78: * $params['sanitize'] = (boolean) Specifies whether to escape special characters in the results. (Default = true)
79: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
80: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
81: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
82: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
83: * $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 "-".
84: *
85: * @param array $params Associative array of parameters
86: * @return array
87: */
88: public function postStats(array $params = [])
89: {
90: $body = $this->extractArgument($params, 'body');
91:
92: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ppl\PostStats::class);
93: $endpoint->setParams($params);
94: $endpoint->setBody($body);
95:
96: return $this->performRequest($endpoint);
97: }
98:
99: /**
100: * Send a PPL query to the PPL plugin.
101: *
102: * $params['format'] = (string) A short version of the Accept header, e.g. json, yaml.
103: * $params['sanitize'] = (boolean) Specifies whether to escape special characters in the results. (Default = true)
104: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
105: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
106: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
107: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
108: * $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 "-".
109: *
110: * @param array $params Associative array of parameters
111: * @return array
112: */
113: public function query(array $params = [])
114: {
115: $body = $this->extractArgument($params, 'body');
116:
117: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ppl\Query::class);
118: $endpoint->setParams($params);
119: $endpoint->setBody($body);
120:
121: return $this->performRequest($endpoint);
122: }
123:
124: }
125: