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 InsightsNamespace
22: *
23: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
24: */
25: class InsightsNamespace extends AbstractNamespace
26: {
27: /**
28: * Retrieves the top queries based on the given metric type (latency, CPU, or memory).
29: *
30: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
31: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
32: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
33: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
34: * $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 "-".
35: *
36: * @param array $params Associative array of parameters
37: * @return array
38: */
39: public function topQueries(array $params = [])
40: {
41: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Insights\TopQueries::class);
42: $endpoint->setParams($params);
43:
44: return $this->performRequest($endpoint);
45: }
46:
47: }
48: