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