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\AsynchronousSearch\Delete;
19: use OpenSearch\Endpoints\AsynchronousSearch\Get;
20: use OpenSearch\Endpoints\AsynchronousSearch\Search;
21: use OpenSearch\Endpoints\AsynchronousSearch\Stats;
22:
23: /**
24: * Class AsynchronousSearchNamespace
25: *
26: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
27: */
28: class AsynchronousSearchNamespace extends AbstractNamespace
29: {
30: /**
31: * Deletes any responses from an asynchronous search.
32: *
33: * $params['id'] = (string) (Required)
34: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
35: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
36: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
37: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
38: * $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 "-".
39: *
40: * @param array $params Associative array of parameters
41: * @return array
42: */
43: public function delete(array $params = [])
44: {
45: $id = $this->extractArgument($params, 'id');
46:
47: $endpoint = $this->endpointFactory->getEndpoint(Delete::class);
48: $endpoint->setParams($params);
49: $endpoint->setId($id);
50:
51: return $this->performRequest($endpoint);
52: }
53:
54: /**
55: * Gets partial responses from an asynchronous search.
56: *
57: * $params['id'] = (string) (Required)
58: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
59: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
60: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
61: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
62: * $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 "-".
63: *
64: * @param array $params Associative array of parameters
65: * @return array
66: */
67: public function get(array $params = [])
68: {
69: $id = $this->extractArgument($params, 'id');
70:
71: $endpoint = $this->endpointFactory->getEndpoint(Get::class);
72: $endpoint->setParams($params);
73: $endpoint->setId($id);
74:
75: return $this->performRequest($endpoint);
76: }
77:
78: /**
79: * Performs an asynchronous search.
80: *
81: * $params['index'] = (string) The name of the index to be searched. Can be an individual name, a comma-separated list of indexes, or a wildcard expression of index names.
82: * $params['keep_alive'] = (string) The amount of time that the result is saved in the cluster. For example, `2d` means that the results are stored in the cluster for 48 hours. The saved search results are deleted after this period or if the search is canceled. Note that this includes the query execution time. If the query exceeds this amount of time, the process cancels this query automatically.
83: * $params['keep_on_completion'] = (boolean) Whether to save the results in the cluster after the search is complete. You can examine the stored results at a later time.
84: * $params['wait_for_completion_timeout'] = (string) The amount of time to wait for the results. You can poll the remaining results based on an ID. The maximum value is 300 seconds. Default is `1s`.
85: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
86: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
87: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
88: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
89: * $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 "-".
90: *
91: * @param array $params Associative array of parameters
92: * @return array
93: */
94: public function search(array $params = [])
95: {
96: $body = $this->extractArgument($params, 'body');
97:
98: $endpoint = $this->endpointFactory->getEndpoint(Search::class);
99: $endpoint->setParams($params);
100: $endpoint->setBody($body);
101:
102: return $this->performRequest($endpoint);
103: }
104:
105: /**
106: * Monitors any asynchronous searches that are `running`, `completed`, or `persisted`.
107: *
108: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
109: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
110: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
111: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
112: * $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 "-".
113: *
114: * @param array $params Associative array of parameters
115: * @return array
116: */
117: public function stats(array $params = [])
118: {
119: $endpoint = $this->endpointFactory->getEndpoint(Stats::class);
120: $endpoint->setParams($params);
121:
122: return $this->performRequest($endpoint);
123: }
124:
125: }
126: